epdom.c

filter: Statementstmt 0.0% 0 / 1366 Branchbran 0.0% 0 / 1116 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 2482 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« epdefault.c ↑ Summary epeval.c »
1 /*###################################################################################
2 #
3 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
4 # Embperl - Copyright (c) 2008-2015 Gerald Richter
5 # Embperl - Copyright (c) 2015-2023 actevy.io
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9 #
10 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 #
14 ###################################################################################*/
15  
16  
17 #include "ep.h"
18 #include "epmacro.h"
19  
20  
21 /* --- don't use Perl's memory management here --- */
22  
23 #ifndef DMALLOC
24 #undef malloc
25 #undef realloc
26 #undef strdup
27 #undef free
28 #endif
29  
30  
31 HV * pStringTableHash ; /* Hash to translate strings to index number */
32 HE * * pStringTableArray ; /* Array with pointers to strings */
33 static tStringIndex * pFreeStringsNdx ; /* List of freed string indexes */
34  
35  
36 tDomTree * pDomTrees ;
37 static tIndexShort * pFreeDomTrees ;
38  
39 static int nMemUsage = 0 ;
40 static int numNodes = 0 ;
41 static int numLevelLookup = 0 ;
42 static int numLevelLookupItem = 0 ;
43 static int numAttr = 0 ;
44 static int numStr = 0 ;
45 static int numReplace = 0 ;
46  
47 tIndex xNoName = 0 ;
48 tIndex xDomTreeAttr = 0 ;
49 tIndex xDocument ;
50 tIndex xDocumentFraq ;
51 tIndex xOrderIndexAttr ;
52  
53 static tUInt8 * MemFree[4196] ;
54 static tUInt8 * pMemLast = NULL ;
55 static tUInt8 * pMemEnd = NULL ;
56  
57 struct tPad
58 {
59 tNodeData Nodes [1024] ;
60 } ;
61  
62 typedef struct tPad tPad ;
63  
64 #define LEVELHASHSIZE 8
65  
66 /* ------------------------------------------------------------------------ */
67 /* */
68 /* mydie */
69 /* */
70 /* Fatal Error */
71 /* */
72 /* ------------------------------------------------------------------------ */
73  
74 0 void mydie (/*in*/ tApp * a,
75 char * msg)
76 {
77 epaTHX_
78  
79 0 LogErrorParam (a, 9999, msg, "") ;
80 0 puts (msg) ;
81 #ifdef EPDEBUG
82 #if defined (__GNUC__) && defined (__i386__)
83 __asm__ ("int $0x03\n") ;
84 #endif
85 #endif
86 0 exit (1) ;
87 }
88  
89 /* ------------------------------------------------------------------------ */
90 /* */
91 /* Node memory management */
92 /* */
93 /* ------------------------------------------------------------------------ */
94  
95  
96 #ifdef DMALLOC
97 tNodeData * dom_malloc_dbg (/*in*/ tApp * a,
98 size_t nSize, int * pCounter,
99 char * fn, int l)
100 #else
101 0 tNodeData * dom_malloc (/*in*/ tApp * a,
102 size_t nSize, int * pCounter)
103 #endif
104 {
105 epaTHX_
106 0 int nFree = (nSize+7)>>3 ;
107 void * pNew ;
108
109 0 ▶ if (nFree > sizeof (MemFree) / sizeof (void *))
Branch: 1 branch
BranchTrueFalseTotal
if (nFree > sizeof (MemFree) / sizeof (void *)) 0 0 0
110 0 mydie (a, "Node to huge for dom_malloc") ;
111  
112 0 ▶ if ((pNew = MemFree[nFree]))
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = MemFree[nFree])) 0 0 0
113 { /* --- take one entry off the free list --- */
114 0 MemFree[nFree] = *((tUInt8 * *)pNew) ;
115 0 (*pCounter)++ ;
116 0 return pNew ;
117 }
118
119 0 nSize = nFree * 8 ; /* --- make dividable by 8 --- */
120 0 ▶ if (pMemLast + nSize < pMemEnd)
Branch: 1 branch
BranchTrueFalseTotal
if (pMemLast + nSize < pMemEnd) 0 0 0
121 { /* --- take space at the end of the pad --- */
122 0 pNew = pMemLast ;
123 0 pMemLast += nSize ;
124 0 (*pCounter)++ ;
125 0 return pNew ;
126 }
127
128 /* --- Pad full -> alloc new one --- */
129
130 #ifdef DMALLOC
131 pMemLast = _malloc_leap(fn, l, sizeof (tPad)) ;
132 #else
133 0 pMemLast = malloc(sizeof (tPad)) ;
134 #endif
135  
136 0 ▶ if (pMemLast == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (pMemLast == NULL) 0 0 0
137 {
138 char buf[256] ;
139 0 sprintf (buf, "dom_malloc: Out of memory (%u bytes)", (unsigned int)sizeof (tPad)) ;
140 0 mydie (a, buf) ;
141 }
142
143 0 nMemUsage += sizeof (tPad) ;
144  
145 0 pMemEnd = pMemLast + sizeof (tPad) ;
146 0 pNew = pMemLast ;
147 0 pMemLast += nSize ;
148 0 (*pCounter)++ ;
149 0 return pNew ;
150 }
151  
152  
153 #ifdef DMALLOC
154 #undef dom_malloc
155 #define dom_malloc(a,n,p) dom_malloc_dbg ((a),(n),(p),__FILE__,__LINE__)
156 #endif
157  
158  
159  
160 0 void dom_free (/*in*/ tApp * a,
161 tNodeData * pNode, int * pCounter)
162 {
163 0 int nSize = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ;
164 0 int nFree = (nSize+7)>>3 ;
165 void * pFree ;
166
167 0 ▶ if (nFree > sizeof (MemFree) / sizeof (void *))
Branch: 1 branch
BranchTrueFalseTotal
if (nFree > sizeof (MemFree) / sizeof (void *)) 0 0 0
168 0 mydie (a, "Node to huge for dom_malloc") ;
169  
170 /* --- add to the free list --- */
171 0 pFree = MemFree[nFree] ;
172 0 MemFree[nFree] = (tUInt8 *)pNode ;
173 0 *((tUInt8 * *)pNode) = pFree ;
174 0 (*pCounter)-- ;
175 0 return ;
176 }
177  
178  
179 0 void dom_free_size (/*in*/ tApp * a,
180 void * pNode, int nSize, int * pCounter)
181 {
182 0 int nFree = (nSize+7)>>3 ;
183 void * pFree ;
184
185 0 ▶ if (nFree > sizeof (MemFree) / sizeof (void *))
Branch: 1 branch
BranchTrueFalseTotal
if (nFree > sizeof (MemFree) / sizeof (void *)) 0 0 0
186 0 mydie (a, "Node to huge for dom_malloc") ;
187  
188 /* --- add to the free list --- */
189 0 pFree = MemFree[nFree] ;
190 0 MemFree[nFree] = (tUInt8 *)pNode ;
191 0 *((tUInt8 * *)pNode) = pFree ;
192 0 (*pCounter)-- ;
193 0 return ;
194 }
195  
196  
197  
198 0 tNodeData * dom_realloc (/*in*/ tApp * a,
199 tNodeData * pNode, size_t nSize)
200 {
201 0 int nOldSize = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ;
202 tNodeData * pNew ;
203 int n ;
204  
205 0 ▶ if (((tUInt8 *)pNode) + nOldSize == pMemLast)
Branch: 1 branch
BranchTrueFalseTotal
if (((tUInt8 *)pNode) + nOldSize == pMemLast) 0 0 0
206 { /* --- expand --- */
207 0 ▶ if (((tUInt8 *)pNode) + nSize < pMemEnd)
Branch: 1 branch
BranchTrueFalseTotal
if (((tUInt8 *)pNode) + nSize < pMemEnd) 0 0 0
208 { /* --- take space at the end of the pad --- */
209 0 pMemLast = ((tUInt8 *)pNode) + nSize ;
210 0 return pNode ;
211 }
212 }
213
214 0 pNew = dom_malloc (a, nSize, &n) ;
215 0 memcpy (pNew, pNode, nOldSize) ;
216 0 dom_free (a, pNode, &n) ;
217 0 return pNew ;
218 }
219  
220  
221 /* ------------------------------------------------------------------------ */
222 /* */
223 /* general memory management */
224 /* */
225 /* ------------------------------------------------------------------------ */
226  
227 0 void * str_malloc (/*in*/ tApp * a,
228 size_t n)
229 {
230 epaTHX_
231 0 void * m = malloc(n + sizeof (size_t)) ;
232 size_t * m_size;
233 0 ▶ if (m)
Branch: 1 branch
BranchTrueFalseTotal
if (m) 0 0 0
234 {
235 0 nMemUsage += n ;
236 /* make the following in multiple step, so sun-cc is happy... */
237 0 m_size = (size_t *) m;
238 0 *m_size = n;
239 0 m_size++;
240 0 m = (void *) m_size ;
241 }
242 else
243 {
244 char buf[256] ;
245 /*
246 sprintf (buf, "%zu bytes", n) ;
247 LogErrorParam (a, rcOutOfMemory, "str_malloc failed", buf) ;
248 */
249 0 sprintf (buf, "str_malloc: Out of memory (%u bytes)", (unsigned int)(n + sizeof (size_t))) ;
250 0 mydie (a, buf) ;
251 }
252  
253 0 return m ;
254 }
255  
256 #ifdef DMALLOC
257  
258 void * str_malloc_dbg (/*in*/ tApp * a,
259 size_t n, char * fn, int l)
260 {
261 epaTHX_
262 void * m = _malloc_leap(fn, l, n + sizeof (size_t)) ;
263 size_t * m_size;
264 if (m)
265 {
266 nMemUsage += n ;
267 /* make the following in multiple step, so sun-cc is happy... */
268 m_size = (size_t *) m;
269 *m_size = n;
270 m_size++;
271 m = (void *) m_size ;
272 }
273 else
274 {
275 char buf[256] ;
276 /*
277 sprintf (buf, "%zu bytes", n) ;
278 LogErrorParam (a, rcOutOfMemory, "str_malloc_dbg failed", buf) ;
279 */
280 sprintf (buf, "str_malloc: Out of memory (%u bytes)", n + sizeof (size_t)) ;
281 mydie (a, buf) ;
282 }
283  
284 return m ;
285 }
286  
287 #endif
288  
289 0 void * str_realloc (/*in*/ tApp * a,
290 void * s, size_t n)
291 {
292 epaTHX_
293 0 void * m = ((size_t *)s) - 1 ;
294 size_t * m_size;
295 0 nMemUsage -= *((size_t *)m) ;
296 0 ▶ if ((m = realloc (m, n + sizeof (size_t))))
Branch: 1 branch
BranchTrueFalseTotal
if ((m = realloc (m, n + sizeof (size_t)))) 0 0 0
297 {
298 0 nMemUsage += n ;
299 /* make the following in multiple step, so sun-cc is happy... */
300 0 m_size = (size_t *) m;
301 0 *m_size = n;
302 0 m_size++;
303 0 m = (void *) m_size ;
304 }
305 else
306 {
307 char buf[256] ;
308 /*
309 sprintf (buf, "%zu bytes", n) ;
310 LogErrorParam (a, rcOutOfMemory, "str_realloc failed", buf) ;
311 */
312 0 sprintf (buf, "str_realloc: Out of memory (%u bytes)", (unsigned int)(n + sizeof (size_t))) ;
313 0 mydie (a, buf) ;
314 }
315
316 0 return m ;
317 }
318  
319  
320 #ifdef DMALLOC
321  
322 void * str_realloc_dbg (/*in*/ tApp * a,
323 void * s, size_t n, char * fn, int l)
324 {
325 epaTHX_
326 void * m = ((size_t *)s) - 1 ;
327 size_t * m_size;
328 nMemUsage -= *((size_t *)m) ;
329 if ((m = _realloc_leap (fn, l, m, n + sizeof (size_t))))
330 {
331 nMemUsage += n ;
332 /* make the following in multiple step, so sun-cc is happy... */
333 m_size = (size_t *) m;
334 *m_size = n;
335 m_size++;
336 m = (void *) m_size ;
337 }
338 else
339 {
340 char buf[256] ;
341 /*
342 sprintf (buf, "%zu bytes", n) ;
343 LogErrorParam (a, rcOutOfMemory, "str_realloc failed", buf) ;
344 */
345 sprintf (buf, "str_realloc: Out of memory (%u bytes)", n + sizeof (size_t)) ;
346 mydie (a, buf) ;
347 }
348  
349 return m ;
350 }
351  
352 #endif
353  
354 0 void str_free (/*in*/ tApp * a,
355 void * s)
356 {
357 epaTHX_
358 0 void * m = ((size_t *)s) - 1 ;
359 0 nMemUsage -= *((size_t *)m) ;
360 0 free (m) ;
361 0 }
362  
363  
364  
365  
366  
367  
368 /* forward */
369 static int DomTree_free (pTHX_ SV * pSV, MAGIC * mg) ;
370  
371  
372  
373  
374  
375 /* ------------------------------------------------------------------------ */
376 /* */
377 /* ArrayNew */
378 /* */
379 /*!
380 *
381 * \_en
382 * Create a new dynamic array
383 *
384 * @param pArray Pointer to pointer that will hold new array
385 * @param nAdd Number of items that should be added when array
386 * must be extented
387 * @param nElementSize Size of one element
388 * \endif
389 *
390 * \_de
391 * Erstellt eine neues dynamisches Array
392 *
393 * @param pArray Zeiger auf den Zeiger der auf das neue Array zeigt
394 * @param nAdd Anzahl der Element die hinzugef?gt werden, wenn
395 * das Array vergr??ert werden mu?
396 * @param nElementSize Gr??e eines Elements
397 * \endif
398 *
399 * ------------------------------------------------------------------------ */
400  
401 #ifdef DMALLOC
402 int ArrayNew_dbg (/*in*/ tApp * a,
403 /*in*/ const tArray * pArray,
404 /*in*/ int nAdd,
405 /*in*/ int nElementSize,
406 /*in*/ char * sFile,
407 /*in*/ int nLine)
408 #else
409 0 int ArrayNew (/*in*/ tApp * a,
410 /*in*/ const tArray * pArray,
411 /*in*/ int nAdd,
412 /*in*/ int nElementSize)
413 #endif
414  
415 {
416 struct tArrayCtrl * pNew ;
417
418 #ifdef DMALLOC
419 if ((pNew = str_malloc_dbg (a, nAdd * nElementSize + sizeof (struct tArrayCtrl), sFile, nLine)) == NULL)
420 return 0 ;
421 #else
422 0 ▶ if ((pNew = str_malloc (a, nAdd * nElementSize + sizeof (struct tArrayCtrl))) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = str_malloc (a, nAdd * nElementSize + sizeof (struct tArrayCtrl))) == NULL) 0 0 0
423 0 return 0 ;
424 #endif
425
426 0 memset (pNew, 0, nAdd * nElementSize + sizeof (struct tArrayCtrl)) ;
427 0 *(void * *)pArray = (struct tArray *)(pNew + 1) ;
428 0 pNew -> nMax = nAdd ;
429 0 pNew -> nAdd = nAdd ;
430 0 pNew -> nFill = 0 ;
431 0 pNew -> nElementSize = nElementSize ;
432 #ifdef DMALLOC
433 strncpy (pNew -> sSig, "ARY ", sizeof (pNew -> sSig)) ;
434 pNew -> sFile = sFile ;
435 pNew -> nLine = nLine ;
436 #endif
437 0 return ok ;
438 }
439  
440 /* ------------------------------------------------------------------------ */
441 /* */
442 /* ArrayNewZero */
443 /* */
444 /*!
445 *
446 * \_en
447 * Create a new dynamic array and set it's content to all zero
448 *
449 * @param pArray Pointer to pointer that will hold new array
450 * @param nAdd Number of items that should be added when array
451 * must be extented
452 * @param nElementSize Size of one element
453 * \endif
454 *
455 * \_de
456 * Erstellt eine neues dynamisches Array und setzt seinen Inhalt auf Null
457 *
458 * @param pArray Zeiger auf den Zeiger der auf das neue Array zeigt
459 * @param nAdd Anzahl der Element die hinzugef?gt werden, wenn
460 * das Array vergr??ert werden mu?
461 * @param nElementSize Gr??e eines Elements
462 * \endif
463 *
464 * ------------------------------------------------------------------------ */
465  
466 #ifdef DMALLOC
467 int ArrayNewZero_dbg (/*in*/ tApp * a,
468 /*in*/ const tArray * pArray,
469 /*in*/ int nAdd,
470 /*in*/ int nElementSize,
471 /*in*/ char * sFile,
472 /*in*/ int nLine)
473 #else
474 0 int ArrayNewZero (/*in*/ tApp * a,
475 /*in*/ const tArray * pArray,
476 /*in*/ int nAdd,
477 /*in*/ int nElementSize)
478 #endif
479  
480 {
481 struct tArrayCtrl * pNew ;
482
483 #ifdef DMALLOC
484 if ((pNew = str_malloc_dbg (a, nAdd * nElementSize + sizeof (struct tArrayCtrl), sFile, nLine)) == NULL)
485 return 0 ;
486 #else
487 0 ▶ if ((pNew = str_malloc (a, nAdd * nElementSize + sizeof (struct tArrayCtrl))) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = str_malloc (a, nAdd * nElementSize + sizeof (struct tArrayCtrl))) == NULL) 0 0 0
488 0 return 0 ;
489 #endif
490
491 0 memset (pNew, 0, nAdd * nElementSize + sizeof (struct tArrayCtrl)) ;
492 0 *(void * *)pArray = (struct tArray *)(pNew + 1) ;
493 0 pNew -> nMax = nAdd ;
494 0 pNew -> nAdd = nAdd ;
495 0 pNew -> nFill = 0 ;
496 0 pNew -> nElementSize = nElementSize ;
497 #ifdef DMALLOC
498 strncpy (pNew -> sSig, "ARY ", sizeof (pNew -> sSig)) ;
499 pNew -> sFile = sFile ;
500 pNew -> nLine = nLine ;
501 #endif
502  
503 0 memset (pNew+1, 0, nAdd * nElementSize) ;
504  
505 0 return ok ;
506 }
507  
508  
509 /* ------------------------------------------------------------------------ */
510 /* */
511 /* ArrayFree */
512 /* */
513 /* Create a new dynamic array */
514 /* */
515 /* ------------------------------------------------------------------------ */
516  
517 0 int ArrayFree (/*in*/ tApp * a,
518 /*in*/ const tArray * pArray)
519  
520  
521 {
522 0 ▶ if ((*(void * *)pArray))
Branch: 1 branch
BranchTrueFalseTotal
if ((*(void * *)pArray)) 0 0 0
523 {
524 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
525  
526 #ifdef DMALLOC
527 if (strncmp (pCtrl -> sSig, "ARY ", sizeof (pCtrl -> sSig)) != 0)
528 {
529 LogErrorParam (a, rcCleanupErr, "ArrayFree Signature", pCtrl -> sSig) ;
530 }
531 strncpy (pCtrl -> sSig, "ARYFR", sizeof (pCtrl -> sSig)) ;
532  
533 #endif
534 0 str_free (a, pCtrl) ;
535  
536 0 (*(void * *)pArray) = NULL ;
537 }
538  
539 0 return ok ;
540 }
541  
542 /* ------------------------------------------------------------------------ */
543 /* */
544 /* ArrayClone */
545 /* */
546 /* Create a new dynamic array as exact copy of old one */
547 /* */
548 /* ------------------------------------------------------------------------ */
549  
550 #ifdef DMALLOC
551 int ArrayClone_dbg (/*in*/ tApp * a,
552 /*in*/ const tArray * pOrgArray,
553 /*out*/ const tArray * pNewArray,
554 /*in*/ char * sFile,
555 /*in*/ int nLine)
556 #else
557 0 int ArrayClone (/*in*/ tApp * a,
558 /*in*/ const tArray * pOrgArray,
559 /*out*/ const tArray * pNewArray)
560 #endif
561  
562 {
563 0 ▶ if (pOrgArray)
Branch: 1 branch
BranchTrueFalseTotal
if (pOrgArray) 0 0 0
564 {
565 struct tArrayCtrl * pNew ;
566 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pOrgArray)) - 1 ;
567 0 int size = pCtrl -> nFill * pCtrl -> nElementSize + sizeof (struct tArrayCtrl) ;
568
569 #ifdef DMALLOC
570 if ((pNew = str_malloc_dbg (a, size, sFile, nLine)) == NULL)
571 return 0 ;
572 #else
573 0 ▶ if ((pNew = str_malloc (a, size)) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = str_malloc (a, size)) == NULL) 0 0 0
574 0 return 0 ;
575 #endif
576
577 0 memcpy (pNew, pCtrl, size) ;
578 0 *(void * *)pNewArray = (struct tArray *)(pNew + 1) ;
579 0 pNew -> nMax = pCtrl -> nFill ;
580 }
581 else
582 {
583 0 *(void * *)pNewArray = NULL ;
584 }
585 0 return ok ;
586 }
587  
588  
589 /* ------------------------------------------------------------------------ */
590 /* */
591 /* ArrayAdd */
592 /* */
593 /* Make space for numElements in Array and return index of first one */
594 /* */
595 /* ------------------------------------------------------------------------ */
596  
597  
598 0 int ArrayAdd (/*in*/ tApp * a,
599 /*in*/ const tArray * pArray,
600 /*in*/ int numElements)
601  
602 {
603 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
604 int nNdx ;
605  
606  
607 0 ▶ if (pCtrl -> nFill + numElements > pCtrl -> nMax)
Branch: 1 branch
BranchTrueFalseTotal
if (pCtrl -> nFill + numElements > pCtrl -> nMax) 0 0 0
608 {
609 struct tArrayCtrl * pNew ;
610 0 int nNewMax = pCtrl -> nFill + numElements + pCtrl -> nAdd ;
611
612 #ifdef DMALLOC
613 if ((pNew = str_realloc_dbg (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl), pCtrl -> sFile, pCtrl -> nLine)) == NULL)
614 return 0 ;
615 #else
616 0 ▶ if ((pNew = str_realloc (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl))) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = str_realloc (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl))) == NULL) 0 0 0
617 0 return 0 ;
618 #endif
619 0 *(void * *)pArray = (struct tArray *)(pNew + 1) ;
620 0 pNew -> nMax = nNewMax ;
621 0 pCtrl = pNew ;
622 }
623  
624 0 nNdx = pCtrl -> nFill ;
625 0 pCtrl -> nFill += numElements ;
626 0 return nNdx ;
627 }
628  
629 /* ------------------------------------------------------------------------ */
630 /* */
631 /* ArraySub */
632 /* */
633 /* Remove numElemenets from the end of the array. Does not reallocate memory*/
634 /* Returns -1 if less then numElemenets are avialable */
635 /* */
636 /* ------------------------------------------------------------------------ */
637  
638  
639 0 int ArraySub (/*in*/ tApp * a,
640 /*in*/ const tArray * pArray,
641 /*in*/ int numElements)
642  
643 {
644 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
645  
646  
647 0 ▶ if (pCtrl -> nFill < numElements)
Branch: 1 branch
BranchTrueFalseTotal
if (pCtrl -> nFill < numElements) 0 0 0
648 0 return -1 ;
649 else
650 0 pCtrl -> nFill -= numElements ;
651  
652 0 return pCtrl -> nFill ;
653 }
654  
655 /* ------------------------------------------------------------------------ */
656 /* */
657 /* ArraySet */
658 /* */
659 /* Make space that at least numElements in the Array */
660 /* */
661 /* ------------------------------------------------------------------------ */
662  
663  
664 0 int ArraySet (/*in*/ tApp * a,
665 /*in*/ const tArray * pArray,
666 /*in*/ int numElements)
667  
668 {
669 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
670 char * p ;
671  
672 0 ▶ if (numElements > pCtrl -> nMax)
Branch: 1 branch
BranchTrueFalseTotal
if (numElements > pCtrl -> nMax) 0 0 0
673 {
674 struct tArrayCtrl * pNew ;
675 0 int nNewMax = pCtrl -> nFill + pCtrl -> nAdd ;
676  
677 0 ▶ if (nNewMax < numElements)
Branch: 1 branch
BranchTrueFalseTotal
if (nNewMax < numElements) 0 0 0
678 0 nNewMax = numElements + pCtrl -> nAdd ;
679
680 #ifdef DMALLOC
681 if ((pNew = str_realloc_dbg (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl), pCtrl -> sFile, pCtrl -> nLine)) == NULL)
682 return 0 ;
683 #else
684 0 ▶ if ((pNew = str_realloc (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl))) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = str_realloc (a, pCtrl, nNewMax * pCtrl -> nElementSize + sizeof (struct tArrayCtrl))) == NULL) 0 0 0
685 {
686 0 return 0 ;
687 }
688 #endif
689
690 0 p = (char *)(pNew + 1) ;
691 0 *(void * *)pArray = (struct tArray *)p ;
692 0 memset (p + pNew -> nMax * pNew -> nElementSize, 0, (nNewMax - pNew -> nMax) * pNew -> nElementSize) ;
693 0 pNew -> nMax = nNewMax ;
694 0 pCtrl = pNew ;
695 }
696  
697 0 return numElements ;
698 }
699  
700 /* ------------------------------------------------------------------------ */
701 /* */
702 /* ArraySetSize */
703 /* */
704 /* Make space for exact numElements in the Array */
705 /* */
706 /* ------------------------------------------------------------------------ */
707  
708  
709 0 int ArraySetSize (/*in*/ tApp * a,
710 /*in*/ const tArray * pArray,
711 /*in*/ int numElements)
712  
713 {
714 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ;
715  
716 0 ▶ if (numElements > pCtrl -> nMax)
Branch: 1 branch
BranchTrueFalseTotal
if (numElements > pCtrl -> nMax) 0 0 0
717 0 ArraySet (a, pArray, numElements) ;
718
719 0 pCtrl -> nFill = numElements ;
720  
721 0 return numElements ;
722 }
723  
724  
725 /* ------------------------------------------------------------------------ */
726 /* */
727 /* ArrayGetSize */
728 /* */
729 /* Get size of Array */
730 /* */
731 /* ------------------------------------------------------------------------ */
732  
733  
734 0 int ArrayGetSize (/*in*/ tApp *a,
735 /*in*/ const tArray * pArray)
736  
737 {
738 0 struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(pArray)) - 1 ;
739
740 0 return pCtrl -> nFill ;
741 }
742  
743  
744  
745 /* ------------------------------------------------------------------------ */
746 /* */
747 /* StringNew */
748 /* */
749 /* create a new string */
750 /* */
751 /* ------------------------------------------------------------------------ */
752  
753  
754 #ifdef DMALLOC
755 void StringNew_dbg (/*in*/ tApp * a,
756 /*in*/ char * * pArray,
757 /*in*/ int nAdd,
758 /*in*/ char * sFile,
759 /*in*/ int nLine)
760 #else
761 0 void StringNew (/*in*/ tApp * a,
762 /*in*/ char * * pArray,
763 /*in*/ int nAdd)
764 #endif
765  
766 {
767 0 ▶ if ((*(void * *)pArray) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((*(void * *)pArray) == NULL) 0 0 0
768 #ifdef DMALLOC
769 ArrayNew_dbg (a, pArray, nAdd, sizeof (char), sFile, nLine) ;
770 #else
771 0 ArrayNew (a, pArray, nAdd, sizeof (char)) ;
772 #endif
773 else
774 0 ArraySetSize (a, pArray, 0);
775 0 }
776  
777 /* ------------------------------------------------------------------------ */
778 /* */
779 /* StringFree */
780 /* */
781 /* Free String memory */
782 /* */
783 /* ------------------------------------------------------------------------ */
784  
785  
786 0 void StringFree (/*in*/ tApp * a,
787 /*in*/ char * * pArray)
788
789  
790 {
791 0 ▶ if ((*(void * *)pArray) != NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((*(void * *)pArray) != NULL) 0 0 0
792 0 ArrayFree (a, pArray) ;
793 0 }
794  
795  
796 /* ------------------------------------------------------------------------ */
797 /* */
798 /* StringAdd */
799 /* */
800 /* append to string */
801 /* */
802 /* ------------------------------------------------------------------------ */
803  
804  
805 0 int StringAdd (/*in*/ tApp * a,
806 /*in*/ char * * pArray,
807 /*in*/ const char * sAdd,
808 /*in*/ int nLen)
809  
810 {
811 int nIndex ;
812 int nFill ;
813  
814 0 ▶ if (nLen == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (nLen == 0) 0 0 0
815 0 nLen = strlen (sAdd) ;
816  
817 0 nFill = ArrayGetSize (a, *pArray) ;
818 /* make sure we always have a trailing zero */
819 0 ArraySet(a, pArray, nFill + nLen + 1) ;
820  
821 0 nIndex = ArrayAdd (a, pArray, nLen) ;
822  
823 0 memcpy ((*pArray)+nIndex, sAdd, nLen) ;
824
825 0 return nIndex ;
826 }
827  
828  
829  
830  
831 /* ------------------------------------------------------------------------ */
832 /* */
833 /* String2Ndx */
834 /* */
835 /* Convert String to an index, if string already exists return index of */
836 /* existing string */
837 /* */
838 /* ------------------------------------------------------------------------ */
839  
840  
841 0 tStringIndex String2NdxInc (/*in*/ tApp * a,
842 /*in*/ const char * sText,
843 /*in*/ int nLen,
844 /*in*/ int bInc)
845  
846 {
847 epaTHX_
848 SV * * ppSV ;
849 SV * pSVKey ;
850 SV * pSVNdx ;
851 HE * pHEKey ;
852 int nNdx ;
853
854  
855 0 ▶ if (sText == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (sText == NULL) 0 0 0
856 0 return 0 ;
857  
858 0 ▶ if ((ppSV = hv_fetch (pStringTableHash, (char *)sText, nLen, 0)) != NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((ppSV = hv_fetch (pStringTableHash, (char *)sText, nLen, 0)) != NULL) 0 0 0
859 {
860  
861 /*lprintf (a, "String2Ndx type=%d iok=%d flg=%x\n", *ppSV?SvTYPE(*ppSV):-1, SvIOK (*ppSV), SvFLAGS(*ppSV)) ;*/
862  
863 0 ▶ if (*ppSV != NULL && SvIOKp (*ppSV)) /* use SvIOKp to avoid problems with tainting */
Branch: 2 branches
BranchTrueFalseTotal
if (*ppSV != NULL && SvIOKp (*ppSV)) /* use SvIOKp to avoid problems with tainting */ 0 0 0
if (*ppSV != NULL && SvIOKp (*ppSV)) /* use SvIOKp to avoid problems with tainting */ 0 0 0
864 {
865 0 ▶ if (bInc)
Branch: 1 branch
BranchTrueFalseTotal
if (bInc) 0 0 0
866 0 SvREFCNT_inc (*ppSV) ;
867 0 nNdx = SvIVX (*ppSV) ;
868 /*
869 if (nNdx < 6 || nNdx == 92)
870 lprintf (a, "old string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(*ppSV)) ;
871 */
872 0 return nNdx ;
873 }
874 }
875  
876  
877 /* new string */
878
879 0 nNdx = ArraySub (a, &pFreeStringsNdx, 1) ;
880 0 ▶ if (nNdx != (tIndex)(-1))
Branch: 1 branch
BranchTrueFalseTotal
if (nNdx != (tIndex)(-1)) 0 0 0
881 0 nNdx = pFreeStringsNdx[nNdx] ;
882 else
883 0 nNdx = ArrayAdd (a, &pStringTableArray, 1) ;
884
885 0 pSVNdx = newSVivDBG1 (nNdx, sText) ;
886 0 ▶ SvTAINTED_off (pSVNdx) ;
Branch: 1 branch
BranchTrueFalseTotal
SvTAINTED_off (pSVNdx) ; 0 0 0
887  
888 0 ▶ if (bInc)
Branch: 1 branch
BranchTrueFalseTotal
if (bInc) 0 0 0
889 0 SvREFCNT_inc (pSVNdx) ;
890 0 ▶ pSVKey = newSVpv (nLen?(char *)sText:"", nLen) ;
Branch: 1 branch
BranchTrueFalseTotal
pSVKey = newSVpv (nLen?(char *)sText:"", nLen) ; 0 0 0
891 0 pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
892 0 SvREFCNT_dec (pSVKey) ;
893  
894 0 pStringTableArray[nNdx] = pHEKey ;
895  
896 0 numStr++ ;
897  
898
899 /*
900 if (nNdx < 6 || nNdx == 124)
901 lprintf (a, "new string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
902 */
903  
904 0 return nNdx ;
905 }
906  
907 /* ------------------------------------------------------------------------ */
908 /* */
909 /* String2UniqueNdx */
910 /* */
911 /* Convert String to an unique index */
912 /* A string lookup will always return the index of the first string */
913 /* */
914 /* */
915 /* ------------------------------------------------------------------------ */
916  
917  
918 0 tStringIndex String2UniqueNdx (/*in*/ tApp * a,
919 /*in*/ const char * sText,
920 /*in*/ int nLen)
921
922  
923 {
924 epaTHX_
925 SV * pSVKey ;
926 SV * pSVNdx ;
927 HE * pHEKey ;
928 int nNdx ;
929  
930 0 ▶ if (sText == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (sText == NULL) 0 0 0
931 0 return 0 ;
932  
933 /* new string */
934
935 0 nNdx = ArraySub (a, &pFreeStringsNdx, 1) ;
936 0 ▶ if (nNdx != (tIndex)(-1))
Branch: 1 branch
BranchTrueFalseTotal
if (nNdx != (tIndex)(-1)) 0 0 0
937 0 nNdx = pFreeStringsNdx[nNdx] ;
938 else
939 0 nNdx = ArrayAdd (a, &pStringTableArray, 1) ;
940
941  
942 0 ▶ pSVKey = newSVpv (nLen?(char *)sText:"", nLen) ;
Branch: 1 branch
BranchTrueFalseTotal
pSVKey = newSVpv (nLen?(char *)sText:"", nLen) ; 0 0 0
943 0 pHEKey = hv_fetch_ent (pStringTableHash, pSVKey, 0, 0) ;
944  
945 0 ▶ if (!pHEKey)
Branch: 1 branch
BranchTrueFalseTotal
if (!pHEKey) 0 0 0
946 {
947 0 pSVNdx = newSVivDBG1 (nNdx, sText) ;
948 0 ▶ SvTAINTED_off (pSVNdx) ;
Branch: 1 branch
BranchTrueFalseTotal
SvTAINTED_off (pSVNdx) ; 0 0 0
949 0 SvREFCNT_inc (pSVNdx) ;
950 0 pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
951 }
952  
953 0 pStringTableArray[nNdx] = pHEKey ;
954  
955 0 numStr++ ;
956  
957 0 return nNdx ;
958 }
959  
960 /* ------------------------------------------------------------------------ */
961 /* */
962 /* NdxStringFree */
963 /* */
964 /* Free one reference to a string */
965 /* */
966 /* ------------------------------------------------------------------------ */
967  
968  
969 0 void NdxStringFree (/*in*/ tApp * a,
970 /*in*/ tStringIndex nNdx)
971  
972 {
973 epaTHX_
974 0 HE * pHE = pStringTableArray[nNdx] ;
975 0 ▶ if (pHE)
Branch: 1 branch
BranchTrueFalseTotal
if (pHE) 0 0 0
976 {
977 0 SV * pSVNdx = HeVAL (pHE) ;
978
979 0 SvREFCNT_dec (pSVNdx) ;
980  
981 /*
982 if (nNdx < 6 || nNdx == 92)
983 lprintf (a, "free string %s (#%d) refcnt=%d\n", Ndx2String (nNdx), nNdx, SvREFCNT(pSVNdx)) ;
984 */
985  
986
987 0 ▶ if (SvREFCNT(pSVNdx) == 1)
Branch: 1 branch
BranchTrueFalseTotal
if (SvREFCNT(pSVNdx) == 1) 0 0 0
988 {
989 int n ;
990
991 /* lprintf (a, "delete string %s (#%d)\n", Ndx2String (nNdx), nNdx) ; */
992 0 hv_delete (pStringTableHash, HeKEY (pHE), HeKLEN(pHE), 0) ;
993 0 pStringTableArray[nNdx] = NULL ;
994 0 n = ArrayAdd (a, &pFreeStringsNdx, 1) ;
995 0 pFreeStringsNdx[n] = nNdx ;
996  
997 0 numStr-- ;
998 }
999 }
1000 0 }
1001  
1002  
1003 #ifdef EPDEBUG
1004  
1005 /* ------------------------------------------------------------------------ */
1006 /* */
1007 /* DEBUG support */
1008 /* */
1009 /* */
1010 /* */
1011 /* ------------------------------------------------------------------------ */
1012  
1013  
1014 #define ASSERT_DOMTREE_VALID(a,n) embperl_Assert_DomTree_Valid(a,n,"",__FILE__,__LINE__)
1015 #define ASSERT_NODE_VALID(a,n) embperl_Assert_Node_Valid(a,n,"",__FILE__,__LINE__)
1016 #define ASSERT_ATTR_VALID(a,n) embperl_Assert_Attr_Valid(a,n,NULL,"",__FILE__,__LINE__)
1017  
1018 void embperl_Assert_Node_Valid (/*in*/tApp * a, tNodeData *pNode, char * prefix, char * fn, int line) ;
1019  
1020  
1021 void embperl_Assert_DomTree_Valid (/*in*/tApp * a, tDomTree *pDomTree, char * prefix, char * fn, int line)
1022  
1023 {
1024 tDomTree * pLookupDomTree ;
1025 char buf[2048] ;
1026
1027 if (!pDomTree)
1028 return ;
1029  
1030 if (pDomTree -> xNdx == 0)
1031 {
1032 sprintf(buf, "%s DomTree is deleted: %s(%d)\n", prefix, fn, line) ;
1033 mydie (NULL, buf) ;
1034 }
1035  
1036
1037 pLookupDomTree = DomTree_self(pDomTree -> xNdx) ;
1038 if (pDomTree != pLookupDomTree)
1039 {
1040 sprintf(buf, "%sAddress of DomTree %d does not match Lookup Table: %s(%d)\n", prefix, pDomTree -> xNdx, fn, line) ;
1041 mydie (NULL, buf) ;
1042 }
1043 }
1044  
1045 void embperl_Assert_Attr_Valid (/*in*/tApp * a, tAttrData *pAttr, tNodeData *pNode, char * prefix, char * fn, int line)
1046  
1047 {
1048 tAttrData * pLookupAttr ;
1049 tNodeData *pLookupNode ;
1050 tDomTree *pLookupDomTree ;
1051 char buf[2048] ;
1052 tIndex xFirstAttr ;
1053
1054 if (!pAttr)
1055 return ;
1056  
1057 pLookupNode = Attr_selfNode (pAttr) ;
1058 pLookupDomTree = DomTree_self(pLookupNode -> xDomTree) ;
1059 pLookupAttr = Attr_self (pLookupDomTree, pAttr -> xNdx) ;
1060 if (pAttr != pLookupAttr)
1061 {
1062 sprintf(buf, "%sAddress of Attr %ld does not match Lookup Table: %s(%d)\n", prefix, pAttr -> xNdx, fn, line) ;
1063 mydie (NULL, buf) ;
1064 }
1065  
1066 if (pNode)
1067 {
1068 if (pNode != pLookupNode)
1069 {
1070 sprintf(buf, "%sAddress of Node of Attr (Node %ld DomTree %d) does not match Node: %s(%d)\n", prefix, pNode -> xNdx, pNode -> xDomTree, fn, line) ;
1071 mydie (NULL, buf) ;
1072 }
1073  
1074 }
1075 else
1076 {
1077 sprintf(buf, "%sAttr %ld: ", prefix, pAttr -> xNdx) ;
1078 embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ;
1079 }
1080  
1081 if (pAttr -> bFlags & aflgAttrChilds)
1082 {
1083 sprintf(buf, "%sAttr %ld aflgAttrChilds: ", prefix, pAttr -> xNdx) ;
1084  
1085 pLookupNode = Node_selfLevel (a, pLookupDomTree, pAttr -> xValue, pLookupNode -> nRepeatLevel) ;
1086
1087 xFirstAttr = pLookupNode -> xNdx ;
1088
1089 while (pLookupNode)
1090 {
1091 embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ;
1092  
1093 pLookupNode = Node_selfNextSibling (a, pLookupDomTree, pLookupNode, pLookupNode -> nRepeatLevel) ;
1094 if (pLookupNode)
1095 {
1096 if (pLookupNode -> xNdx == xFirstAttr )
1097 {
1098 sprintf(buf, "%sAttr %ld aflgAttrChilds FirstNode found second time %ld", prefix, pAttr -> xNdx, pLookupNode -> xNdx) ;
1099 mydie (a, buf) ;
1100 }
1101 }
1102 }
1103 }
1104 }
1105  
1106  
1107 void embperl_Assert_Node_Valid (/*in*/tApp * a, tNodeData *pNode, char * prefix, char * fn, int line)
1108  
1109 {
1110 tDomTree * pDomTree ;
1111 tNodeData *pLookupNode ;
1112 tNodeData *pFirstChild ;
1113 tAttrData *pAttr ;
1114 int n ;
1115 char buf[2048] ;
1116
1117 if (!pNode)
1118 return ;
1119
1120
1121 n = ArrayGetSize (a, pDomTrees) ;
1122 if (pNode -> xDomTree >= n || pNode -> xDomTree < 0)
1123 {
1124 sprintf(buf, "%s DomTree %d out of range (max=%d): %s(%d)\n", prefix, pNode -> xDomTree, n, fn, line) ;
1125 mydie (NULL, buf) ;
1126 }
1127  
1128  
1129 pDomTree = DomTree_self (pNode -> xDomTree) ;
1130 sprintf(buf, "%sDomTree of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ;
1131 embperl_Assert_DomTree_Valid(a,pDomTree, buf, fn, line) ;
1132  
1133 pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xNdx, pNode -> nRepeatLevel) ;
1134 if (pNode != pLookupNode)
1135 {
1136 sprintf(buf, "%sAddress of Node %ld DomTree %d does not match Lookup Table: %s(%d)\n", prefix, pNode -> xNdx, pNode -> xDomTree, fn, line) ;
1137 mydie (NULL, buf) ;
1138 }
1139  
1140
1141 if (pNode -> xChilds && pNode -> nType != ntypDocumentFraq && pNode -> nType != ntypDocument)
1142 {
1143 tIndex xNull = xNode_selfLevelNull(pDomTree, pNode) ;
1144 pLookupNode = Node_self(pDomTree, xNull) ;
1145 pFirstChild = Node_selfLevel(a, pDomTree, pNode -> xChilds, pNode -> nRepeatLevel) ;
1146 if (pFirstChild -> xParent != pNode -> xNdx && pFirstChild -> xParent != xNull)
1147 {
1148 sprintf(buf, "%sParent (xParent=%ld) of first Child (Node %ld DomTree %d) does not point to myself (Node %ld DomTree %d NullNode=%ld): %s(%d)\n",
1149 prefix, pFirstChild -> xParent, pFirstChild -> xNdx, pFirstChild -> xDomTree, pNode -> xNdx, pNode -> xDomTree,
1150 xNull, fn, line) ;
1151 mydie (NULL, buf) ;
1152 }
1153  
1154 if (pNode -> nRepeatLevel > 0 && pFirstChild -> xParent != pNode -> xNdx)
1155 {
1156 tNodeData * pParent = Node_selfLevel(a, pDomTree, pFirstChild -> xParent, pNode -> nRepeatLevel) ;
1157 if (pNode != pParent )
1158 {
1159 sprintf(buf, "%sLevel %d Level Parent of first Child (Node %ld DomTree %d) does not point to myself (Node %ld) but to Node %ld: %s(%d)\n",
1160 prefix, pNode -> nRepeatLevel, pFirstChild -> xNdx,
1161 pFirstChild -> xDomTree, pNode -> xNdx, pParent -> xNdx, fn, line) ;
1162 mydie (NULL, buf) ;
1163 }
1164
1165  
1166 }
1167 }
1168  
1169 if (!*prefix && pNode -> xParent)
1170 {
1171 sprintf(buf, "%sParent of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ;
1172 pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xParent, pNode -> nRepeatLevel) ;
1173
1174 if (pLookupNode -> nType == ntypAttr)
1175 embperl_Assert_Attr_Valid(a, (tAttrData *)pLookupNode, NULL, buf, fn, line) ;
1176 else
1177 embperl_Assert_Node_Valid(a, pLookupNode, buf, fn, line) ;
1178 }
1179  
1180 if (!*prefix && pNode -> xNext)
1181 {
1182 sprintf(buf, "%sNext of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ;
1183 pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xNext, pNode -> nRepeatLevel) ;
1184 embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ;
1185 }
1186
1187 if (!*prefix && pNode -> xPrev)
1188 {
1189 sprintf(buf, "%sPrev of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ;
1190 pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xPrev, pNode -> nRepeatLevel) ;
1191 embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ;
1192 }
1193
1194 pAttr = (tAttrData * )(pNode + 1) ;
1195 n = pNode -> numAttr ;
1196  
1197 sprintf(buf, "%sAttr of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ;
1198 while (n)
1199 {
1200 embperl_Assert_Attr_Valid(a,pAttr, pNode, buf, fn, line) ;
1201 n-- ;
1202 pAttr++ ;
1203 }
1204
1205 }
1206  
1207  
1208  
1209  
1210 #else
1211 #define ASSERT_DOMTREE_VALID(a,n)
1212 #define ASSERT_NODE_VALID(a,n)
1213 #define ASSERT_ATTR_VALID(a,n)
1214 #endif
1215  
1216 /* ------------------------------------------------------------------------ */
1217 /* */
1218 /* DomInit */
1219 /* */
1220 /* */
1221 /* */
1222 /* ------------------------------------------------------------------------ */
1223  
1224  
1225 0 int DomInit (/*in*/ tApp * a)
1226  
1227 {
1228 epaTHX_
1229 SV * pSVKey ;
1230 SV * pSVNdx ;
1231 HE * pHEKey ;
1232
1233  
1234 tNodeData testnode ;
1235 tAttrData testattr ;
1236  
1237 if (((char *)(&testnode.nType) - (char *)&testnode) !=
1238 ((char *)(&testattr.nType) - (char *)&testattr))
1239 {
1240 mydie (a, "Attr.nType and Node.nType are not at the same offset. There is a problem with the typedefinitions in epdom.h") ;
1241 }
1242
1243 if (((char *)(&testnode.xNdx) - (char *)&testnode) !=
1244 ((char *)(&testattr.xNdx) - (char *)&testattr))
1245 {
1246 mydie (a, "Attr.xNdx and Node.xNdx are not at the same offset. There is a problem with the typedefinitions in epdom.h") ;
1247 }
1248
1249 if (((char *)(&testnode.xChilds) - (char *)&testnode) !=
1250 ((char *)(&testattr.xValue) - (char *)&testattr))
1251 {
1252 mydie (a, "Attr.xValue and Node.xChilds are not at the same offset. There is a problem with the typedefinitions in epdom.h") ;
1253 }
1254
1255 if (sizeof(testnode.xChilds) != sizeof (testattr.xValue))
1256 {
1257 mydie (a, "Attr.xValue and Node.xChilds do not have the same size. There is a problem with the typedefinitions in epdom.h") ;
1258 }
1259
1260 0 pStringTableHash = newHV () ;
1261  
1262 0 ArrayNew (a, &pStringTableArray, 256, sizeof (HE *)) ;
1263 0 ArrayNew (a, &pFreeStringsNdx, 256, sizeof (tStringIndex *)) ;
1264  
1265 0 ArrayAdd (a, &pStringTableArray, 2) ;
1266 /* NULL */
1267 0 pSVNdx = newSViv (0) ;
1268 0 SvREFCNT_inc (pSVNdx) ;
1269 0 pSVKey = newSVpv ("", 0) ;
1270 0 pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
1271 0 pStringTableArray[0] = pHEKey ;
1272  
1273 /* "" */
1274 0 pSVNdx = newSViv (1) ;
1275 0 SvREFCNT_inc (pSVNdx) ;
1276 0 pSVKey = newSVpv ("", 0) ;
1277 0 pHEKey = hv_store_ent (pStringTableHash, pSVKey, pSVNdx, 0) ;
1278 0 pStringTableArray[1] = pHEKey ;
1279  
1280 0 numStr+=2 ;
1281  
1282 0 xNoName = String2Ndx (a, "<noname>", 8) ;
1283 0 xDomTreeAttr = String2Ndx (a, "<domtree>", 9) ;
1284 0 xDocument = String2Ndx (a, "Document", 8) ;
1285 0 xDocumentFraq = String2Ndx (a, "DocumentFraq", 12) ;
1286 0 xOrderIndexAttr = String2Ndx (a, "<orderindex>", 10) ;
1287  
1288 0 ArrayNew (a, &pDomTrees, 64, sizeof (tDomTree)) ;
1289 0 ArrayAdd (a, &pDomTrees, 1) ;
1290 0 memset (&pDomTrees[0], 0, sizeof (tDomTree)) ;
1291 0 ArrayNew (a, &pFreeDomTrees, 64, sizeof (tIndex)) ;
1292  
1293 0 return ok ;
1294 }
1295  
1296  
1297 /* ------------------------------------------------------------------------ */
1298 /* */
1299 /* DomStats */
1300 /* */
1301 /* print statistics */
1302 /* */
1303 /* ------------------------------------------------------------------------ */
1304  
1305  
1306 0 void DomStats (/*in*/ tApp * a)
1307  
1308 {
1309 0 lprintf (a, "[%d]PERF: DOMSTAT: MemUsage = %d Bytes numNodes = %d numLevelLookup = %d numLevelLookupItem = %d numStr = %d numReplace = %d \n", a -> pThread -> nPid, nMemUsage, numNodes, numLevelLookup, numLevelLookupItem, numStr, numReplace) ;
1310 #ifdef DMALLOC
1311 dmalloc_message ("[%d]PERF: DOMSTAT: MemUsage = %d Bytes numNodes = %d numLevelLookup = %d numLevelLookupItem = %d numStr = %d numReplace = %d \n", a -> pThread -> nPid, nMemUsage, numNodes, numLevelLookup, numLevelLookupItem, numStr, numReplace) ;
1312 #endif
1313 0 }
1314  
1315 /* ------------------------------------------------------------------------ */
1316 /* */
1317 /* DomTree_alloc */
1318 /* */
1319 /* Alloc storage for a new DomTree and associate it with a SV. deleteing */
1320 /* the SV will delete the DomTree also */
1321 /* */
1322 /* ------------------------------------------------------------------------ */
1323  
1324 MGVTBL DomTree_mvtTab = { NULL, NULL, NULL, NULL, DomTree_free } ;
1325  
1326  
1327 0 tDomTree * DomTree_alloc (tApp * a)
1328  
1329 {
1330 tDomTree * pDomTree ;
1331 tIndexShort n ;
1332 SV * pSV ;
1333 struct magic * pMagic ;
1334 epaTHX_
1335  
1336 0 n = ArraySub (a, &pFreeDomTrees, 1) ;
1337 0 ▶ if (n != (tIndex)(-1))
Branch: 1 branch
BranchTrueFalseTotal
if (n != (tIndex)(-1)) 0 0 0
1338 0 n = pFreeDomTrees[n] ;
1339 else
1340 0 n = ArrayAdd (a, &pDomTrees, 1) ;
1341 0 pDomTree = DomTree_self (n) ;
1342  
1343 0 memset (pDomTree, 0, sizeof (*pDomTree)) ;
1344
1345 0 pSV = newSViv (n) ;
1346 0 sv_magic (pSV, pSV, 0, NULL, n) ;
1347 0 pMagic = mg_find (pSV, 0) ;
1348  
1349 0 ▶ if (pMagic)
Branch: 1 branch
BranchTrueFalseTotal
if (pMagic) 0 0 0
1350 0 pMagic -> mg_virtual = &DomTree_mvtTab ;
1351 else
1352 {
1353 0 LogErrorParam (a, rcMagicError, "", "") ;
1354 }
1355  
1356 0 pDomTree -> pDomTreeSV = pSV ;
1357 0 pDomTree -> xNdx = n ;
1358 0 pDomTree -> xSourceNdx = n ;
1359  
1360  
1361 0 return pDomTree ;
1362 }
1363  
1364  
1365 /* ------------------------------------------------------------------------ */
1366 /* */
1367 /* DomTree_new */
1368 /* */
1369 /* */
1370 /* */
1371 /* ------------------------------------------------------------------------ */
1372  
1373 0 int DomTree_new (/*in*/ tApp * a,
1374 tDomTree * * pNewLookup)
1375  
1376 {
1377 epaTHX_
1378 tDomTree * pDomTree ;
1379 0 pDomTree = DomTree_alloc (a) ;
1380  
1381 0 ArrayNew (a, &pDomTree -> pLookup, 256, sizeof (tLookupItem)) ;
1382 0 ArrayAdd (a, &pDomTree -> pLookup, 1) ;
1383  
1384 0 pDomTree -> pCheckpoints = NULL ;
1385 0 pDomTree -> pDependsOn = newAV () ;
1386  
1387 0 *pNewLookup = pDomTree ;
1388  
1389 0 return pDomTree -> xNdx ;
1390 }
1391  
1392 /* ------------------------------------------------------------------------ */
1393 /* */
1394 /* DomTree_dodelete */
1395 /* */
1396 /* Frees all memory allocated by this DomTree */
1397 /* */
1398 /* ------------------------------------------------------------------------ */
1399  
1400 0 static int DomTree_dodelete (/*in*/ tApp * a, tDomTree * pDomTree)
1401  
1402 {
1403 epaTHX_
1404 0 tLookupItem * pLookup = pDomTree -> pLookup ;
1405 int numLookup ;
1406 0 tIndexShort xDomTree = pDomTree -> xNdx ;
1407 tIndex xNdx ;
1408 0 tIndex xNode = -1 ;
1409 tRepeatLevelLookup * pLookupLevelNode ;
1410 tRepeatLevelLookupItem * pLookupLevelNodeLevel ;
1411 tRepeatLevelLookupItem * pItem ;
1412 tRepeatLevelLookupItem * pNext ;
1413 int n ;
1414  
1415  
1416 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
1417 0 lprintf (a, "[%d]Delete: DomTree = %d SVs=%d\n", a -> pThread -> nPid, pDomTree -> xNdx, sv_count) ;
1418  
1419 0 ▶ if (!xDomTree)
Branch: 1 branch
BranchTrueFalseTotal
if (!xDomTree) 0 0 0
1420 {
1421 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
1422 0 lprintf (a, "[%d]Delete: Already deleted DomTree = %d SVs=%d\n", a -> pThread -> nPid, pDomTree -> xNdx, sv_count) ;
1423 0 return ok ;
1424 }
1425
1426 0 numLookup = ArrayGetSize (a, pLookup) ;
1427 0 pLookup += numLookup - 1 ;
1428 0 ▶ while (numLookup-- > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (numLookup-- > 0) 0 0 0
1429 {
1430 0 tNodeData * pNode = pLookup -> pLookup ;
1431
1432 0 ▶ if (pNode && pNode -> nType != (tNodeType)ntypAttr && xDomTree == pNode -> xDomTree)
Branch: 3 branches
BranchTrueFalseTotal
if (pNode && pNode -> nType != (tNodeType)ntypAttr && xDomTree == pNode -> xDomTree) 0 0 0
if (pNode && pNode -> nType != (tNodeType)ntypAttr && xDomTree == pNode -> xDomTree) 0 0 0
if (pNode && pNode -> nType != (tNodeType)ntypAttr && xDomTree == pNode -> xDomTree) 0 0 0
1433 0 {
1434 /* lprintf (a, "delete typ=%d Pad xNdx=%d\n", pPad -> nType, pPad -> xNdx) ; */
1435  
1436 0 int n = pNode -> numAttr ;
1437 0 tAttrData * pAttr = Node_selfFirstAttr(pNode) ;
1438  
1439 0 ▶ while (n--)
Branch: 1 branch
BranchTrueFalseTotal
while (n--) 0 0 0
1440 {
1441 /* pDomTree -> pLookup[pAttr -> xNdx] = NULL ; */
1442 0 ▶ if (pAttr -> bFlags)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> bFlags) 0 0 0
1443 {
1444 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
1445 0 NdxStringFree (a, pAttr -> xName) ;
1446 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
1447 0 NdxStringFree (a, pAttr -> xValue) ;
1448 }
1449 0 pAttr++ ;
1450 }
1451 /* lprintf (a, "delete typ=%d Node xNdx=%d\n", pNode -> nType, pNode -> xNdx) ; */
1452 /* pDomTree -> pLookup[pNode -> xNdx] = NULL ; */
1453 0 ▶ if (pNode -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> nText) 0 0 0
1454 0 NdxStringFree (a, pNode -> nText) ;
1455
1456 0 xNode = pNode -> xNdx ;
1457 0 dom_free (a, pNode, &numNodes) ;
1458 }
1459 else
1460 {
1461 0 xNode = -1 ;
1462 0 pNode = NULL ;
1463 }
1464  
1465 0 ▶ if ((pLookupLevelNode = pLookup -> pLookupLevel) && (pLookupLevelNode -> xNullNode == xNode || pNode == NULL))
Branch: 3 branches
BranchTrueFalseTotal
if ((pLookupLevelNode = pLookup -> pLookupLevel) && (pLookupLevelNode -> xNullNode == xNode || pNode == NULL)) 0 0 0
if ((pLookupLevelNode = pLookup -> pLookupLevel) && (pLookupLevelNode -> xNullNode == xNode || pNode == NULL)) 0 0 0
if ((pLookupLevelNode = pLookup -> pLookupLevel) && (pLookupLevelNode -> xNullNode == xNode || pNode == NULL)) 0 0 0
1466 {
1467 0 pLookupLevelNodeLevel = pLookupLevelNode -> items ;
1468 0 n = pLookupLevelNode -> numItems ;
1469 0 ▶ while (n-- > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (n-- > 0) 0 0 0
1470 {
1471 0 pNext = pLookupLevelNodeLevel -> pNext ;
1472 0 ▶ while (pNext)
Branch: 1 branch
BranchTrueFalseTotal
while (pNext) 0 0 0
1473 {
1474 0 pItem = pNext ;
1475 0 pNext = pItem -> pNext ;
1476 0 dom_free_size (a, pItem, sizeof (tRepeatLevelLookupItem), &numLevelLookupItem) ;
1477 }
1478 0 pLookupLevelNodeLevel++ ;
1479 }
1480  
1481 0 dom_free_size (a, pLookupLevelNode, sizeof (tRepeatLevelLookup) + sizeof (tRepeatLevelLookupItem) * (pLookupLevelNode -> numItems - 1), &numLevelLookup) ;
1482 }
1483  
1484  
1485 0 pLookup-- ;
1486 }
1487  
1488  
1489 0 ArrayFree (a, &pDomTree -> pLookup) ;
1490 0 ArrayFree (a, &pDomTree -> pCheckpoints) ;
1491
1492 0 ▶ if (pDomTree -> pSV)
Branch: 1 branch
BranchTrueFalseTotal
if (pDomTree -> pSV) 0 0 0
1493 0 SvREFCNT_dec (pDomTree -> pSV) ;
1494  
1495 0 ▶ if (pDomTree -> pDependsOn)
Branch: 1 branch
BranchTrueFalseTotal
if (pDomTree -> pDependsOn) 0 0 0
1496 {
1497 /*
1498 int i ;
1499  
1500 for (i = 0 ; i <= AvFILL (pDomTree -> pDependsOn); i++)
1501 {
1502 SV * pSV = *av_fetch (pDomTree -> pDependsOn, i, 0) ;
1503 lprintf (a, "pDependsOn DomTree #%d type = %d cnt=%d n=%d\n", i, SvTYPE(pSV), SvREFCNT(pSV), SvIVX(pSV)) ;
1504 }
1505 */
1506  
1507 0 av_clear (pDomTree -> pDependsOn) ;
1508
1509 0 SvREFCNT_dec (pDomTree -> pDependsOn) ;
1510 }
1511
1512 0 xNdx = ArrayAdd (a, &pFreeDomTrees, 1) ;
1513 0 pDomTree -> xNdx = 0 ;
1514 0 pFreeDomTrees[xNdx] = xDomTree ;
1515  
1516 #if defined (_MDEBUG) && defined (WIN32)
1517 _ASSERTE( _CrtCheckMemory( ) );
1518 #endif
1519  
1520 0 return ok ;
1521 }
1522  
1523 /* ------------------------------------------------------------------------ */
1524 /* */
1525 /* DomTree_free */
1526 /* */
1527 /* Frees all memory allocated by this DomTree */
1528 /* Do not call directly. Is called by Perl when RefCnt goes to zero */
1529 /* */
1530 /* */
1531 /* ------------------------------------------------------------------------ */
1532  
1533  
1534 0 static int DomTree_free (pTHX_ SV * pSV, MAGIC * mg)
1535  
1536 {
1537 0 ▶ if (mg && mg -> mg_len && !PL_in_clean_all)
Branch: 3 branches
BranchTrueFalseTotal
if (mg && mg -> mg_len && !PL_in_clean_all) 0 0 0
if (mg && mg -> mg_len && !PL_in_clean_all) 0 0 0
if (mg && mg -> mg_len && !PL_in_clean_all) 0 0 0
1538 0 return DomTree_dodelete (CurrApp, DomTree_self (mg -> mg_len)) ;
1539 else
1540 0 return ok ;
1541 }
1542  
1543 /* ------------------------------------------------------------------------ */
1544 /* */
1545 /* DomTree_delete */
1546 /* */
1547 /* Frees all memory allocated by this DomTree */
1548 /* */
1549 /* ------------------------------------------------------------------------ */
1550  
1551 0 int DomTree_delete (/*in*/ tApp * a, tDomTree * pDomTree)
1552  
1553 {
1554 epaTHX_
1555 0 SvREFCNT_dec (pDomTree -> pDomTreeSV) ;
1556 0 return ok ;
1557 }
1558  
1559
1560 /* ------------------------------------------------------------------------ */
1561 /* */
1562 /* DomTree_clone */
1563 /* */
1564 /* */
1565 /* */
1566 /* ------------------------------------------------------------------------ */
1567  
1568 0 int DomTree_clone (/*in*/ tApp * a,
1569 /*in*/ tDomTree * pOrgDomTree,
1570 /*out*/tDomTree * * pNewDomTree,
1571 /*in*/ int bForceDocFraq)
1572  
1573 {
1574 epaTHX_
1575 tDomTree * pDomTree ;
1576 tNodeData * pDocument ;
1577 0 tIndex xOrgDomTree = pOrgDomTree -> xNdx ;
1578
1579
1580 0 pDomTree = DomTree_alloc (a) ;
1581 0 pDomTree -> pDependsOn = newAV () ;
1582 0 pOrgDomTree = DomTree_self (xOrgDomTree) ; /* relookup in case it has moved */
1583
1584 0 pDomTree -> xDocument = pOrgDomTree -> xDocument ;
1585 0 pDomTree -> xSourceNdx= pOrgDomTree -> xNdx ;
1586 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
1587 0 lprintf (a, "[%d]DOM: DomTree %d depends on DomTree %d\n", a -> pThread -> nPid, pDomTree -> xNdx, pOrgDomTree -> xNdx) ;
1588 0 av_push (pDomTree -> pDependsOn, SvREFCNT_inc (pOrgDomTree -> pDomTreeSV)) ;
1589 0 pDomTree -> xFilename = pOrgDomTree -> xFilename ;
1590  
1591 0 ArrayClone (a, &pOrgDomTree -> pLookup, &pDomTree -> pLookup) ;
1592 0 ArrayClone (a, &pOrgDomTree -> pCheckpoints, &pDomTree -> pCheckpoints) ;
1593  
1594 0 ▶ if ((pDomTree -> pSV = pOrgDomTree -> pSV))
Branch: 1 branch
BranchTrueFalseTotal
if ((pDomTree -> pSV = pOrgDomTree -> pSV)) 0 0 0
1595 0 SvREFCNT_inc (pDomTree -> pSV) ;
1596  
1597 0 pDocument = Node_self (pDomTree, pDomTree -> xDocument) ;
1598
1599 0 ▶ if (bForceDocFraq || pDocument -> nType == ntypDocumentFraq)
Branch: 2 branches
BranchTrueFalseTotal
if (bForceDocFraq || pDocument -> nType == ntypDocumentFraq) 0 0 0
if (bForceDocFraq || pDocument -> nType == ntypDocumentFraq) 0 0 0
1600 {
1601 tAttrData * pAttr;
1602 0 pDocument = Node_selfCloneNode (a, pDomTree, pDocument, 0, 1) ;
1603 0 pAttr = Element_selfSetAttribut (a, pDomTree, pDocument, 0, NULL, xDomTreeAttr, (char *)&pDomTree -> xNdx, sizeof (pDomTree -> xNdx)) ;
1604 0 pAttr -> bFlags = aflgOK ; /* reset string value flag */
1605 0 pDomTree -> xDocument = pDocument -> xNdx ;
1606 0 pDocument -> nType = ntypDocumentFraq ;
1607 0 ▶ if (pDocument -> nText != xDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pDocument -> nText != xDocumentFraq) 0 0 0
1608 {
1609 0 NdxStringFree (a, pDocument -> nText) ;
1610 0 pDocument -> nText = xDocumentFraq ;
1611 0 NdxStringRefcntInc (a, xDocumentFraq) ;
1612 }
1613 }
1614
1615  
1616 0 *pNewDomTree = pDomTree ;
1617  
1618 0 return pDomTree -> xNdx ;
1619 }
1620  
1621 /*---------------------------------------------------------------------------
1622 * DomTree_checkpoint
1623 */
1624 /*!
1625 *
1626 * \_en
1627 * Compare checkpoint from program execution with list build during
1628 * compilation and change the DomTree and repeat level according to the
1629 * program flow
1630 *
1631 * @param r Embperl request data
1632 * @param xDomTree current DomTree we are working on
1633 * @param nRunCheckpoint Number of checkpoint that was just executed
1634 * \endif
1635 *
1636 * \_de
1637 * Vergeleicht den Checkpoint von der Programmausf?hrung mit dem Checkpoint
1638 * beim Compilieren und ?ndert den DomTree entsprechend dem Programmflu? ab
1639 *
1640 * @param r Embperl Requestdaten
1641 * @param xDomTree akuteller DomTree der bearbeitet wird
1642 * @param nRunCheckpoint Nummer des Checkpoints der gerade abgearbeitet
1643 * wurde
1644 * \endif
1645 *
1646 * ------------------------------------------------------------------------ */
1647  
1648 0 void DomTree_checkpoint (tReq * r, tIndex nRunCheckpoint)
1649  
1650  
1651 {
1652 epTHX_
1653 0 tApp * a = r -> pApp ;
1654 0 tIndex nCompileCheckpoint = r -> Component.nCurrCheckpoint ;
1655 0 tDomTree * pDomTree = DomTree_self (r -> Component.xCurrDomTree) ;
1656 0 tDomTreeCheckpoint * pCheckpoints = pDomTree -> pCheckpoints ;
1657 0 tDomTreeCheckpointStatus * pCheckpointStatus = &pDomTree -> pCheckpointStatus[nRunCheckpoint] ;
1658  
1659 0 ▶ if (r -> Component.nPhase != phRun)
Branch: 1 branch
BranchTrueFalseTotal
if (r -> Component.nPhase != phRun) 0 0 0
1660 0 return ;
1661
1662 0 ▶ if (!pDomTree -> xDocument)
Branch: 1 branch
BranchTrueFalseTotal
if (!pDomTree -> xDocument) 0 0 0
1663 {
1664 /* first checkpoint in sub -> set xDocument */
1665 tNodeData * pDocument ;
1666 tAttrData * pAttr ;
1667  
1668 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1669 0 lprintf (a, "[%d]Checkpoint: Start Sub DomTree=%d xx -> %d SVs=%d\n", a -> pThread -> nPid, r -> Component.xCurrDomTree, nRunCheckpoint, sv_count) ;
1670
1671 0 pDomTree -> xDocument = pCheckpoints[nRunCheckpoint].xNode ;
1672
1673 0 pDocument = Node_self (pDomTree, pDomTree -> xDocument) ;
1674 0 pAttr = Element_selfSetAttribut (a, pDomTree, pDocument, 0, NULL, xDomTreeAttr, (char *)&pDomTree -> xNdx, sizeof (pDomTree -> xNdx)) ;
1675 0 pAttr -> bFlags = aflgOK ; /* reset string value flag */
1676 0 pDocument = Node_self (pDomTree, pDomTree -> xDocument) ;
1677 0 pDocument -> nType = ntypDocumentFraq ;
1678 0 ▶ if (pDocument -> nText != xDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pDocument -> nText != xDocumentFraq) 0 0 0
1679 {
1680 0 NdxStringFree (a, pDocument -> nText) ;
1681 0 pDocument -> nText = xDocumentFraq ;
1682 0 NdxStringRefcntInc (a, xDocumentFraq) ;
1683 }
1684
1685 0 r -> Component.nCurrCheckpoint = nRunCheckpoint+1 ;
1686 0 r -> Component.nCurrRepeatLevel = 0 ;
1687 0 return ;
1688 }
1689  
1690 0 r -> Component.bSubNotEmpty = 1 ;
1691  
1692 0 pCheckpointStatus -> nRepeatLevel = r -> Component.nCurrRepeatLevel ;
1693 0 pCheckpointStatus -> nCompileCheckpoint = nCompileCheckpoint ;
1694 0 pCheckpointStatus -> xJumpFromNode = 0 ;
1695  
1696 0 ▶ if (nRunCheckpoint == nCompileCheckpoint)
Branch: 1 branch
BranchTrueFalseTotal
if (nRunCheckpoint == nCompileCheckpoint) 0 0 0
1697 {
1698 0 ▶ if (pCheckpoints[nCompileCheckpoint].xNode != -1)
Branch: 1 branch
BranchTrueFalseTotal
if (pCheckpoints[nCompileCheckpoint].xNode != -1) 0 0 0
1699 {
1700 0 ▶ tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1701 0 tNodeData * pPrevNode = Node_selfPreviousSibling (a, pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
1702  
1703 0 ▶ if (pPrevNode && pPrevNode -> xNext != pCompileNode -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pPrevNode && pPrevNode -> xNext != pCompileNode -> xNdx) 0 0 0
if (pPrevNode && pPrevNode -> xNext != pCompileNode -> xNdx) 0 0 0
1704 {
1705 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1706 0 pPrevNode -> xNext = pCompileNode -> xNdx ;
1707 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1708 0 lprintf (a, "[%d]Checkpoint: end of loop DomTree=%d Index=%d Node=%d(%d) RepeatLevel=%d Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1709 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1710 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber, 0 0 0
1711 0 ▶ nRunCheckpoint, pCompileNode -> xNdx, xNode_selfLevelNull(pDomTree,pCompileNode), pCompileNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pCompileNode -> xNdx, xNode_selfLevelNull(pDomTree,pCompileNode), pCompileNode -> nLinenumber, sv_count) ; 0 0 0
1712 }
1713 }
1714  
1715 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1716 0 lprintf (a, "[%d]Checkpoint: ok DomTree=%d %d -> %d SVs=%d\n", a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint, nRunCheckpoint, sv_count) ;
1717 0 r -> Component.nCurrCheckpoint++ ;
1718 0 return ;
1719 }
1720  
1721 0 ▶ if (nRunCheckpoint > nCompileCheckpoint)
Branch: 1 branch
BranchTrueFalseTotal
if (nRunCheckpoint > nCompileCheckpoint) 0 0 0
1722 {
1723 0 ▶ tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1724 0 ▶ if (pCheckpoints[nRunCheckpoint].xNode == -1)
Branch: 1 branch
BranchTrueFalseTotal
if (pCheckpoints[nRunCheckpoint].xNode == -1) 0 0 0
1725 {
1726 0 pCompileNode = Node_selfCondCloneNode (a, pDomTree, pCompileNode , r -> Component.nCurrRepeatLevel) ;
1727 0 pCompileNode -> bFlags |= nflgStopOutput ;
1728 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1729 0 lprintf (a, "[%d]Checkpoint: stop output DomTree=%d Index=%d Node=%d(%d) Line=%d\n",
1730 0 a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint,
1731 0 pCompileNode -> xNdx, xNode_selfLevelNull(pDomTree,pCompileNode),
1732 0 ▶ pCompileNode -> nLinenumber) ;
Branch: 1 branch
BranchTrueFalseTotal
pCompileNode -> nLinenumber) ; 0 0 0
1733 0 return ;
1734 }
1735 else
1736 {
1737 0 ▶ tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1738 0 tNodeData * pPrevNode = Node_selfPreviousSibling (a, pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
1739
1740 0 ▶ tNodeData * pCompileParent = NodeAttr_selfParentNode (pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pCompileParent = NodeAttr_selfParentNode (pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1741 0 ▶ tNodeData * pRunParent = NodeAttr_selfParentNode (pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pRunParent = NodeAttr_selfParentNode (pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1742  
1743 0 ▶ if (pPrevNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pPrevNode) 0 0 0
1744 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1745 else
1746 {
1747 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
1748 0 pPrevNode -> bFlags |= nflgIgnore ;
1749 }
1750  
1751 0 ▶ if (pCompileParent -> xNdx == pRunParent -> xNdx )
Branch: 1 branch
BranchTrueFalseTotal
if (pCompileParent -> xNdx == pRunParent -> xNdx ) 0 0 0
1752 {
1753 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
1754
1755 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1756 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1757 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1758 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1759  
1760 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1761 0 lprintf (a, "[%d]Checkpoint: jump forward DomTree=%d Index=%d Node=%d(%d) Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1762 0 a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint,
1763 0 pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
1764 0 ▶ pPrevNode -> nLinenumber, nRunCheckpoint,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, nRunCheckpoint, 0 0 0
1765 0 pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
1766 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1767
1768 }
1769 0 ▶ else if (pCompileParent && pRunParent)
Branch: 2 branches
BranchTrueFalseTotal
else if (pCompileParent && pRunParent) 0 0 0
else if (pCompileParent && pRunParent) 0 0 0
1770 0 {
1771 0 ▶ tNodeData * pCompileParent2 = NodeAttr_selfParentNode (pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pCompileParent2 = NodeAttr_selfParentNode (pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ; 0 0 0
1772 0 ▶ tNodeData * pRunParent2 = NodeAttr_selfParentNode (pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pRunParent2 = NodeAttr_selfParentNode (pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ; 0 0 0
1773  
1774 0 ▶ if (pCompileParent2 && pCompileParent2 -> xNdx == pRunParent -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pCompileParent2 && pCompileParent2 -> xNdx == pRunParent -> xNdx) 0 0 0
if (pCompileParent2 && pCompileParent2 -> xNdx == pRunParent -> xNdx) 0 0 0
1775 {
1776 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
1777 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
1778 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1779 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1780 0 pPrevNode -> xChilds = 0 ;
1781 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1782 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1783  
1784 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1785 0 lprintf (a, "[%d]Checkpoint: jump forward last child DomTree=%d Index=%d Node=%d(%d) Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1786 0 a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint,
1787 0 pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
1788 0 ▶ pPrevNode -> nLinenumber, nRunCheckpoint,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, nRunCheckpoint, 0 0 0
1789 0 pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
1790 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1791 }
1792 0 ▶ else if (pCompileParent2 && pRunParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx )
Branch: 3 branches
BranchTrueFalseTotal
else if (pCompileParent2 && pRunParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx ) 0 0 0
else if (pCompileParent2 && pRunParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx ) 0 0 0
else if (pCompileParent2 && pRunParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx ) 0 0 0
1793 {
1794 0 ▶ if (pRunParent -> nType != ntypAttr && pCompileParent -> nType != ntypAttr)
Branch: 2 branches
BranchTrueFalseTotal
if (pRunParent -> nType != ntypAttr && pCompileParent -> nType != ntypAttr) 0 0 0
if (pRunParent -> nType != ntypAttr && pCompileParent -> nType != ntypAttr) 0 0 0
1795 {
1796 0 pRunParent = Node_selfCondCloneNode (a, pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ;
1797 0 pCompileParent = Node_selfCondCloneNode (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
1798 0 pRunParent -> xPrev = pCompileParent -> xNdx ;
1799 0 pCompileParent -> xNext = pRunParent -> xNdx ;
1800 0 pRunParent -> bFlags |= nflgNewLevelPrev ;
1801 0 pCompileParent -> bFlags |= nflgNewLevelNext ;
1802 }
1803 else
1804 {
1805 0 int nCompile = Attr_selfAttrNum(((tAttrData *)pCompileParent)) ;
1806 0 int nRun = Attr_selfAttrNum(((tAttrData *)pRunParent)) ;
1807 int i ;
1808  
1809 0 ▶ pCompileParent2 = Node_selfLevel (a, pDomTree, pCompileParent2 -> xNdx, r -> Component.nCurrRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pCompileParent2 = Node_selfLevel (a, pDomTree, pCompileParent2 -> xNdx, r -> Component.nCurrRepeatLevel) ; 0 0 0
pCompileParent2 = Node_selfLevel (a, pDomTree, pCompileParent2 -> xNdx, r -> Component.nCurrRepeatLevel) ; 0 0 0
1810 0 pCompileParent2 = Node_selfCondCloneNode (a, pDomTree, pCompileParent2, r -> Component.nCurrRepeatLevel) ;
1811  
1812 0 ▶ for (i = nRun - 1 ; i > nCompile; i--)
Branch: 1 branch
BranchTrueFalseTotal
for (i = nRun - 1 ; i > nCompile; i--) 0 0 0
1813 {
1814 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1815 {
1816 0 tAttrData * pAttr = Element_selfGetNthAttribut (a, pDomTree, pCompileParent2, i) ;
1817 0 lprintf (a, "[%d]Checkpoint: remove attr #%d flags=%x attr=%d node=%d\n", a -> pThread -> nPid, i, pAttr -> bFlags, pAttr ->xNdx, pCompileParent2 -> xNdx) ;
1818 }
1819 0 Element_selfRemoveNthAttribut (a, pDomTree, pCompileParent2, r -> Component.nCurrRepeatLevel, i) ;
1820 }
1821 }
1822  
1823 0 ▶ pPrevNode -> xNext = Node_selfFirstChild (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) -> xNdx ;
Branch: 2 branches
BranchTrueFalseTotal
pPrevNode -> xNext = Node_selfFirstChild (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) -> xNdx ; 0 0 0
pPrevNode -> xNext = Node_selfFirstChild (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) -> xNdx ; 0 0 0
1824 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1825 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1826 0 lprintf (a, "[%d]Checkpoint: jump forward2 DomTree=%d Index=%d Node=%d(%d),%d,%d Line=%d -> Index=%d Node=%d(%d),%d,%d Line=%d SVs=%d\n",
1827 0 a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint,
1828 0 ▶ pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), 0 0 0
1829 pCompileParent -> xNdx, pCompileParent2?pCompileParent2 -> xNdx:-1,
1830 0 ▶ pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, 0 0 0
1831 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), 0 0 0
1832 pRunParent -> xNdx, pRunParent2?pRunParent2 -> xNdx:-1,
1833 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1834 }
1835 else
1836 {
1837 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1838 0 lprintf (a, "[%d]Checkpoint: jump forward2 DomTree=%d Index=%d Node=%d(%d),%d,%d Line=%d -> Index=%d Node=%d(%d),%d,%d Line=%d SVs=%d\n",
1839 0 a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint,
1840 0 ▶ pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), 0 0 0
1841 pCompileParent -> xNdx, pCompileParent2?pCompileParent2 -> xNdx:-1,
1842 0 ▶ pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, 0 0 0
1843 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), 0 0 0
1844 pRunParent -> xNdx, pRunParent2?pRunParent2 -> xNdx:-1,
1845 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1846
1847 0 Perl_croak(aTHX_ "Unstructured forward jump, %s. Start and End (Line %d - Line %d) of block does not match.", DomTree_filename(r -> Component.xCurrDomTree), pPrevNode -> nLinenumber, pRunNode -> nLinenumber) ;
1848 }
1849 }
1850 else
1851 {
1852 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1853 0 lprintf (a, "[%d]Checkpoint: jump forward DomTree=%d Index=%d Node=%d Line=%d -> Index=%d Node=%d Line=%d SVs=%d\n", a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint, pPrevNode -> xNdx, pPrevNode -> nLinenumber, nRunCheckpoint, pRunNode -> xNdx, pRunNode -> nLinenumber, sv_count) ;
1854
1855 0 Perl_croak(aTHX_ "Unstructured forward jump, %s. Start and End (Line %d - Line %d) of block does not match.", DomTree_filename(r -> Component.xCurrDomTree), pPrevNode -> nLinenumber, pRunNode -> nLinenumber) ;
1856 }
1857 0 r -> Component.nCurrCheckpoint = nRunCheckpoint + 1 ;
1858 0 return ;
1859 }
1860 }
1861 {
1862 0 ▶ tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
tNodeData * pCompileNode = Node_selfLevel (a, pDomTree, pCheckpoints[nCompileCheckpoint].xNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1863 0 ▶ tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, (tRepeatLevel)(r -> Component.nCurrRepeatLevel+1)) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, (tRepeatLevel)(r -> Component.nCurrRepeatLevel+1)) ; 0 0 0
tNodeData * pRunNode = Node_selfLevel (a, pDomTree, pCheckpoints[nRunCheckpoint].xNode, (tRepeatLevel)(r -> Component.nCurrRepeatLevel+1)) ; 0 0 0
1864 0 tNodeData * pPrevNode = Node_selfPreviousSibling (a, pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
1865
1866 0 ▶ tNodeData * pCompileParent = NodeAttr_selfParentNode (pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pCompileParent = NodeAttr_selfParentNode (pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1867 0 ▶ tNodeData * pCompileParent2= NodeAttr_selfParentNode (pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pCompileParent2= NodeAttr_selfParentNode (pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ; 0 0 0
1868 0 ▶ tNodeData * pRunParent = NodeAttr_selfParentNode (pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pRunParent = NodeAttr_selfParentNode (pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
1869 0 ▶ tNodeData * pRunParent2 = NodeAttr_selfParentNode (pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
tNodeData * pRunParent2 = NodeAttr_selfParentNode (pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ; 0 0 0
1870  
1871 0 ▶ if (pPrevNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pPrevNode) 0 0 0
1872 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1873 else
1874 {
1875 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pCompileNode, r -> Component.nCurrRepeatLevel) ;
1876 0 pPrevNode -> bFlags |= nflgIgnore ;
1877 }
1878  
1879 0 ▶ if (pCompileParent -> xNdx == pRunParent -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pCompileParent -> xNdx == pRunParent -> xNdx) 0 0 0
1880 {
1881 0 r -> Component.nCurrRepeatLevel++ ;
1882 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
1883
1884 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1885 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1886 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1887 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1888  
1889 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1890 0 lprintf (a, "[%d]Checkpoint: jump backward DomTree=%d Index=%d Node=%d(%d) RepeatLevel=%d Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1891 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1892 0 nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree, pPrevNode),
1893 0 ▶ r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber, 0 0 0
1894 0 nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree, pRunNode),
1895 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1896  
1897 }
1898 0 ▶ else if (pRunParent2 && pCompileParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx)
Branch: 3 branches
BranchTrueFalseTotal
else if (pRunParent2 && pCompileParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx) 0 0 0
else if (pRunParent2 && pCompileParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx) 0 0 0
else if (pRunParent2 && pCompileParent2 && pCompileParent2 -> xNdx == pRunParent2 -> xNdx) 0 0 0
1899 {
1900 0 pPrevNode = Node_selfPreviousSibling (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
1901 0 ▶ if (pPrevNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pPrevNode) 0 0 0
1902 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1903 else
1904 {
1905 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pCompileParent, r -> Component.nCurrRepeatLevel) ;
1906 0 pPrevNode -> bFlags |= nflgIgnore ;
1907 }
1908  
1909 0 r -> Component.nCurrRepeatLevel++ ;
1910 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunParent, r -> Component.nCurrRepeatLevel) ;
1911
1912 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1913 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1914 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1915 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1916  
1917 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1918 0 lprintf (a, "[%d]Checkpoint: jump backward parent DomTree=%d Index=%d Node=%d RepeatLevel=%d Line=%d -> Index=%d Node=%d Line=%d SVs=%d\n", a -> pThread -> nPid, r -> Component.xCurrDomTree, nCompileCheckpoint, pPrevNode -> xNdx, r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber, nRunCheckpoint, pRunNode -> xNdx, pRunNode -> nLinenumber, sv_count) ;
1919  
1920 }
1921 0 ▶ else if (xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent))
Branch: 3 branches
BranchTrueFalseTotal
else if (xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent)) 0 0 0
else if (xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent)) 0 0 0
else if (xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent)) 0 0 0
1922 {
1923 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1924 0 lprintf (a, "[%d]Checkpoint: jump backward2 DomTree=%d Index=%d Node=%d(%d),%d(%d) Line=%d -> Index=%d Node=%d(%d),%d(%d) Line=%d SVs=%d\n",
1925 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1926 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), 0 0 0
1927 0 pCompileParent -> xNdx, xNode_selfLevelNull(pDomTree,pCompileParent),
1928 0 ▶ pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, 0 0 0
1929 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), 0 0 0
1930 0 pRunParent -> xNdx, xNode_selfLevelNull(pDomTree,pRunParent),
1931 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1932 0 pPrevNode = Node_selfLastChild (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1933 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1934
1935 0 r -> Component.nCurrRepeatLevel++ ;
1936  
1937 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
1938 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1939 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1940 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1941 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1942 0 pCheckpointStatus -> xJumpFromNode = pPrevNode -> xNdx ;
1943 0 pCheckpointStatus -> xJumpToNode = pRunNode -> xNdx ;
1944  
1945 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1946 0 lprintf (a, "[%d]Checkpoint: jump backward last child DomTree=%d Index=%d Node=%d(%d) RepeatLevel=%d Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1947 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1948 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber, 0 0 0
1949 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), pRunNode -> nLinenumber, sv_count) ; 0 0 0
1950  
1951 }
1952 0 ▶ else if (pRunParent2 && xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent2))
Branch: 4 branches
BranchTrueFalseTotal
else if (pRunParent2 && xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent2)) 0 0 0
else if (pRunParent2 && xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent2)) 0 0 0
else if (pRunParent2 && xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent2)) 0 0 0
else if (pRunParent2 && xNode_selfLevelNull(pDomTree,pPrevNode) == xNode_selfLevelNull(pDomTree,pRunParent2)) 0 0 0
1953 {
1954 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1955 0 lprintf (a, "[%d]Checkpoint: jump backward2 DomTree=%d Index=%d Node=%d(%d),%d(%d) Line=%d -> Index=%d Node=%d(%d),%d(%d) Line=%d SVs=%d\n",
1956 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1957 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), 0 0 0
1958 0 pCompileParent -> xNdx, xNode_selfLevelNull(pDomTree,pCompileParent),
1959 0 ▶ pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, 0 0 0
1960 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), 0 0 0
1961 0 pRunParent -> xNdx, xNode_selfLevelNull(pDomTree,pRunParent),
1962 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1963 0 pPrevNode = Node_selfLastChild (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1964 0 pPrevNode = Node_selfLastChild (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1965 0 pPrevNode = Node_selfCondCloneNode (a, pDomTree, pPrevNode, r -> Component.nCurrRepeatLevel) ;
1966
1967 0 r -> Component.nCurrRepeatLevel++ ;
1968  
1969 0 pRunNode = Node_selfCondCloneNode (a, pDomTree, pRunNode, r -> Component.nCurrRepeatLevel) ;
1970 0 pRunNode -> xPrev = pPrevNode -> xNdx ;
1971 0 pPrevNode -> xNext = pRunNode -> xNdx ;
1972 0 pRunNode -> bFlags |= nflgNewLevelPrev ;
1973 0 pPrevNode -> bFlags |= nflgNewLevelNext ;
1974 0 pCheckpointStatus -> xJumpFromNode = pPrevNode -> xNdx ;
1975 0 pCheckpointStatus -> xJumpToNode = pRunNode -> xNdx ;
1976  
1977 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1978 0 lprintf (a, "[%d]Checkpoint: jump backward last child 2 DomTree=%d Index=%d Node=%d(%d) RepeatLevel=%d Line=%d -> Index=%d Node=%d(%d) Line=%d SVs=%d\n",
1979 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1980 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), r -> Component.nCurrRepeatLevel, pPrevNode -> nLinenumber, 0 0 0
1981 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), pRunNode -> nLinenumber, sv_count) ; 0 0 0
1982  
1983 }
1984 else
1985 {
1986 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
1987 0 lprintf (a, "[%d]Checkpoint: jump backward2 DomTree=%d Index=%d Node=%d(%d),%d(%d) Line=%d -> Index=%d Node=%d(%d),%d(%d) Line=%d SVs=%d\n",
1988 0 a -> pThread -> nPid, r -> Component.xCurrDomTree,
1989 0 ▶ nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode),
Branch: 1 branch
BranchTrueFalseTotal
nCompileCheckpoint, pPrevNode -> xNdx, xNode_selfLevelNull(pDomTree,pPrevNode), 0 0 0
1990 0 pCompileParent -> xNdx, xNode_selfLevelNull(pDomTree,pCompileParent),
1991 0 ▶ pPrevNode -> nLinenumber,
Branch: 1 branch
BranchTrueFalseTotal
pPrevNode -> nLinenumber, 0 0 0
1992 0 ▶ nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode),
Branch: 1 branch
BranchTrueFalseTotal
nRunCheckpoint, pRunNode -> xNdx, xNode_selfLevelNull(pDomTree,pRunNode), 0 0 0
1993 0 pRunParent -> xNdx, xNode_selfLevelNull(pDomTree,pRunParent),
1994 0 ▶ pRunNode -> nLinenumber, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
pRunNode -> nLinenumber, sv_count) ; 0 0 0
1995  
1996 0 Perl_croak(aTHX_ "Unstructured backward jump, %s. Start and End (Line %d - Line %d) of block does not match.", DomTree_filename(r -> Component.xCurrDomTree), pPrevNode -> nLinenumber, pRunNode -> nLinenumber) ;
1997 }
1998 }
1999 0 r -> Component.nCurrCheckpoint = nRunCheckpoint + 1 ;
2000 }
2001  
2002  
2003  
2004  
2005 /*--------------------------------------------------------------------------*/
2006 /* */
2007 /* DomTree_discardAfterCheckpoint */
2008 /* */
2009 /*!
2010 *
2011 * \_en
2012 * Discard anything in the tree from the checkpoint given in nRunCheckpoint
2013 *
2014 * @param r Embperl request data
2015 * @param xDomTree current DomTree we are working on
2016 * @param nRunCheckpoint Number of checkpoint from on which the output should
2017 * discared
2018 * \endif
2019 *
2020 * \_de
2021 *
2022 * Verwrirft alles ab dem in nRunCheckpoint ?bergebenen Punkt
2023 *
2024 * @param r Embperl Requestdaten
2025 * @param xDomTree akuteller DomTree der bearbeitet wird
2026 * @param nRunCheckpoint Nummer des Checkpoints ab dem aller Output
2027 * verworfen wird
2028 * \endif
2029 *
2030 * ------------------------------------------------------------------------ */
2031  
2032 0 void DomTree_discardAfterCheckpoint (tReq * r, tIndex nRunCheckpoint)
2033  
2034  
2035 {
2036 epTHX_
2037 0 tApp * a = r -> pApp ;
2038 0 tIndex xDomTree = r -> Component.xCurrDomTree ;
2039 0 tDomTree * pDomTree = DomTree_self (xDomTree) ;
2040 0 tDomTreeCheckpointStatus * pCheckpointStatus = &pDomTree -> pCheckpointStatus[nRunCheckpoint] ;
2041  
2042 0 r -> Component.nCurrRepeatLevel = pCheckpointStatus -> nRepeatLevel ;
2043 0 r -> Component.nCurrCheckpoint = pCheckpointStatus -> nCompileCheckpoint ;
2044
2045 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
2046 0 lprintf (a, "[%d]Checkpoint: discard all from checkpoint=%d DomTree=%d new RepeatLevel=%d new Checkpoint=%d\n",
2047 0 a -> pThread -> nPid, nRunCheckpoint, r -> Component.xCurrDomTree, r -> Component.nCurrRepeatLevel, r -> Component.nCurrCheckpoint) ;
2048  
2049 0 ▶ if (pCheckpointStatus -> xJumpFromNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pCheckpointStatus -> xJumpFromNode) 0 0 0
2050 {
2051 0 tNodeData * pLastChild = Node_self (pDomTree, pCheckpointStatus -> xJumpFromNode) ;
2052 0 tNodeData * pParent = Node_self (pDomTree, pLastChild -> xParent) ;
2053 0 tNodeData * pFirstChild = Node_self (pDomTree, pParent -> xChilds) ;
2054  
2055 0 ▶ if (pCheckpointStatus -> xJumpToNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pCheckpointStatus -> xJumpToNode) 0 0 0
2056 {
2057 0 tIndex n = ArrayGetSize (a, pDomTree -> pLookup) ;
2058 tIndex i ;
2059 0 ▶ for (i = pCheckpointStatus -> xJumpToNode; i < n; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = pCheckpointStatus -> xJumpToNode; i < n; i++) 0 0 0
2060 {
2061 0 tNodeData * pNode = Node_self (pDomTree, i) ;
2062 0 ▶ if (pNode && pNode -> nType != ntypAttr)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode && pNode -> nType != ntypAttr) 0 0 0
if (pNode && pNode -> nType != ntypAttr) 0 0 0
2063 {
2064 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
2065 0 lprintf (a, "[%d]Checkpoint: discard all from checkpoint=%d DomTree=%d remove node %d\n",
2066 0 a -> pThread -> nPid, nRunCheckpoint, r -> Component.xCurrDomTree, i) ;
2067  
2068 0 Node_selfRemoveChild (a, pDomTree, pParent -> xNdx, pNode) ;
2069 }
2070 }
2071 }
2072  
2073 0 ▶ if (pFirstChild)
Branch: 1 branch
BranchTrueFalseTotal
if (pFirstChild) 0 0 0
2074 {
2075 0 pFirstChild = Node_selfCondCloneNode (a, pDomTree, pFirstChild, pFirstChild -> nRepeatLevel) ;
2076 0 pFirstChild -> xPrev = pLastChild -> xNdx ;
2077 0 pLastChild -> xNext = pFirstChild -> xNdx ;
2078
2079 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgCheckpoint) 0 0 0
2080 0 lprintf (a, "[%d]Checkpoint: discard all from table Parent=%d FirstChild=%d LastChild=%d\n",
2081 0 a -> pThread -> nPid, pParent -> xNdx, pFirstChild -> xNdx, pLastChild -> xNdx) ;
2082 }
2083 }
2084  
2085  
2086 0 }
2087
2088  
2089 /* ------------------------------------------------------------------------
2090  
2091 interface Node {
2092 # NodeType
2093 const unsigned short ELEMENT_NODE = 1;
2094 const unsigned short ATTRIBUTE_NODE = 2;
2095 const unsigned short TEXT_NODE = 3;
2096 const unsigned short CDATA_SECTION_NODE = 4;
2097 const unsigned short ENTITY_REFERENCE_NODE = 5;
2098 const unsigned short ENTITY_NODE = 6;
2099 const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
2100 const unsigned short COMMENT_NODE = 8;
2101 const unsigned short DOCUMENT_NODE = 9;
2102 const unsigned short DOCUMENT_TYPE_NODE = 10;
2103 const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
2104 const unsigned short NOTATION_NODE = 12;
2105  
2106 readonly attribute DOMString nodeName;
2107 attribute DOMString nodeValue;
2108 # raises(DOMException) on setting
2109 # raises(DOMException) on retrieval
2110  
2111 readonly attribute unsigned short nodeType;
2112 readonly attribute Node parentNode;
2113 readonly attribute NodeList childNodes;
2114 readonly attribute Node firstChild;
2115 readonly attribute Node lastChild;
2116 readonly attribute Node previousSibling;
2117 readonly attribute Node nextSibling;
2118 readonly attribute NamedNodeMap attributes;
2119 # Modified in DOM Level 2:
2120 readonly attribute Document ownerDocument;
2121 Node insertBefore(in Node newChild,
2122 in Node refChild)
2123 raises(DOMException);
2124 Node replaceChild(in Node newChild,
2125 in Node oldChild)
2126 raises(DOMException);
2127 Node removeChild(in Node oldChild)
2128 raises(DOMException);
2129 Node appendChild(in Node newChild)
2130 raises(DOMException);
2131 boolean hasChildNodes();
2132 Node cloneNode(in boolean deep);
2133 # Introduced in DOM Level 2:
2134 void normalize();
2135 # Introduced in DOM Level 2:
2136 boolean supports(in DOMString feature,
2137 in DOMString version);
2138 # Introduced in DOM Level 2:
2139 readonly attribute DOMString namespaceURI;
2140 # Introduced in DOM Level 2:
2141 attribute DOMString prefix;
2142 # raises(DOMException) on setting
2143  
2144 # Introduced in DOM Level 2:
2145 readonly attribute DOMString localName;
2146 };
2147  
2148  
2149  
2150 */
2151  
2152 /* ------------------------------------------------------------------------ */
2153 /* */
2154 /* Node_selfLevelItem */
2155 /* */
2156 /*!
2157 * \_en
2158 * returns the node with index xNode and repeat level nLevel. If there is
2159 * node node in this repeat level, the node from the source DomTree with
2160 * level zero is returned
2161 *
2162 * @param pDomTree current DomTree we are working on
2163 * @param xNode node index
2164 * @param nRepeatLevel repeat level
2165 *
2166 * @note Don't use this function directly, use the macro Node_selfLevel
2167 * \endif
2168 *
2169 * \_de
2170 * Liefert den Node mit dem Index xNode und dem RepeatLevel nLevel. Wenn
2171 * dieser nicht existiert wird der Node mit Index Null aus dem Source
2172 * DomTree zur?ck geliefert
2173 *
2174 * @param pDomTree DomTree der den Node enth?lt
2175 * @param pNode Node Index
2176 * @param nRepeatLevel RepeatLevel
2177 *
2178 * @note Dieser Funtkion sollte nicht direkt aufgerufen werden, sondern
2179 * das Makro Node_selfLevel
2180 * \endif
2181 *
2182 * ------------------------------------------------------------------------ */
2183  
2184  
2185  
2186 0 tNodeData * Node_selfLevelItem (/*in*/ tApp * a,
2187 /*in*/ tDomTree * pDomTree,
2188 /*in*/ tNode xNode,
2189 /*in*/ tRepeatLevel nLevel)
2190  
2191 {
2192 tRepeatLevelLookup * pLookupLevelNode ;
2193 tLookupItem * pLookup ;
2194  
2195 0 pLookupLevelNode = pDomTree -> pLookup[xNode].pLookupLevel ;
2196 0 ▶ if (pLookupLevelNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNode) 0 0 0
2197 {
2198 0 register tRepeatLevelLookupItem * pLookupLevelNodeLevel = &pLookupLevelNode -> items[nLevel & pLookupLevelNode -> nMask] ;
2199 0 register tNodeData * pLnNode = pLookupLevelNodeLevel -> pNode ;
2200 0 ▶ if (!pLnNode)
Branch: 1 branch
BranchTrueFalseTotal
if (!pLnNode) 0 0 0
2201 {
2202 0 pLookup = DomTree_self(pDomTree -> xSourceNdx) -> pLookup ;
2203 0 ▶ if (ArrayGetSize(a, pLookup) > xNode)
Branch: 1 branch
BranchTrueFalseTotal
if (ArrayGetSize(a, pLookup) > xNode) 0 0 0
2204 0 return ((struct tNodeData *)(pLookup[xNode].pLookup)) ;
2205 else
2206 0 return ((struct tNodeData *)(pDomTree -> pLookup[xNode].pLookup)) ;
2207 }
2208 0 ▶ if (pLnNode -> nRepeatLevel == nLevel)
Branch: 1 branch
BranchTrueFalseTotal
if (pLnNode -> nRepeatLevel == nLevel) 0 0 0
2209 0 return pLnNode ;
2210 0 ▶ while ((pLookupLevelNodeLevel = pLookupLevelNodeLevel -> pNext))
Branch: 1 branch
BranchTrueFalseTotal
while ((pLookupLevelNodeLevel = pLookupLevelNodeLevel -> pNext)) 0 0 0
2211 {
2212 0 pLnNode = pLookupLevelNodeLevel -> pNode ;
2213 0 ▶ if (pLnNode -> nRepeatLevel == nLevel)
Branch: 1 branch
BranchTrueFalseTotal
if (pLnNode -> nRepeatLevel == nLevel) 0 0 0
2214 0 return pLnNode ;
2215 }
2216 }
2217
2218
2219 0 pLookup = DomTree_self(pDomTree -> xSourceNdx) -> pLookup ;
2220 0 ▶ if (ArrayGetSize(a, pLookup) > xNode)
Branch: 1 branch
BranchTrueFalseTotal
if (ArrayGetSize(a, pLookup) > xNode) 0 0 0
2221 0 return ((struct tNodeData *)(pLookup[xNode].pLookup)) ;
2222
2223 0 return ((struct tNodeData *)(pDomTree -> pLookup[xNode].pLookup)) ;
2224 }
2225  
2226  
2227  
2228  
2229 /* ------------------------------------------------------------------------ */
2230 /* */
2231 /* Node_cloneNode */
2232 /* */
2233 /*!
2234 * \_en
2235 * clones a node
2236 *
2237 * @param pDomTree current DomTree we are working on
2238 * @param pNode node that should be cloned
2239 * @param nRepeatLevel repeat level for new node
2240 * @param bDeep determines how children are handled
2241 * - 1 clone children also
2242 * - 0 clone no children
2243 * - -1 clone no attributes and no children
2244 * \endif
2245 *
2246 * \_de
2247 * Cloned einen Node
2248 *
2249 * @param pDomTree DomTree der den Node enth?lt
2250 * @param pNode Node der gecloned werden soll
2251 * @param nRepeatLevel RepeatLevel f?r neuen Node
2252 * @param bDeep legt fest wie Kindelemente behandelt werden
2253 * - 1 cloned Kindelemente
2254 * - 0 cloned keine Kindelemente
2255 * - -1 cloned keine Attribute und keine Kindelemente
2256 * \endif
2257 *
2258 * ------------------------------------------------------------------------ */
2259  
2260  
2261 0 tNodeData * Node_selfCloneNode (/*in*/ tApp * a,
2262 /*in*/ tDomTree * pDomTree,
2263 /*in*/ tNodeData * pNode,
2264 /*in*/ tRepeatLevel nRepeatLevel,
2265 /*in*/ int bDeep)
2266  
2267 {
2268 epaTHX_
2269 0 ▶ int len = sizeof (tNodeData) + (bDeep == -1?0:pNode -> numAttr * sizeof (tAttrData)) ;
Branch: 1 branch
BranchTrueFalseTotal
int len = sizeof (tNodeData) + (bDeep == -1?0:pNode -> numAttr * sizeof (tAttrData)) ; 0 0 0
2270 tNode xNewNode ;
2271 tNodeData * pNew ;
2272  
2273 ASSERT_NODE_VALID(a,pNode) ;
2274
2275 0 ▶ if ((pNew = dom_malloc (a, len, &numNodes)) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNew = dom_malloc (a, len, &numNodes)) == NULL) 0 0 0
2276 0 return NULL ;
2277  
2278 0 memcpy (pNew, pNode, len) ;
2279 0 xNewNode = ArrayAdd (a, &pDomTree -> pLookup, 1) ;
2280 0 pDomTree -> pLookup[xNewNode].pLookup = pNew ;
2281 0 pDomTree -> pLookup[xNewNode].pLookupLevel = NULL ;
2282 0 pNew -> xNdx = xNewNode ;
2283 0 pNew -> xDomTree = pDomTree -> xNdx ;
2284 0 pNew -> nRepeatLevel = nRepeatLevel ;
2285  
2286 0 ▶ if (pNew -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pNew -> nText) 0 0 0
2287 0 NdxStringRefcntInc (a, pNew -> nText) ;
2288
2289 0 ▶ if (bDeep == -1)
Branch: 1 branch
BranchTrueFalseTotal
if (bDeep == -1) 0 0 0
2290 0 pNew -> numAttr = 0 ;
2291 else
2292 {
2293 0 tAttrData * pAttr = (tAttrData * )(pNew + 1) ;
2294 0 int n = pNew -> numAttr ;
2295  
2296 0 ▶ while (n)
Branch: 1 branch
BranchTrueFalseTotal
while (n) 0 0 0
2297 {
2298 0 xNewNode = ArrayAdd (a, &pDomTree -> pLookup, 1) ;
2299 0 pDomTree -> pLookup[xNewNode].pLookup = pAttr ;
2300 0 pDomTree -> pLookup[xNewNode].pLookupLevel = NULL ;
2301 0 pAttr -> xNdx = xNewNode ;
2302 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
2303 0 NdxStringRefcntInc (a, pAttr -> xName) ;
2304 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
2305 0 NdxStringRefcntInc (a, pAttr -> xValue) ;
2306 0 n-- ;
2307 0 pAttr++ ;
2308 }
2309 }
2310 0 ▶ if (bDeep < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (bDeep < 1) 0 0 0
2311 0 pNew -> xChilds = 0 ;
2312  
2313  
2314 0 return pNew ;
2315 }
2316
2317  
2318 /* ------------------------------------------------------------------------ */
2319 /* */
2320 /* Node_cloneNode */
2321 /* */
2322 /*!
2323 * \_en
2324 * clones a node
2325 *
2326 * @param pDomTree current DomTree we are working on
2327 * @param xNode node that should be cloned
2328 * @param nRepeatLevel repeat level for new node
2329 * @param bDeep determines how children are handled
2330 * - 1 clone children also
2331 * - 0 clone no children
2332 * - -1 clone no attributes and no children
2333 * \endif
2334 *
2335 * \_de
2336 * Cloned einen Node
2337 *
2338 * @param pDomTree DomTree der den Node enth?lt
2339 * @param xNode Node der gecloned werden soll
2340 * @param nRepeatLevel RepeatLevel f?r neuen Node
2341 * @param bDeep legt fest wie Kindelemente behandelt werden
2342 * - 1 cloned Kindelemente
2343 * - 0 cloned keine Kindelemente
2344 * - -1 cloned keine Attribute und keine Kindelemente
2345 * \endif
2346 *
2347 * ------------------------------------------------------------------------ */
2348  
2349  
2350 0 tNode Node_cloneNode (/*in*/ tApp * a,
2351 /*in*/ tDomTree * pDomTree,
2352 /*in*/ tNode xNode,
2353 /*in*/ tRepeatLevel nRepeatLevel,
2354 /*in*/ int bDeep)
2355  
2356 {
2357 0 tNodeData * pNew = Node_selfCloneNode (a, pDomTree, Node_self (pDomTree, xNode), nRepeatLevel, bDeep) ;
2358  
2359 0 ▶ if (pNew)
Branch: 1 branch
BranchTrueFalseTotal
if (pNew) 0 0 0
2360 0 return pNew -> xNdx ;
2361  
2362 0 return 0 ;
2363 }
2364  
2365 /* ------------------------------------------------------------------------ */
2366 /* */
2367 /* Node_selfCondCloneNode */
2368 /* */
2369 /*!
2370 * \_en
2371 * clone a node if it's part of a different DomTree or has a different
2372 * repeat level in preparation for a modification. This is part of the
2373 * copy on write stragtegie. As long as a node isn't written to it may
2374 * point to another node from which the current DomTree was copied or
2375 * within a different repeat level. Before writing to the node this
2376 * function has to be called to make sure we are modifing the right node
2377 *
2378 * @note Most times you will not call this function directly. All functions
2379 * that operates on the DomTree makes sure to call this function first
2380 * for you
2381 *
2382 * @param pDomTree current DomTree we are working on
2383 * @param pNode node that should be cloned
2384 * @param nRepeatLevel repeat level for new node
2385 * \endif
2386 *
2387 * \_de
2388 * Cloned einen Node wenn dieser Teil eines anderen DomTree oder eines
2389 * anderen RepeatLevel ist. Dies ist Teil der "copy on write" Strategie
2390 * solange ein Node nicht beschrieben wird, kann dieser als Zeiger auf
2391 * einen anderen Node in einem DomTree oder RepeatLevel aus dem er kopiert
2392 * wurde sein. Sobald der Node ge?ndert werden mu?, mu? diese Funktion
2393 * aufgerufen werden um sicherzustellen das der korekte Node modifiziert
2394 * wird.
2395 *
2396 * @note In den meisten F?llen ist es nicht n?tig diese Funktion direkt
2397 * aufzurufen, da alle Funktionen die den DomTree modifizieren
2398 * dies sicherstellen.
2399 *
2400 * @param pDomTree DomTree der den Node enth?lt
2401 * @param pNode Node der gecloned werden soll
2402 * @param nRepeatLevel RepeatLevel f?r neuen Node
2403 * \endif
2404 *
2405 * ------------------------------------------------------------------------ */
2406  
2407  
2408 0 tNodeData * Node_selfCondCloneNode (/*in*/ tApp * a,
2409 /*in*/ tDomTree * pDomTree,
2410 /*in*/ tNodeData * pNode,
2411 /*in*/ tRepeatLevel nRepeatLevel)
2412  
2413 {
2414 epaTHX_
2415 int len ;
2416 tNodeData * pNew ;
2417 tAttrData * pAttr ;
2418 int n ;
2419 tLookupItem * pLookup ;
2420 tNode xNdx ;
2421 tRepeatLevelLookup * pLookupLevelNode ;
2422 tRepeatLevelLookupItem * pLookupLevelNodeLevel ;
2423  
2424 ASSERT_NODE_VALID(a,pNode) ;
2425
2426 0 ▶ if (pNode -> nType == ntypAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> nType == ntypAttr) 0 0 0
2427 0 mydie (a, "Node expected, but Attribute found. Maybe unclosed quote?") ;
2428
2429 0 ▶ if (pNode -> xDomTree == pDomTree -> xNdx && pNode -> nRepeatLevel == nRepeatLevel)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> xDomTree == pDomTree -> xNdx && pNode -> nRepeatLevel == nRepeatLevel) 0 0 0
if (pNode -> xDomTree == pDomTree -> xNdx && pNode -> nRepeatLevel == nRepeatLevel) 0 0 0
2430 0 return pNode ;
2431  
2432
2433 /* lprintf(a, "selfCondCloneNode 1 node=%d repeatlevel=%d\n", pNode -> xNdx, nRepeatLevel) ; */
2434
2435 0 ▶ if (nRepeatLevel == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (nRepeatLevel == 0) 0 0 0
2436 {
2437 0 pLookup = pDomTree -> pLookup ;
2438 0 len = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ;
2439 0 xNdx = pNode -> xNdx ;
2440  
2441 0 ▶ if ((pLookup[xNdx].pLookup = pNew = dom_malloc (a, len, &numNodes)) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pLookup[xNdx].pLookup = pNew = dom_malloc (a, len, &numNodes)) == NULL) 0 0 0
2442 0 return NULL ;
2443  
2444 ASSERT_NODE_VALID(a,pNode) ;
2445
2446 0 memcpy (pNew, pNode, len) ;
2447  
2448 0 pNew -> xDomTree = pDomTree -> xNdx ;
2449  
2450 0 ▶ if (pNew -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pNew -> nText) 0 0 0
2451 0 NdxStringRefcntInc (a, pNew -> nText) ;
2452
2453 0 pAttr = (tAttrData * )(pNew + 1) ;
2454 0 n = pNew -> numAttr ;
2455  
2456 0 ▶ while (n)
Branch: 1 branch
BranchTrueFalseTotal
while (n) 0 0 0
2457 {
2458 0 pLookup[pAttr -> xNdx].pLookup = pAttr ;
2459 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
2460 0 NdxStringRefcntInc (a, pAttr -> xName) ;
2461 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
2462 0 NdxStringRefcntInc (a, pAttr -> xValue) ;
2463 0 n-- ;
2464 0 pAttr++ ;
2465 }
2466
2467 ASSERT_NODE_VALID(a,pNew) ;
2468  
2469 0 return pNew ;
2470 }
2471  
2472 0 ▶ if (!(pNew = Node_selfCloneNode (a, pDomTree, pNode, nRepeatLevel, 1)))
Branch: 1 branch
BranchTrueFalseTotal
if (!(pNew = Node_selfCloneNode (a, pDomTree, pNode, nRepeatLevel, 1))) 0 0 0
2473 0 return NULL ;
2474  
2475 0 pLookup = pDomTree -> pLookup ;
2476 0 pLookupLevelNode = pLookup[pNode -> xNdx].pLookupLevel ;
2477 0 ▶ if (!pLookupLevelNode)
Branch: 1 branch
BranchTrueFalseTotal
if (!pLookupLevelNode) 0 0 0
2478 {
2479 0 ▶ if ((pLookupLevelNode = pLookup[pNode -> xNdx].pLookupLevel =
Branch: 1 branch
BranchTrueFalseTotal
if ((pLookupLevelNode = pLookup[pNode -> xNdx].pLookupLevel = 0 0 0
2480 0 (tRepeatLevelLookup *)dom_malloc (a, sizeof (tRepeatLevelLookup) + sizeof (tRepeatLevelLookupItem) * (LEVELHASHSIZE - 1), &numLevelLookup)) == NULL)
2481 0 return NULL ;
2482 0 pLookupLevelNode -> nMask = LEVELHASHSIZE - 1 ;
2483 0 pLookupLevelNode -> numItems = LEVELHASHSIZE ;
2484 0 pLookupLevelNode -> xNullNode = pNode -> xNdx ;
2485 0 memset (pLookupLevelNode -> items, 0, sizeof (*pLookupLevelNodeLevel) * LEVELHASHSIZE) ;
2486 }
2487 0 pLookup[pNew -> xNdx].pLookupLevel = pLookupLevelNode ;
2488 0 pLookupLevelNodeLevel= &pLookupLevelNode -> items[nRepeatLevel & pLookupLevelNode -> nMask] ;
2489 0 ▶ if (pLookupLevelNodeLevel -> pNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNodeLevel -> pNode) 0 0 0
2490 {
2491 0 tRepeatLevelLookupItem * pNewItem = (tRepeatLevelLookupItem *)dom_malloc (a, sizeof (tRepeatLevelLookupItem), &numLevelLookupItem) ;
2492 0 ▶ if (!pNewItem)
Branch: 1 branch
BranchTrueFalseTotal
if (!pNewItem) 0 0 0
2493 0 return NULL ;
2494  
2495 0 pNewItem -> pNode = pLookupLevelNodeLevel -> pNode ;
2496 0 pNewItem -> pNext = pLookupLevelNodeLevel -> pNext ;
2497 0 pLookupLevelNodeLevel -> pNode = pNew ;
2498 0 pLookupLevelNodeLevel -> pNext = pNewItem ;
2499 }
2500 else
2501 {
2502 0 pLookupLevelNodeLevel -> pNode = pNew ;
2503 }
2504  
2505 ASSERT_NODE_VALID(a,pNew) ;
2506  
2507 0 return pNew ;
2508 }
2509  
2510
2511 /* ------------------------------------------------------------------------ */
2512 /* */
2513 /* Node_selfForceLevel */
2514 /* */
2515 /*!
2516 * \_en
2517 * returns a pointer to a node for a given index and repeat level. If the
2518 * node does not exist in the current DomTree or RepeatLevel it is created
2519 *
2520 * @param pDomTree current DomTree we are working on
2521 * @param xNode index for node
2522 * @param nRepeatLevel repeat level for node
2523 * \endif
2524 *
2525 * \_de
2526 * Liefert einen Zeiger auf eine Node zu einen gegebenen Index und RepeatLevel.
2527 * Existiert der Node noch nicht in diesem DomTree oder RepeatLevel wird er
2528 * erzeugt
2529 *
2530 * @param pDomTree DomTree der den Node enth?lt
2531 * @param xNode index f?r Node
2532 * @param nRepeatLevel RepeatLevel f?r Node
2533 * \endif
2534 *
2535 * ------------------------------------------------------------------------ */
2536  
2537  
2538 0 tNodeData * Node_selfForceLevel(/*in*/ tApp * a,
2539 /*in*/ tDomTree * pDomTree,
2540 /*in*/ tNode xNode,
2541 /*in*/ tRepeatLevel nRepeatLevel)
2542  
2543 {
2544 0 ▶ tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
2545  
2546 0 return Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
2547 }
2548  
2549  
2550 /* ------------------------------------------------------------------------ */
2551 /* */
2552 /* Node_newAndAppend */
2553 /* */
2554 /* Create new node and append it to parent */
2555 /* */
2556 /* ------------------------------------------------------------------------ */
2557  
2558  
2559  
2560 0 tNodeData * Node_newAndAppend (/*in*/ tApp * a,
2561 /*in*/ tDomTree * pDomTree,
2562 /*in*/ tIndex xParent,
2563 /*in*/ tRepeatLevel nRepeatLevel,
2564 /*in*/ tIndex * pxChilds,
2565 /*in*/ tSInt32 nLinenumber,
2566 /*in*/ tSInt32 nSize)
2567  
2568 {
2569 0 ▶ tIndex xChilds = pxChilds?*pxChilds:0 ;
Branch: 1 branch
BranchTrueFalseTotal
tIndex xChilds = pxChilds?*pxChilds:0 ; 0 0 0
2570 tNodeData * pNewChild ;
2571 0 tIndex xNdx = ArrayAdd (a, &pDomTree -> pLookup, 1) ;
2572  
2573 0 ▶ if (nSize == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (nSize == 0) 0 0 0
2574 0 nSize = sizeof (tNodeData) ;
2575  
2576 0 ▶ if ((pDomTree -> pLookup[xNdx].pLookup = pNewChild = dom_malloc (a, nSize, &numNodes)) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pDomTree -> pLookup[xNdx].pLookup = pNewChild = dom_malloc (a, nSize, &numNodes)) == NULL) 0 0 0
2577 0 return NULL ;
2578 0 pDomTree -> pLookup[xNdx].pLookupLevel = NULL ;
2579  
2580 0 memset (pNewChild, 0, nSize) ;
2581 0 pNewChild -> xParent = xParent ;
2582 0 pNewChild -> xNdx = xNdx ;
2583 0 pNewChild -> nLinenumber = (tUInt16)nLinenumber ;
2584 0 pNewChild -> bFlags = nflgOK ;
2585 0 pNewChild -> xDomTree = pDomTree -> xNdx ;
2586 0 pNewChild -> nRepeatLevel = nRepeatLevel ;
2587  
2588 0 ▶ if (xChilds)
Branch: 1 branch
BranchTrueFalseTotal
if (xChilds) 0 0 0
2589 { /* --- attribute has already children, get the first and last one --- */
2590 0 ▶ tNodeData * pFirstChild = Node_selfLevel (a, pDomTree, xChilds, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pFirstChild = Node_selfLevel (a, pDomTree, xChilds, nRepeatLevel) ; 0 0 0
tNodeData * pFirstChild = Node_selfLevel (a, pDomTree, xChilds, nRepeatLevel) ; 0 0 0
2591 0 ▶ tNodeData * pLastChild = Node_selfLevel (a, pDomTree, pFirstChild -> xPrev, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pLastChild = Node_selfLevel (a, pDomTree, pFirstChild -> xPrev, nRepeatLevel) ; 0 0 0
tNodeData * pLastChild = Node_selfLevel (a, pDomTree, pFirstChild -> xPrev, nRepeatLevel) ; 0 0 0
2592 0 pFirstChild = Node_selfCondCloneNode (a, pDomTree, pFirstChild, nRepeatLevel) ;
2593 0 pLastChild = Node_selfCondCloneNode (a, pDomTree, pLastChild, nRepeatLevel) ;
2594  
2595 0 pNewChild -> xNext = pFirstChild -> xNdx ;
2596 0 pNewChild -> xPrev = pLastChild -> xNdx ;
2597 0 pFirstChild -> xPrev = xNdx ;
2598 0 pLastChild -> xNext = xNdx ;
2599 }
2600 else
2601 /* --- attribute has no children, get a new one --- */
2602 {
2603 0 pNewChild -> xPrev = xNdx ;
2604 0 pNewChild -> xNext = xNdx ;
2605 0 ▶ if (pxChilds)
Branch: 1 branch
BranchTrueFalseTotal
if (pxChilds) 0 0 0
2606 0 *pxChilds = xNdx ;
2607 }
2608  
2609 0 return pNewChild ;
2610 }
2611  
2612  
2613 /* ------------------------------------------------------------------------ */
2614 /* */
2615 /* Node_selfExpand */
2616 /* */
2617 /*!
2618 * \_en
2619 * Expand a node to hold more attributes
2620 *
2621 * @param pNode Node to expand
2622 * @param numOldAttr number of Attributes in the old node that must
2623 * be relocated (-1 to take form pNode)
2624 * @param numNewAttr new number of attributes
2625 * @return The node with space for numNewAttr
2626 *
2627 * @warning The node may have a new memory address after this function
2628 * \endif
2629 *
2630 * \_de
2631 * Expandiert einen Node um mehr Attribute aufzunehmen
2632 *
2633 * @param pNode Node der expandiert werden soll
2634 * @param numOldAttr Anzahl der Attribute die Relokiert werden m?ssen
2635 * (-1 um alle Attribute zu relokieren)
2636 * @param numNewAttr Neue Anzahl der Attribute
2637 * @return Den Node mit platz f?r numNewAttr
2638 *
2639 * @warning Der Node liegt nach dem Aufruf dieser Funktion u.U. an
2640 * anderen Speicheradresse
2641 * \endif
2642 *
2643 * ------------------------------------------------------------------------ */
2644  
2645  
2646  
2647  
2648 0 tNodeData * Node_selfExpand (/*in*/ tApp * a,
2649 /*in*/ tDomTree * pDomTree,
2650 /*in*/ tNodeData * pNode,
2651 /*in*/ tUInt16 numOldAttr,
2652 /*in*/ tUInt16 numNewAttr)
2653  
2654 {
2655 tNodeData * pNewChild ;
2656 0 tNode xNdx = pNode -> xNdx ;
2657 0 int nSize = sizeof (tNodeData) + numNewAttr * sizeof (tAttrData) ;
2658  
2659 0 ▶ if ((pNewChild = dom_realloc (a, pNode, nSize)) == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNewChild = dom_realloc (a, pNode, nSize)) == NULL) 0 0 0
2660 0 return NULL ;
2661  
2662 0 ▶ if (pNewChild != pNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNewChild != pNode) 0 0 0
2663 {
2664 0 tAttrData * pAttr = ((struct tAttrData * )(pNewChild + 1)) ;
2665 0 tLookupItem * pLookup = pDomTree -> pLookup ;
2666 0 tRepeatLevelLookup *pLookupLevelNode= pLookup[xNdx].pLookupLevel ;
2667  
2668 0 ▶ if (numOldAttr == (tUInt16) -1)
Branch: 1 branch
BranchTrueFalseTotal
if (numOldAttr == (tUInt16) -1) 0 0 0
2669 0 numOldAttr = pNewChild -> numAttr ;
2670  
2671 0 pLookup[xNdx].pLookup = pNewChild ;
2672 0 ▶ if (pLookupLevelNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNode) 0 0 0
2673 {
2674 0 tRepeatLevel nLevel = pNewChild -> nRepeatLevel ;
2675 0 register tRepeatLevelLookupItem * pLookupLevelNodeLevel = &pLookupLevelNode -> items[nLevel & pLookupLevelNode -> nMask] ;
2676 0 register tNodeData * pLnNode = pLookupLevelNodeLevel -> pNode ;
2677 0 ▶ if (pLnNode && pLnNode -> nRepeatLevel == nLevel)
Branch: 2 branches
BranchTrueFalseTotal
if (pLnNode && pLnNode -> nRepeatLevel == nLevel) 0 0 0
if (pLnNode && pLnNode -> nRepeatLevel == nLevel) 0 0 0
2678 0 pLookupLevelNodeLevel -> pNode = pNewChild ;
2679 else
2680 {
2681 0 ▶ while ((pLookupLevelNodeLevel = pLookupLevelNodeLevel -> pNext))
Branch: 1 branch
BranchTrueFalseTotal
while ((pLookupLevelNodeLevel = pLookupLevelNodeLevel -> pNext)) 0 0 0
2682 {
2683 0 pLnNode = pLookupLevelNodeLevel -> pNode ;
2684 0 ▶ if (pLnNode -> nRepeatLevel == nLevel)
Branch: 1 branch
BranchTrueFalseTotal
if (pLnNode -> nRepeatLevel == nLevel) 0 0 0
2685 {
2686 0 pLookupLevelNodeLevel -> pNode = pNewChild ;
2687 0 break ;
2688 }
2689 }
2690 }
2691 }
2692  
2693 0 ▶ while (numOldAttr--)
Branch: 1 branch
BranchTrueFalseTotal
while (numOldAttr--) 0 0 0
2694 {
2695 0 pLookup[pAttr -> xNdx].pLookup = pAttr ;
2696 0 pLookup[pAttr -> xNdx].pLookupLevel = NULL ;
2697 0 pAttr++ ;
2698 }
2699
2700
2701 }
2702
2703 0 return pNewChild ;
2704 }
2705  
2706  
2707 /* ------------------------------------------------------------------------ */
2708 /* */
2709 /* Node_appendChild */
2710 /* */
2711 /* Append a child node to a parent node */
2712 /* */
2713 /* ------------------------------------------------------------------------ */
2714  
2715  
2716  
2717 0 tNode Node_appendChild (/*in*/ tApp * a,
2718 /*in*/ tDomTree * pDomTree,
2719 /*in*/ tNode xParent,
2720 /*in*/ tRepeatLevel nRepeatLevel,
2721 /*in*/ tNodeType nType,
2722 /*in*/ int bForceAttrValue,
2723 /*in*/ const char * sText,
2724 /*in*/ int nTextLen,
2725 /*in*/ int nLevel,
2726 /*in*/ int nLinenumber,
2727 /*in*/ const char * sLogMsg)
2728  
2729 {
2730 epaTHX_
2731 tNodeData * pParent;
2732 tIndex xText ;
2733  
2734 0 pParent = Node_self (pDomTree, xParent) ;
2735  
2736 /* --- clone node if it doesn't live in the current DomTree -- */
2737 0 ▶ if (pParent)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent) 0 0 0
2738 {
2739 0 ▶ if (pParent -> nType == ntypAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> nType == ntypAttr) 0 0 0
2740 {
2741 0 tNodeData * pNode = Attr_selfNode (((tAttrData *)pParent)) ;
2742  
2743 0 pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
2744 0 pParent = Node_self (pDomTree, xParent) ; /* relookup in case of node move */
2745 }
2746 else
2747 {
2748 0 pParent = Node_selfCondCloneNode (a, pDomTree, pParent, nRepeatLevel) ;
2749 }
2750 }
2751
2752 0 ▶ if (nType == ntypAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (nType == ntypAttr) 0 0 0
2753 { /* add new attribute to node */
2754 struct tAttrData * pNew ;
2755 tIndex xNdx ;
2756  
2757 0 pParent = Node_selfExpand (a, pDomTree, pParent, (tUInt16)-1, (tUInt16)(pParent -> numAttr + 1)) ;
2758  
2759 0 pNew = ((struct tAttrData * )(pParent + 1)) + pParent -> numAttr ;
2760  
2761 0 xNdx = ArrayAdd (a, &pDomTree -> pLookup, 1) ;
2762 0 pDomTree -> pLookup[xNdx].pLookup = (struct tNodeData *)pNew ;
2763 0 pDomTree -> pLookup[xNdx].pLookupLevel = NULL ;
2764  
2765 0 ▶ pNew -> xName = sText?String2NdxNoInc (a, sText, nTextLen):nTextLen ;
Branch: 1 branch
BranchTrueFalseTotal
pNew -> xName = sText?String2NdxNoInc (a, sText, nTextLen):nTextLen ; 0 0 0
2766 0 NdxStringRefcntInc (a, pNew -> xName) ;
2767 0 pNew -> xValue = 0 ;
2768 0 pNew -> bFlags = aflgOK ;
2769 0 pNew -> nType = nType ;
2770 0 pNew -> xNdx = xNdx ;
2771 0 pNew -> nNodeOffset = ((tUInt8 *)pNew) - ((tUInt8 *)pParent) ;
2772 0 pParent -> numAttr++ ;
2773 0 numAttr++ ;
2774  
2775 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
2776 0 ▶ lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n",
Branch: 5 branches
BranchTrueFalseTotal
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Attribut parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", 0 0 0
2777 0 a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, xNdx, nType, sText?nTextLen:0, sText?nTextLen:1000, sText?sText:Ndx2String (nTextLen), sText?String2NdxNoInc (a, sText, nTextLen):nTextLen, sLogMsg?sLogMsg:"") ;
2778  
2779 0 return xNdx ;
2780 }
2781
2782 0 ▶ if ((bForceAttrValue || nType == ntypAttrValue) &&
Branch: 2 branches
BranchTrueFalseTotal
if ((bForceAttrValue || nType == ntypAttrValue) && 0 0 0
if ((bForceAttrValue || nType == ntypAttrValue) && 0 0 0
2783 0 ▶ (pParent -> nType != ntypAttr || (pParent -> bFlags & aflgAttrChilds) == 0))
Branch: 2 branches
BranchTrueFalseTotal
(pParent -> nType != ntypAttr || (pParent -> bFlags & aflgAttrChilds) == 0)) 0 0 0
(pParent -> nType != ntypAttr || (pParent -> bFlags & aflgAttrChilds) == 0)) 0 0 0
2784 {
2785 /* --- add value of attribute, to non attribute parent node */
2786 /* first add dummy attribute to parent with xNoName as name index */
2787 /* if this attribute already exist, append the new value as new _child_ */
2788 /* to that attribute. This means, that an attribute can have multiple */
2789 /* child(values), in which case we set the aflgAttrChilds flag */
2790  
2791 0 struct tAttrData * pNew = (struct tAttrData * )pParent ;
2792 0 int bAddChild = 0 ;
2793
2794 0 ▶ if (pNew -> nType != ntypAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pNew -> nType != ntypAttr) 0 0 0
2795 { /* --- parent is not a attribute --- */
2796 0 ▶ if (nType == ntypAttrValue)
Branch: 1 branch
BranchTrueFalseTotal
if (nType == ntypAttrValue) 0 0 0
2797 {
2798 int i ;
2799  
2800 0 ▶ for (i = 0; i < nTextLen; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < nTextLen; i++) 0 0 0
2801 {
2802 0 ▶ if (!isspace (sText[i]))
Branch: 1 branch
BranchTrueFalseTotal
if (!isspace (sText[i])) 0 0 0
2803 0 break ;
2804 }
2805
2806 0 ▶ if (i == nTextLen)
Branch: 1 branch
BranchTrueFalseTotal
if (i == nTextLen) 0 0 0
2807 0 return 1 ; /* do not add only spaces as cdata inside a tag */
2808 }
2809  
2810 0 pNew = ((tAttrData *)(pParent + 1)) + pParent -> numAttr - 1 ; /* get last attribute of node */
2811 0 ▶ if (pParent -> numAttr == 0 || pNew -> xName != xNoName || bForceAttrValue > 1)
Branch: 3 branches
BranchTrueFalseTotal
if (pParent -> numAttr == 0 || pNew -> xName != xNoName || bForceAttrValue > 1) 0 0 0
if (pParent -> numAttr == 0 || pNew -> xName != xNoName || bForceAttrValue > 1) 0 0 0
if (pParent -> numAttr == 0 || pNew -> xName != xNoName || bForceAttrValue > 1) 0 0 0
2812 { /* --- add dummy attribute --- */
2813 0 ▶ if (!(xParent = Node_appendChild (a, pDomTree, xParent, nRepeatLevel, ntypAttr, 0, NULL, xNoName, nLevel, nLinenumber, "<noname>")))
Branch: 1 branch
BranchTrueFalseTotal
if (!(xParent = Node_appendChild (a, pDomTree, xParent, nRepeatLevel, ntypAttr, 0, NULL, xNoName, nLevel, nLinenumber, "<noname>"))) 0 0 0
2814 0 return 0 ;
2815 0 nLevel++ ;
2816 0 pNew = Attr_self (pDomTree, xParent) ;
2817 }
2818 else
2819 { /* --- dummy attribute already exist, reuse it --- */
2820 0 xParent = pNew -> xNdx ;
2821 0 bAddChild = 1 ;
2822 0 nLevel++ ;
2823 }
2824 }
2825
2826
2827 0 ▶ if (!bAddChild && !bForceAttrValue)
Branch: 2 branches
BranchTrueFalseTotal
if (!bAddChild && !bForceAttrValue) 0 0 0
if (!bAddChild && !bForceAttrValue) 0 0 0
2828 { /* we have an simple attribute, now put the value into it */
2829 0 ▶ pNew -> xValue = sText?String2NdxNoInc (a, sText, nTextLen):nTextLen ;
Branch: 1 branch
BranchTrueFalseTotal
pNew -> xValue = sText?String2NdxNoInc (a, sText, nTextLen):nTextLen ; 0 0 0
2830 0 NdxStringRefcntInc (a, pNew -> xValue) ;
2831 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
2832 0 ▶ lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType,
Branch: 5 branches
BranchTrueFalseTotal
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s AttributValue parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
2833 0 sText?nTextLen:0, sText?nTextLen:1000, sText?sText:Ndx2String (nTextLen), sText?String2NdxNoInc (a, sText, nTextLen):nTextLen, sLogMsg?sLogMsg:"") ;
2834 0 pNew -> bFlags |= aflgAttrValue ;
2835  
2836 0 return xParent ;
2837 }
2838 else
2839 /* --- we have to add a new child to the attribute, so set the attribute as parent --- */
2840 0 pParent = (tNodeData *)pNew ;
2841  
2842 }
2843  
2844 /* --- if we come we here we have add a new child node --- */
2845  
2846 {
2847 struct tNodeData * pNew ;
2848 0 tIndex xOldValue = 0 ;
2849  
2850 0 ▶ if (pParent && pParent -> nType == ntypAttr)
Branch: 2 branches
BranchTrueFalseTotal
if (pParent && pParent -> nType == ntypAttr) 0 0 0
if (pParent && pParent -> nType == ntypAttr) 0 0 0
2851 { /* --- we add a new child to an attribute --- */
2852 0 ▶ if (((tAttrData *)pParent) -> bFlags & aflgAttrValue)
Branch: 1 branch
BranchTrueFalseTotal
if (((tAttrData *)pParent) -> bFlags & aflgAttrValue) 0 0 0
2853 {
2854 0 xOldValue = ((tAttrData *)pParent) -> xValue ;
2855 0 ((tAttrData *)pParent) -> xValue = 0 ;
2856
2857 0 pNew = Node_newAndAppend (a, pDomTree, xParent, nRepeatLevel, &(((tAttrData *)pParent) -> xValue), nLinenumber, 0) ;
2858 0 pNew -> nType = ntypAttrValue ;
2859 0 pNew -> nText = xOldValue ;
2860 }
2861  
2862 0 ((tAttrData *)pParent) -> bFlags &= ~aflgAttrValue ;
2863 0 ((tAttrData *)pParent) -> bFlags |= aflgAttrChilds ;
2864 0 pNew = Node_newAndAppend (a, pDomTree, xParent, nRepeatLevel, &(((tAttrData *)pParent) -> xValue), nLinenumber, 0) ;
2865
2866 }
2867 else
2868 {
2869 0 ▶ pNew = Node_newAndAppend (a, pDomTree, xParent, nRepeatLevel, pParent?&(pParent -> xChilds):NULL, nLinenumber, 0) ;
Branch: 1 branch
BranchTrueFalseTotal
pNew = Node_newAndAppend (a, pDomTree, xParent, nRepeatLevel, pParent?&(pParent -> xChilds):NULL, nLinenumber, 0) ; 0 0 0
2870 }
2871
2872
2873 0 ▶ if (sText)
Branch: 1 branch
BranchTrueFalseTotal
if (sText) 0 0 0
2874 0 xText = String2Ndx (a, sText, nTextLen) ;
2875 else
2876 {
2877 0 NdxStringRefcntInc(a, nTextLen) ;
2878 0 xText = nTextLen ;
2879 }
2880 0 pNew -> nType = nType ;
2881 0 pNew -> nText = xText ;
2882
2883 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgParse) 0 0 0
2884 0 ▶ lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType,
Branch: 5 branches
BranchTrueFalseTotal
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
lprintf (a, "[%d]PARSE: AddNode: +%02d %*s Element parent=%d node=%d type=%d text=%*.*s (#%d) %s\n", a -> pThread -> nPid, nLevel, nLevel * 2, "", xParent, pNew -> xNdx, nType, 0 0 0
2885 0 sText?nTextLen:0, sText?nTextLen:1000, sText?sText:Ndx2String (nTextLen), sText?String2NdxNoInc (a, sText, nTextLen):nTextLen, sLogMsg?sLogMsg:"") ;
2886  
2887 0 return pNew -> xNdx ;
2888 }
2889 }
2890  
2891  
2892 /* ------------------------------------------------------------------------ */
2893 /* */
2894 /* Node_removeChild */
2895 /* */
2896 /* Remove a child node */
2897 /* */
2898 /* ------------------------------------------------------------------------ */
2899  
2900  
2901  
2902 0 tNodeData * Node_selfRemoveChild (/*in*/ tApp * a,
2903 /*in*/ tDomTree * pDomTree,
2904 /*in*/ tNode xParent,
2905 /*in*/ tNodeData * pChild)
2906  
2907 {
2908 0 struct tNodeData * pParent = Node_self (pDomTree, pChild -> xParent) ;
2909
2910 0 ▶ if (pChild -> xNext == pChild -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pChild -> xNext == pChild -> xNdx) 0 0 0
2911 { /* --- the only child --- */
2912 0 pParent -> xChilds = 0 ;
2913 }
2914 else
2915 {
2916 0 tNodeData * pPrev = Node_self (pDomTree, pChild -> xPrev) ;
2917 0 tNodeData * pNext = Node_self (pDomTree, pChild -> xNext) ;
2918  
2919 0 ▶ if (pParent -> xChilds == pChild -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> xChilds == pChild -> xNdx) 0 0 0
2920 { /* --- the first child --- */
2921 0 pParent -> xChilds = pChild -> xNext ;
2922 }
2923  
2924 0 ▶ if (pPrev && pPrev -> xNext == pChild -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pPrev && pPrev -> xNext == pChild -> xNdx) 0 0 0
if (pPrev && pPrev -> xNext == pChild -> xNdx) 0 0 0
2925 {
2926 0 ▶ tNodeData * pNextL = Node_selfLevel (a, pDomTree, pChild -> xNext, pChild -> nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNextL = Node_selfLevel (a, pDomTree, pChild -> xNext, pChild -> nRepeatLevel) ; 0 0 0
tNodeData * pNextL = Node_selfLevel (a, pDomTree, pChild -> xNext, pChild -> nRepeatLevel) ; 0 0 0
2927 0 pPrev -> xNext = pNextL -> xNdx ;
2928 }
2929 0 ▶ if (pNext && pNext -> xPrev == pChild -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pNext && pNext -> xPrev == pChild -> xNdx) 0 0 0
if (pNext && pNext -> xPrev == pChild -> xNdx) 0 0 0
2930 {
2931 0 ▶ tNodeData * pPrevL = Node_selfLevel (a, pDomTree, pChild -> xPrev, pChild -> nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pPrevL = Node_selfLevel (a, pDomTree, pChild -> xPrev, pChild -> nRepeatLevel) ; 0 0 0
tNodeData * pPrevL = Node_selfLevel (a, pDomTree, pChild -> xPrev, pChild -> nRepeatLevel) ; 0 0 0
2932 0 pNext -> xPrev = pPrevL -> xNdx ;
2933 }
2934 }
2935  
2936
2937 0 pDomTree -> pLookup[pChild -> xNdx].pLookup = NULL ;
2938
2939 {
2940 0 tRepeatLevelLookup * pLookupLevelNode = pDomTree -> pLookup[pChild -> xNdx].pLookupLevel ;
2941 0 ▶ if (pLookupLevelNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNode) 0 0 0
2942 {
2943 0 register tRepeatLevelLookupItem * pLookupLevelNodeLevel = &pLookupLevelNode -> items[pChild -> nRepeatLevel & pLookupLevelNode -> nMask] ;
2944 0 tRepeatLevelLookupItem * pLast = NULL ;
2945 0 ▶ while (pLookupLevelNodeLevel && pLookupLevelNodeLevel -> pNode != pChild)
Branch: 2 branches
BranchTrueFalseTotal
while (pLookupLevelNodeLevel && pLookupLevelNodeLevel -> pNode != pChild) 0 0 0
while (pLookupLevelNodeLevel && pLookupLevelNodeLevel -> pNode != pChild) 0 0 0
2946 {
2947 0 pLast = pLookupLevelNodeLevel ;
2948 0 pLookupLevelNodeLevel = pLookupLevelNodeLevel -> pNext ;
2949 }
2950  
2951 0 ▶ if (pLookupLevelNodeLevel)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNodeLevel) 0 0 0
2952 {
2953 0 ▶ if (pLast)
Branch: 1 branch
BranchTrueFalseTotal
if (pLast) 0 0 0
2954 {
2955 0 pLast -> pNext = pLookupLevelNodeLevel -> pNext ;
2956 0 dom_free_size (a, pLookupLevelNodeLevel, sizeof (tRepeatLevelLookupItem), &numLevelLookupItem) ;
2957 }
2958 0 ▶ else if (pLookupLevelNodeLevel -> pNext)
Branch: 1 branch
BranchTrueFalseTotal
else if (pLookupLevelNodeLevel -> pNext) 0 0 0
2959 {
2960 0 pLast = pLookupLevelNodeLevel -> pNext ;
2961 0 pLookupLevelNodeLevel -> pNode = pLast -> pNode ;
2962 0 pLookupLevelNodeLevel -> pNext = pLast -> pNext ;
2963 0 dom_free_size (a, pLast, sizeof (tRepeatLevelLookupItem), &numLevelLookupItem) ;
2964 }
2965 else
2966 {
2967 0 pLookupLevelNodeLevel -> pNode = NULL ;
2968 }
2969 }
2970 0 ▶ if (pLookupLevelNode -> xNullNode != pChild -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pLookupLevelNode -> xNullNode != pChild -> xNdx) 0 0 0
2971 0 pDomTree -> pLookup[pChild -> xNdx].pLookupLevel = NULL ;
2972 }
2973
2974 }
2975  
2976 0 dom_free (a, pChild, &numNodes) ;
2977  
2978 0 return NULL ;
2979 }
2980  
2981  
2982 /* ------------------------------------------------------------------------ */
2983 /* */
2984 /* Node_removeChild */
2985 /* */
2986 /* Remove a child node */
2987 /* */
2988 /* ------------------------------------------------------------------------ */
2989  
2990  
2991  
2992 0 tNode Node_removeChild (/*in*/ tApp * a,
2993 /*in*/ tDomTree * pDomTree,
2994 /*in*/ tNode xParent,
2995 /*in*/ tNode xChild,
2996 /*in*/ tRepeatLevel nRepeatLevel)
2997  
2998 {
2999 0 ▶ Node_selfRemoveChild (a, pDomTree, xParent, Node_selfLevel (a, pDomTree, xChild, nRepeatLevel)) ;
Branch: 2 branches
BranchTrueFalseTotal
Node_selfRemoveChild (a, pDomTree, xParent, Node_selfLevel (a, pDomTree, xChild, nRepeatLevel)) ; 0 0 0
Node_selfRemoveChild (a, pDomTree, xParent, Node_selfLevel (a, pDomTree, xChild, nRepeatLevel)) ; 0 0 0
3000 0 return 0 ;
3001 }
3002  
3003  
3004 /* ------------------------------------------------------------------------ */
3005 /* */
3006 /* Node_replaceChild */
3007 /* */
3008 /* Replaces the node pointed by pOldChildDomTree/xOldChild/nOldRepeatLevel, */
3009 /* with the node pointed by pDomTree/xNode/nRepeatLevel */
3010 /* */
3011 /* ------------------------------------------------------------------------ */
3012  
3013  
3014  
3015 0 tNode Node_replaceChildWithNode (/*in*/ tApp * a,
3016 /*in*/ tDomTree * pDomTree,
3017 /*in*/ tNode xNode,
3018 /*in*/ tRepeatLevel nRepeatLevel,
3019 /*in*/ tDomTree * pOldChildDomTree,
3020 /*in*/ tNode xOldChild,
3021 /*in*/ tRepeatLevel nOldRepeatLevel)
3022  
3023 {
3024 epaTHX_
3025 0 ▶ tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
3026 0 ▶ tNodeData * pOldChild = Node_selfCondCloneNode (a, pOldChildDomTree, Node_selfLevel (a, pOldChildDomTree, xOldChild, nOldRepeatLevel), nOldRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pOldChild = Node_selfCondCloneNode (a, pOldChildDomTree, Node_selfLevel (a, pOldChildDomTree, xOldChild, nOldRepeatLevel), nOldRepeatLevel) ; 0 0 0
tNodeData * pOldChild = Node_selfCondCloneNode (a, pOldChildDomTree, Node_selfLevel (a, pOldChildDomTree, xOldChild, nOldRepeatLevel), nOldRepeatLevel) ; 0 0 0
3027 0 int len = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ;
3028 0 int numAttr = pOldChild -> numAttr ;
3029 tAttrData * pAttr ;
3030 int n ;
3031 tLookupItem * pLookup ;
3032  
3033
3034 0 pOldChild = Node_selfExpand (a, pOldChildDomTree, pOldChild, 0, pNode -> numAttr) ;
3035
3036 0 ▶ if (pOldChild -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChild -> nText) 0 0 0
3037 0 NdxStringFree (a, pOldChild -> nText) ;
3038  
3039 0 pAttr = ((struct tAttrData * )(pOldChild + 1)) ;
3040 0 n = pOldChild -> numAttr ;
3041  
3042 0 ▶ while (n > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (n > 0) 0 0 0
3043 {
3044 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
3045 0 NdxStringFree (a, pAttr -> xName) ;
3046 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
3047 0 NdxStringFree (a, pAttr -> xValue) ;
3048 0 n-- ;
3049 0 pAttr++ ;
3050 }
3051  
3052 0 memcpy (pOldChild, pNode, len) ;
3053  
3054 0 ▶ if (pOldChild -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChild -> nText) 0 0 0
3055 0 NdxStringRefcntInc (a, pOldChild -> nText) ;
3056
3057  
3058 0 pOldChild -> xDomTree = pDomTree -> xNdx ;
3059 0 pOldChild -> xNdx = xOldChild ;
3060  
3061 0 pAttr = ((struct tAttrData * )(pOldChild + 1)) ;
3062 0 n = pNode -> numAttr ;
3063 0 pLookup = pDomTree -> pLookup ;
3064  
3065  
3066 0 ▶ while (n > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (n > 0) 0 0 0
3067 {
3068 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
3069 0 NdxStringRefcntInc (a, pAttr -> xName) ;
3070 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
3071 0 NdxStringRefcntInc (a, pAttr -> xValue) ;
3072 0 pLookup[pAttr -> xNdx].pLookup = pAttr ;
3073 0 n-- ;
3074 0 pAttr++ ;
3075 }
3076
3077 0 pAttr = ((struct tAttrData * )(pOldChild + 1)) + pOldChild -> numAttr ;
3078 0 n = numAttr - pNode -> numAttr ;
3079  
3080 0 ▶ while (n > 0)
Branch: 1 branch
BranchTrueFalseTotal
while (n > 0) 0 0 0
3081 {
3082 0 pAttr -> bFlags = nflgDeleted ;
3083 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
3084 0 NdxStringFree (a, pAttr -> xName) ;
3085 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
3086 0 NdxStringFree (a, pAttr -> xValue) ;
3087 0 n-- ;
3088 0 pAttr++ ;
3089 }
3090  
3091 0 ▶ if (pOldChild -> nType == ntypDocument)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChild -> nType == ntypDocument) 0 0 0
3092 {
3093 0 pOldChild -> nType = ntypDocumentFraq ;
3094 0 ▶ if (pOldChild -> nText != xDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChild -> nText != xDocumentFraq) 0 0 0
3095 {
3096 0 NdxStringFree (a, pOldChild -> nText) ;
3097 0 pOldChild -> nText = xDocumentFraq ;
3098 0 NdxStringRefcntInc (a, xDocumentFraq) ;
3099 }
3100 }
3101  
3102 0 ▶ if (pOldChild -> nType == ntypDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChild -> nType == ntypDocumentFraq) 0 0 0
3103 {
3104 0 tAttrData * pAttr = Element_selfSetAttribut (a, pOldChildDomTree, pOldChild, nOldRepeatLevel, NULL, xDomTreeAttr, (char *)&pDomTree -> xNdx, sizeof (pDomTree -> xNdx)) ;
3105 0 pAttr -> bFlags = aflgOK ; /* reset string value flag */
3106 }
3107  
3108 0 ▶ if (pOldChildDomTree -> xNdx != pDomTree -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pOldChildDomTree -> xNdx != pDomTree -> xNdx) 0 0 0
3109 {
3110 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
3111 0 lprintf (a, "[%d]DOM: DomTree %d depends on DomTree %d\n", a -> pThread -> nPid, pOldChildDomTree -> xNdx, pDomTree -> xNdx) ;
3112 0 av_push (pOldChildDomTree -> pDependsOn, SvREFCNT_inc (pDomTree -> pDomTreeSV)) ;
3113 }
3114
3115 0 return pOldChild -> xNdx ;
3116 }
3117  
3118 /* ------------------------------------------------------------------------ */
3119 /* */
3120 /* Node_insertBefore */
3121 /* */
3122 /* Inserts a child node before another node */
3123 /* */
3124 /* ------------------------------------------------------------------------ */
3125  
3126  
3127 0 tNode Node_insertBefore_CDATA (/*in*/ tApp * a,
3128 /*in*/ const char * sText,
3129 /*in*/ int nTextLen,
3130 /*in*/ int nEscMode,
3131 /*in*/ tDomTree * pRefNodeDomTree,
3132 /*in*/ tNode xRefNode,
3133 /*in*/ tRepeatLevel nRefRepeatLevel)
3134  
3135 {
3136 0 ▶ tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
3137 0 tNodeData * pPrevNode = Node_selfPreviousSibling (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3138  
3139  
3140 0 tNodeData * pNew = Node_newAndAppend (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel, NULL, pRefNode -> nLinenumber, sizeof (tNodeData)) ;
3141  
3142 0 pNew -> xChilds = 0 ;
3143 0 pNew -> bFlags = 0 ;
3144
3145 0 ▶ if (nEscMode != -1)
Branch: 1 branch
BranchTrueFalseTotal
if (nEscMode != -1) 0 0 0
3146 {
3147 0 ▶ pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ;
Branch: 2 branches
BranchTrueFalseTotal
pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
3148 0 pNew -> bFlags &= ~(nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3149 0 pNew -> bFlags |= (nEscMode ^ nflgEscChar) & (nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3150 }
3151 else
3152 0 pNew -> nType = ntypCDATA ;
3153  
3154 0 pNew -> nText = String2Ndx (a, sText, nTextLen) ;
3155  
3156
3157 0 pRefNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3158 0 ▶ if (pPrevNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pPrevNode) 0 0 0
3159 0 pPrevNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pPrevNode, nRefRepeatLevel) ;
3160 else
3161 {
3162 tNodeData * pParent ;
3163  
3164 0 ▶ if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL ||
Branch: 3 branches
BranchTrueFalseTotal
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
3165 0 ▶ pParent -> xChilds != pRefNode -> xPrev)
Branch: 1 branch
BranchTrueFalseTotal
pParent -> xChilds != pRefNode -> xPrev) 0 0 0
3166 0 ▶ pPrevNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xPrev, nRefRepeatLevel) ; /* first one */
Branch: 2 branches
BranchTrueFalseTotal
pPrevNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xPrev, nRefRepeatLevel) ; /* first one */ 0 0 0
pPrevNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xPrev, nRefRepeatLevel) ; /* first one */ 0 0 0
3167 else
3168 0 pPrevNode = NULL ;
3169 }
3170  
3171 0 ▶ if (pPrevNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pPrevNode) 0 0 0
3172 {
3173 0 pPrevNode -> xNext = pNew -> xNdx ;
3174 0 pNew -> xPrev = pPrevNode -> xNdx ;
3175 }
3176 else
3177 0 pNew -> xPrev = pRefNode -> xPrev ;
3178 0 pRefNode -> xPrev = pNew -> xNdx ;
3179 0 pNew -> xNext = pRefNode -> xNdx ;
3180  
3181 0 return pNew -> xNdx ;
3182 }
3183  
3184  
3185 /* ------------------------------------------------------------------------ */
3186 /* */
3187 /* Node_insertAfter */
3188 /* */
3189 /* Inserts a child node after another node */
3190 /* */
3191 /* ------------------------------------------------------------------------ */
3192  
3193 0 tNode Node_insertAfter (/*in*/ tApp * a,
3194 /*in*/ tDomTree * pNewNodeDomTree,
3195 /*in*/ tNode xNewNode,
3196 /*in*/ tRepeatLevel nNewRepeatLevel,
3197 /*in*/ tDomTree * pRefNodeDomTree,
3198 /*in*/ tNode xRefNode,
3199 /*in*/ tRepeatLevel nRefRepeatLevel)
3200  
3201 {
3202 epaTHX_
3203 0 ▶ tNodeData * pNewNode = Node_selfLevel (a, pNewNodeDomTree, xNewNode, nNewRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNewNode = Node_selfLevel (a, pNewNodeDomTree, xNewNode, nNewRepeatLevel) ; 0 0 0
tNodeData * pNewNode = Node_selfLevel (a, pNewNodeDomTree, xNewNode, nNewRepeatLevel) ; 0 0 0
3204 0 ▶ tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
3205 0 tNodeData * pNxtNode = Node_selfNextSibling (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3206  
3207  
3208 0 ▶ if (pNewNodeDomTree != pRefNodeDomTree)
Branch: 1 branch
BranchTrueFalseTotal
if (pNewNodeDomTree != pRefNodeDomTree) 0 0 0
3209 {
3210 0 tNodeData * pNew = Node_newAndAppend (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel, NULL, pNewNode -> nLinenumber, sizeof (tNodeData) /* + pNewNode -> numAttr * sizeof (tAttrData) (attributes are NOT copied !!)*/) ;
3211  
3212 0 pNew -> nText = pNewNode -> nText ;
3213 0 pNew -> xChilds = pNewNode -> xChilds ;
3214 0 pNew -> nType = pNewNode -> nType ;
3215 0 pNew -> bFlags = pNewNode -> bFlags ;
3216
3217 0 ▶ if (pNew -> nText)
Branch: 1 branch
BranchTrueFalseTotal
if (pNew -> nText) 0 0 0
3218 0 NdxStringRefcntInc (a, pNew -> nText) ;
3219 0 pNewNode = pNew ;
3220 }
3221
3222 0 pRefNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3223 0 ▶ if (pNxtNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNxtNode) 0 0 0
3224 0 pNxtNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pNxtNode, nRefRepeatLevel) ;
3225 else
3226 {
3227 tNodeData * pParent ;
3228  
3229 0 ▶ if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL ||
Branch: 3 branches
BranchTrueFalseTotal
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
3230 0 ▶ pParent -> xChilds != pRefNode -> xNext)
Branch: 1 branch
BranchTrueFalseTotal
pParent -> xChilds != pRefNode -> xNext) 0 0 0
3231 0 ▶ pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */
Branch: 2 branches
BranchTrueFalseTotal
pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */ 0 0 0
pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */ 0 0 0
3232 else
3233 0 pNxtNode = NULL ;
3234 }
3235  
3236 0 ▶ if (pNxtNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNxtNode) 0 0 0
3237 {
3238 0 pNxtNode -> xPrev = pNewNode -> xNdx ;
3239 0 pNewNode -> xNext = pNxtNode -> xNdx ;
3240 }
3241 else
3242 0 pNewNode -> xNext = pRefNode -> xNext ;
3243 0 pRefNode -> xNext = pNewNode -> xNdx ;
3244 0 pNewNode -> xPrev = pRefNode -> xNdx ;
3245  
3246 0 ▶ if (pNewNode -> nType == ntypDocument)
Branch: 1 branch
BranchTrueFalseTotal
if (pNewNode -> nType == ntypDocument) 0 0 0
3247 {
3248 0 pNewNode -> nType = ntypDocumentFraq ;
3249 0 ▶ if (pNewNode -> nText != xDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pNewNode -> nText != xDocumentFraq) 0 0 0
3250 {
3251 0 NdxStringFree (a, pNewNode -> nText) ;
3252 0 pNewNode -> nText = xDocumentFraq ;
3253 0 NdxStringRefcntInc (a, xDocumentFraq) ;
3254 }
3255 }
3256  
3257 0 ▶ if (pNewNode -> nType == ntypDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pNewNode -> nType == ntypDocumentFraq) 0 0 0
3258 {
3259 0 tAttrData * pAttr = Element_selfSetAttribut (a, pRefNodeDomTree, pNewNode, nRefRepeatLevel, NULL, xDomTreeAttr, (char *)&pNewNodeDomTree -> xNdx, sizeof (pNewNodeDomTree -> xNdx)) ;
3260 0 pAttr -> bFlags = aflgOK ; /* reset string value flag */
3261 }
3262  
3263 0 ▶ if (pRefNodeDomTree -> xNdx != pNewNodeDomTree -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pRefNodeDomTree -> xNdx != pNewNodeDomTree -> xNdx) 0 0 0
3264 {
3265 0 ▶ if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM)
Branch: 2 branches
BranchTrueFalseTotal
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
if ((a -> pCurrReq?a -> pCurrReq -> Component.Config.bDebug:a -> Config.bDebug) & dbgDOM) 0 0 0
3266 0 lprintf (a, "[%d]DOM: DomTree %d depends on DomTree %d\n", a -> pThread -> nPid, pRefNodeDomTree -> xNdx, pNewNodeDomTree -> xNdx) ;
3267 0 av_push (pRefNodeDomTree -> pDependsOn, SvREFCNT_inc (pNewNodeDomTree -> pDomTreeSV)) ;
3268 }
3269  
3270 0 return pNewNode -> xNdx ;
3271 }
3272  
3273  
3274  
3275
3276 /* ------------------------------------------------------------------------ */
3277 /* */
3278 /* Node_insertAfter_CDATA */
3279 /* */
3280 /* Inserts a cdata after another node */
3281 /* */
3282 /* ------------------------------------------------------------------------ */
3283  
3284 0 tNode Node_insertAfter_CDATA (/*in*/ tApp * a,
3285 /*in*/ const char * sText,
3286 /*in*/ int nTextLen,
3287 /*in*/ int nEscMode,
3288 /*in*/ tDomTree * pRefNodeDomTree,
3289 /*in*/ tNode xRefNode,
3290 /*in*/ tRepeatLevel nRefRepeatLevel)
3291  
3292 {
3293 0 ▶ tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
tNodeData * pRefNode = Node_selfLevel (a, pRefNodeDomTree, xRefNode, nRefRepeatLevel) ; 0 0 0
3294 0 tNodeData * pNxtNode = Node_selfNextSibling (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3295  
3296  
3297 0 tNodeData * pNew = Node_newAndAppend (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel, NULL, pRefNode -> nLinenumber, sizeof (tNodeData)) ;
3298  
3299 0 pNew -> xChilds = 0 ;
3300 0 pNew -> bFlags = 0 ;
3301
3302 0 ▶ if (nEscMode != -1)
Branch: 1 branch
BranchTrueFalseTotal
if (nEscMode != -1) 0 0 0
3303 {
3304 0 ▶ pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ;
Branch: 2 branches
BranchTrueFalseTotal
pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
pNew -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
3305 0 pNew -> bFlags &= ~(nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3306 0 pNew -> bFlags |= (nEscMode ^ nflgEscChar) & (nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3307 }
3308 else
3309 0 pNew -> nType = ntypCDATA ;
3310  
3311 0 pNew -> nText = String2Ndx (a, sText, nTextLen) ;
3312  
3313
3314 0 pRefNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pRefNode, nRefRepeatLevel) ;
3315 0 ▶ if (pNxtNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNxtNode) 0 0 0
3316 0 pNxtNode = Node_selfCondCloneNode (a, pRefNodeDomTree, pNxtNode, nRefRepeatLevel) ;
3317 else
3318 {
3319 tNodeData * pParent ;
3320  
3321 0 ▶ if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL ||
Branch: 3 branches
BranchTrueFalseTotal
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
if ((pParent = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xParent, nRefRepeatLevel)) == NULL || 0 0 0
3322 0 ▶ pParent -> xChilds != pRefNode -> xNext)
Branch: 1 branch
BranchTrueFalseTotal
pParent -> xChilds != pRefNode -> xNext) 0 0 0
3323 0 ▶ pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */
Branch: 2 branches
BranchTrueFalseTotal
pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */ 0 0 0
pNxtNode = Node_selfLevel (a, pRefNodeDomTree, pRefNode -> xNext, nRefRepeatLevel) ; /* first one */ 0 0 0
3324 else
3325 0 pNxtNode = NULL ;
3326 }
3327  
3328 0 ▶ if (pNxtNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNxtNode) 0 0 0
3329 {
3330 0 pNxtNode -> xPrev = pNew -> xNdx ;
3331 0 pNew -> xNext = pNxtNode -> xNdx ;
3332 }
3333 else
3334 0 pNew -> xNext = pRefNode -> xNext ;
3335 0 pRefNode -> xNext = pNew -> xNdx ;
3336 0 pNew -> xPrev = pRefNode -> xNdx ;
3337  
3338 0 return pNew -> xNdx ;
3339 }
3340  
3341  
3342  
3343
3344  
3345  
3346  
3347  
3348  
3349  
3350  
3351 /* ------------------------------------------------------------------------ */
3352 /* */
3353 /* Node_replaceChild */
3354 /* */
3355 /* Replace child node */
3356 /* */
3357 /* ------------------------------------------------------------------------ */
3358  
3359 0 tNode Node_replaceChildWithCDATA (/*in*/ tApp * a,
3360 /*in*/ tDomTree * pDomTree,
3361 /*in*/ tNode xOldChild,
3362 /*in*/ tRepeatLevel nRepeatLevel,
3363 /*in*/ const char * sText,
3364 /*in*/ int nTextLen,
3365 /*in*/ int nEscMode,
3366 /*in*/ int bFlags)
3367  
3368 {
3369 tNodeData * pOldChild ;
3370 tStringIndex n ;
3371
3372 0 numReplace++ ;
3373  
3374 /* *** lprintf (a, "rp1--> SVs=%d %s DomTree Old=%d\n", sv_count, sText?sText:"<null>", Node_selfDomTree (Node_self (pDomTree, xOldChild))) ; */
3375  
3376 0 ▶ pOldChild = Node_selfCondCloneNode (a, pDomTree, Node_selfLevel (a, pDomTree, xOldChild, nRepeatLevel), nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pOldChild = Node_selfCondCloneNode (a, pDomTree, Node_selfLevel (a, pDomTree, xOldChild, nRepeatLevel), nRepeatLevel) ; 0 0 0
pOldChild = Node_selfCondCloneNode (a, pDomTree, Node_selfLevel (a, pDomTree, xOldChild, nRepeatLevel), nRepeatLevel) ; 0 0 0
3377  
3378 0 ▶ if (nEscMode != -1)
Branch: 1 branch
BranchTrueFalseTotal
if (nEscMode != -1) 0 0 0
3379 {
3380 0 ▶ pOldChild -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ;
Branch: 2 branches
BranchTrueFalseTotal
pOldChild -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
pOldChild -> nType = (nEscMode & 8)?ntypText:((nEscMode & 3)?ntypTextHTML:ntypCDATA) ; 0 0 0
3381 0 pOldChild -> bFlags &= ~(nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3382 0 pOldChild -> bFlags |= (nEscMode ^ nflgEscChar) & (nflgEscUTF8 + nflgEscUrl + nflgEscChar) ;
3383 }
3384 else
3385 0 pOldChild -> nType = ntypCDATA ;
3386  
3387 0 n = pOldChild -> nText ;
3388 0 pOldChild -> nText = String2Ndx (a, sText, nTextLen) ;
3389 0 pOldChild -> xChilds = 0 ;
3390 0 pOldChild -> bFlags |= bFlags ;
3391 0 ▶ if (n)
Branch: 1 branch
BranchTrueFalseTotal
if (n) 0 0 0
3392 0 NdxStringFree (a, n) ;
3393  
3394 /* *** lprintf (a, "rp<-- nText=%d sText=>%*.*s< nTextLen = %d SVs=%d\n", pOldChild -> nText, nTextLen,nTextLen, sText?sText:"<null>", nTextLen, sv_count) ; */
3395 0 return pOldChild -> xNdx ;
3396 }
3397  
3398  
3399  
3400  
3401 /* ------------------------------------------------------------------------ */
3402 /* */
3403 /* Node_selfLastChild */
3404 /* */
3405 /* Get last child node */
3406 /* */
3407 /* ------------------------------------------------------------------------ */
3408  
3409  
3410 0 tNodeData * Node_selfLastChild (/*in*/ tApp * a,
3411 /*in*/ tDomTree * pDomTree,
3412 /*in*/ tNodeData * pNode,
3413 /*in*/ tRepeatLevel nRepeatLevel)
3414  
3415 {
3416 0 ▶ if (pNode -> xChilds)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> xChilds) 0 0 0
3417 0 ▶ return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ;
Branch: 10 branches
BranchTrueFalseTotal
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) -> xPrev, nRepeatLevel) ; 0 0 0
3418
3419 0 return 0 ;
3420 }
3421  
3422  
3423 /* ------------------------------------------------------------------------ */
3424 /* */
3425 /* Node_selfNthChild (pNode, nChildNo) ; */
3426 /* */
3427 /* Get nth child node */
3428 /* */
3429 /* ------------------------------------------------------------------------ */
3430  
3431  
3432 0 struct tNodeData * Node_selfNthChild (/*in*/ tApp * a,
3433 /*in*/ tDomTree * pDomTree,
3434 /*in*/ struct tNodeData * pNode,
3435 /*in*/ tRepeatLevel nRepeatLevel,
3436 /*in*/ int nChildNo)
3437  
3438 {
3439 0 ▶ if (pNode -> xChilds)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> xChilds) 0 0 0
3440 {
3441 tNodeData * pChild ;
3442 0 ▶ tNodeData * pFirstChild = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pFirstChild = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ; 0 0 0
tNodeData * pFirstChild = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ; 0 0 0
3443  
3444 0 ▶ if (nChildNo == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (nChildNo == 0) 0 0 0
3445 0 return pFirstChild ;
3446
3447
3448 0 pChild = pFirstChild ;
3449  
3450 do
3451 {
3452 0 ▶ pChild = Node_selfNotNullLevel (a, pDomTree, pChild -> xNext, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pChild = Node_selfNotNullLevel (a, pDomTree, pChild -> xNext, nRepeatLevel) ; 0 0 0
pChild = Node_selfNotNullLevel (a, pDomTree, pChild -> xNext, nRepeatLevel) ; 0 0 0
3453 0 ▶ if (nChildNo-- < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (nChildNo-- < 2) 0 0 0
3454 0 return pChild ;
3455 }
3456 0 ▶ while (nChildNo > 1 && pChild != pFirstChild) ;
Branch: 2 branches
BranchTrueFalseTotal
while (nChildNo > 1 && pChild != pFirstChild) ; 0 0 0
while (nChildNo > 1 && pChild != pFirstChild) ; 0 0 0
3457 }
3458  
3459 0 return 0 ;
3460 }
3461  
3462  
3463  
3464 /* ------------------------------------------------------------------------ */
3465 /* */
3466 /* Node_nextSibling (xNode) ; */
3467 /* */
3468 /* Get next sibling node */
3469 /* */
3470 /* ------------------------------------------------------------------------ */
3471  
3472  
3473 0 tNodeData * Node_selfNextSibling (/*in*/ tApp * a,
3474 /*in*/ tDomTree * pDomTree,
3475 /*in*/ tNodeData * pNode,
3476 /*in*/ tRepeatLevel nRepeatLevel)
3477  
3478 {
3479 tNodeData * pParent ;
3480 tNodeData * pNxt ;
3481  
3482 0 ▶ if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx) 0 0 0
if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx) 0 0 0
3483 0 return NULL ;
3484
3485 0 ▶ if ((pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel)) != NULL)
Branch: 3 branches
BranchTrueFalseTotal
if ((pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel)) != NULL) 0 0 0
if ((pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel)) != NULL) 0 0 0
if ((pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel)) != NULL) 0 0 0
3486 {
3487 0 ▶ if (pParent -> xChilds == pNode -> xNext)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> xChilds == pNode -> xNext) 0 0 0
3488 0 return NULL ;
3489 }
3490  
3491 0 ▶ if (pNode -> bFlags & nflgNewLevelNext)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> bFlags & nflgNewLevelNext) 0 0 0
3492 0 pNxt = Node_self (pDomTree, pNode -> xNext) ;
3493 else
3494 0 ▶ pNxt = Node_selfLevel (a, pDomTree, pNode -> xNext, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pNxt = Node_selfLevel (a, pDomTree, pNode -> xNext, nRepeatLevel) ; 0 0 0
pNxt = Node_selfLevel (a, pDomTree, pNode -> xNext, nRepeatLevel) ; 0 0 0
3495
3496 /*
3497 if (pParent && pNxt -> nRepeatLevel)
3498 {
3499 if (pParent -> xChilds == xNode_selfLevelNull(pDomTree,pNxt) )
3500 return NULL ;
3501 }
3502 */
3503  
3504 0 ▶ if (!pParent)
Branch: 1 branch
BranchTrueFalseTotal
if (!pParent) 0 0 0
3505 {
3506 0 ▶ if (pNxt -> nType == ntypDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pNxt -> nType == ntypDocumentFraq) 0 0 0
3507 0 return NULL ;
3508 }
3509 0 return pNxt ;
3510 }
3511  
3512  
3513 /* ------------------------------------------------------------------------ */
3514 /* */
3515 /* Node_nextSibling (xNode) ; */
3516 /* */
3517 /* Get next sibling node */
3518 /* */
3519 /* ------------------------------------------------------------------------ */
3520  
3521  
3522 0 tNode Node_nextSibling (/*in*/ tApp * a,
3523 /*in*/ tDomTree * pDomTree,
3524 /*in*/ tNode xNode,
3525 /*in*/ tRepeatLevel nRepeatLevel)
3526  
3527  
3528 {
3529 0 ▶ tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
3530 tNodeData * pParent ;
3531  
3532 0 ▶ if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx) 0 0 0
if (pNode -> nType == ntypAttr || pNode -> xNext == pNode -> xNdx) 0 0 0
3533 0 return 0 ;
3534
3535 0 ▶ pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
3536 0 ▶ if (pParent -> xChilds == pNode -> xNext)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> xChilds == pNode -> xNext) 0 0 0
3537 0 return 0 ;
3538
3539 0 return pNode -> xNext ;
3540 }
3541  
3542  
3543 /* ------------------------------------------------------------------------ */
3544 /* */
3545 /* Node_previousSibling (xNode) ; */
3546 /* */
3547 /* Get previous sibling node */
3548 /* */
3549 /* ------------------------------------------------------------------------ */
3550  
3551  
3552 0 tNodeData * Node_selfPreviousSibling (/*in*/ tApp * a,
3553 /*in*/ tDomTree * pDomTree,
3554 /*in*/ tNodeData * pNode,
3555 /*in*/ tRepeatLevel nRepeatLevel)
3556  
3557 {
3558 tNodeData * pParent ;
3559  
3560 0 ▶ if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx) 0 0 0
if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx) 0 0 0
3561 0 return 0 ;
3562
3563 0 ▶ pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
3564 0 ▶ if (pParent -> xChilds == pNode -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> xChilds == pNode -> xNdx) 0 0 0
3565 0 return 0 ;
3566
3567 0 ▶ if (pNode -> bFlags & nflgNewLevelPrev)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> bFlags & nflgNewLevelPrev) 0 0 0
3568 0 return Node_self (pDomTree, pNode -> xPrev) ;
3569 else
3570 0 ▶ return Node_selfLevel (a, pDomTree, pNode -> xPrev, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
return Node_selfLevel (a, pDomTree, pNode -> xPrev, nRepeatLevel) ; 0 0 0
return Node_selfLevel (a, pDomTree, pNode -> xPrev, nRepeatLevel) ; 0 0 0
3571 }
3572  
3573  
3574 /* ------------------------------------------------------------------------ */
3575 /* */
3576 /* Node_previousSibling (xNode) ; */
3577 /* */
3578 /* Get previous sibling node */
3579 /* */
3580 /* ------------------------------------------------------------------------ */
3581  
3582  
3583 0 tNode Node_previousSibling (/*in*/ tApp * a,
3584 /*in*/ tDomTree * pDomTree,
3585 /*in*/ tNode xNode,
3586 /*in*/ tRepeatLevel nRepeatLevel)
3587  
3588  
3589 {
3590 0 ▶ tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
tNodeData * pNode = Node_selfNotNullLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
3591 tNodeData * pParent ;
3592  
3593 0 ▶ if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx) 0 0 0
if (pNode -> nType == ntypAttr || pNode -> xPrev == pNode -> xNdx) 0 0 0
3594 0 return 0 ;
3595
3596 0 ▶ pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
pParent = Node_selfLevel (a, pDomTree, pNode -> xParent, nRepeatLevel) ; 0 0 0
3597 0 ▶ if (pParent -> xChilds == pNode -> xNdx)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent -> xChilds == pNode -> xNdx) 0 0 0
3598 0 return 0 ;
3599
3600 0 return pNode -> xPrev ;
3601 }
3602  
3603  
3604 /* ------------------------------------------------------------------------ */
3605 /* */
3606 /* Node_childsText (a, xNode) ; */
3607 /* */
3608 /* Get the text of all child nodes in one string */
3609 /* */
3610 /* ------------------------------------------------------------------------ */
3611  
3612  
3613 0 char * Node_childsText (/*in*/ tApp * a,
3614 /*in*/ tDomTree * pDomTree,
3615 /*in*/ tNode xNode,
3616 /*in*/ tRepeatLevel nRepeatLevel,
3617 /*i/o*/ char * * ppText,
3618 /*in*/ int bDeep)
3619  
3620 {
3621 0 ▶ tNodeData * pParent = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
tNodeData * pParent = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
tNodeData * pParent = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; 0 0 0
3622 tNodeData * pNode ;
3623 char * sNodeText ;
3624 0 ▶ char * sText = ppText?*ppText:NULL ;
Branch: 1 branch
BranchTrueFalseTotal
char * sText = ppText?*ppText:NULL ; 0 0 0
3625  
3626 0 ▶ if (pParent)
Branch: 1 branch
BranchTrueFalseTotal
if (pParent) 0 0 0
3627 {
3628 0 ▶ if (sText == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (sText == NULL) 0 0 0
3629 0 StringNew (a, &sText, 1024) ;
3630 0 ▶ pNode = Node_selfFirstChild (a, pDomTree, pParent, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pNode = Node_selfFirstChild (a, pDomTree, pParent, nRepeatLevel) ; 0 0 0
pNode = Node_selfFirstChild (a, pDomTree, pParent, nRepeatLevel) ; 0 0 0
3631 0 ▶ while (pNode)
Branch: 1 branch
BranchTrueFalseTotal
while (pNode) 0 0 0
3632 {
3633 0 sNodeText = Node_selfNodeName(pNode) ;
3634 0 StringAdd (a, &sText, sNodeText, 0) ;
3635
3636 0 ▶ if (bDeep)
Branch: 1 branch
BranchTrueFalseTotal
if (bDeep) 0 0 0
3637 0 Node_childsText (a, pDomTree, pNode -> xNdx, nRepeatLevel, &sText, 1) ;
3638  
3639 0 pNode = Node_selfNextSibling (a, pDomTree, pNode, nRepeatLevel) ;
3640 }
3641  
3642 }
3643 0 ▶ if (ppText)
Branch: 1 branch
BranchTrueFalseTotal
if (ppText) 0 0 0
3644 0 *ppText = sText ;
3645 0 return sText ;
3646 }
3647  
3648  
3649  
3650  
3651 /* ------------------------------------------------------------------------ */
3652 /* */
3653 /* Node_toString */
3654 /* */
3655 /* */
3656 /* */
3657 /* ------------------------------------------------------------------------ */
3658  
3659  
3660  
3661 0 static tNodeData * Node_toString2 (/*i/o*/ register req * r,
3662 /*in*/ tDomTree * pDomTree,
3663 /*in*/ tNode xNode,
3664 /*in*/ tRepeatLevel * pRepeatLevel)
3665
3666  
3667  
3668 {
3669 epTHX_
3670 0 tApp * a = r -> pApp ;
3671 0 tRepeatLevel nRepeatLevel = *pRepeatLevel ;
3672 0 tNodeData * pNode = Node_self (pDomTree, xNode) ;
3673 tNodeData * pLast ;
3674 struct tCharTrans * pChar2Html ;
3675  
3676 0 ▶ if (!pNode)
Branch: 1 branch
BranchTrueFalseTotal
if (!pNode) 0 0 0
3677 0 return NULL ;
3678
3679 0 ▶ if (r -> Config.nOutputEscCharset == ocharsetLatin1)
Branch: 1 branch
BranchTrueFalseTotal
if (r -> Config.nOutputEscCharset == ocharsetLatin1) 0 0 0
3680 0 pChar2Html = Char2Html ;
3681 0 ▶ else if (r -> Config.nOutputEscCharset == ocharsetLatin2)
Branch: 1 branch
BranchTrueFalseTotal
else if (r -> Config.nOutputEscCharset == ocharsetLatin2) 0 0 0
3682 0 pChar2Html = Char2HtmlLatin2 ;
3683 else
3684 0 pChar2Html = Char2HtmlMin ;
3685
3686
3687 0 ▶ if (pNode -> nType == ntypDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> nType == ntypDocumentFraq) 0 0 0
3688 {
3689 0 int o = pDomTree -> xNdx ;
3690 0 tAttrData * pAttr = Element_selfGetAttribut (a, pDomTree, pNode, NULL, xDomTreeAttr) ;
3691 0 ▶ if (pAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr) 0 0 0
3692 {
3693 char * p ;
3694 char * pNdx ;
3695  
3696 0 pNdx = Attr_selfValue(a, pDomTree, pAttr, nRepeatLevel, &p) ;
3697 0 pDomTree = DomTree_self (*(tIndexShort *)pNdx) ;
3698 }
3699  
3700 0 ▶ if (r -> Component.Config.bDebug & dbgOutput)
Branch: 1 branch
BranchTrueFalseTotal
if (r -> Component.Config.bDebug & dbgOutput) 0 0 0
3701 0 lprintf (a, "[%d]toString: ** Switch from DomTree=%d to new DomTree=%d\n", r -> pThread -> nPid, o, pDomTree -> xNdx) ;
3702
3703 }
3704
3705  
3706 0 ▶ pNode = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pNode = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ; 0 0 0
pNode = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ; 0 0 0
3707  
3708  
3709 0 ▶ while (pNode)
Branch: 1 branch
BranchTrueFalseTotal
while (pNode) 0 0 0
3710 {
3711 0 ▶ if (pNode -> bFlags & nflgStopOutput)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> bFlags & nflgStopOutput) 0 0 0
3712 {
3713 0 ▶ if (r -> Component.Config.bDebug & dbgOutput)
Branch: 1 branch
BranchTrueFalseTotal
if (r -> Component.Config.bDebug & dbgOutput) 0 0 0
3714 0 ▶ lprintf (a, "[%d]toString: Node=%d(%d) RepeatLevel=%d type=%d flags=%x -> stop output\n", r -> pThread -> nPid, pNode -> xNdx, xNode_selfLevelNull(pDomTree,pNode), nRepeatLevel, pNode -> nType, pNode -> bFlags) ;
Branch: 1 branch
BranchTrueFalseTotal
lprintf (a, "[%d]toString: Node=%d(%d) RepeatLevel=%d type=%d flags=%x -> stop output\n", r -> pThread -> nPid, pNode -> xNdx, xNode_selfLevelNull(pDomTree,pNode), nRepeatLevel, pNode -> nType, pNode -> bFlags) ; 0 0 0
3715  
3716 0 return NULL ;
3717 }
3718  
3719 0 ▶ if (r -> Component.Config.bDebug & dbgOutput)
Branch: 1 branch
BranchTrueFalseTotal
if (r -> Component.Config.bDebug & dbgOutput) 0 0 0
3720 0 ▶ lprintf (a, "[%d]toString: Node=%d(%d) RepeatLevel=%d type=%d flags=%x text=>%s<= (#%d) SVs=%d\n", r -> pThread -> nPid, pNode -> xNdx, xNode_selfLevelNull(pDomTree,pNode), nRepeatLevel, pNode -> nType, pNode -> bFlags, Ndx2String (pNode -> nText), pNode -> nText, sv_count) ;
Branch: 1 branch
BranchTrueFalseTotal
lprintf (a, "[%d]toString: Node=%d(%d) RepeatLevel=%d type=%d flags=%x text=>%s<= (#%d) SVs=%d\n", r -> pThread -> nPid, pNode -> xNdx, xNode_selfLevelNull(pDomTree,pNode), nRepeatLevel, pNode -> nType, pNode -> bFlags, Ndx2String (pNode -> nText), pNode -> nText, sv_count) ; 0 0 0
3721  
3722 0 ▶ if (pNode -> nType == ntypDocumentFraq)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> nType == ntypDocumentFraq) 0 0 0
3723 {
3724 0 Node_toString (r, pDomTree, pNode -> xNdx, 0) ;
3725 }
3726 else
3727 {
3728 0 ▶ if (pNode -> bFlags & nflgIgnore)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode -> bFlags & nflgIgnore) 0 0 0
3729 ;
3730 0 ▶ else if (pNode -> nType == ntypTag || pNode -> nType == ntypStartTag || pNode -> nType == ntypProcessingInstr)
Branch: 3 branches
BranchTrueFalseTotal
else if (pNode -> nType == ntypTag || pNode -> nType == ntypStartTag || pNode -> nType == ntypProcessingInstr) 0 0 0
else if (pNode -> nType == ntypTag || pNode -> nType == ntypStartTag || pNode -> nType == ntypProcessingInstr) 0 0 0
else if (pNode -> nType == ntypTag || pNode -> nType == ntypStartTag || pNode -> nType == ntypProcessingInstr) 0 0 0
3731 0 {
3732 0 int n = pNode -> numAttr ;
3733 0 struct tAttrData * pAttr = (struct tAttrData *)(pNode + 1) ;
3734 0 char * pNodeName = Node_selfNodeName (pNode) ;
3735 char * pNodeStart ;
3736 char * pNodeEnd ;
3737 char * p ;
3738 int nNodeStartLen ;
3739 int nNodeEndLen ;
3740 int nNodeNameLen ;
3741 int nLastLen ;
3742
3743 0 ▶ if (*pNodeName)
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName) 0 0 0
3744 {
3745 0 ▶ if (*pNodeName == ':')
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName == ':') 0 0 0
3746 {
3747 0 pNodeStart = ++pNodeName ;
3748 0 nNodeStartLen = 0 ;
3749 0 nNodeEndLen = 0 ;
3750 0 ▶ while (*pNodeName && *pNodeName != ':')
Branch: 2 branches
BranchTrueFalseTotal
while (*pNodeName && *pNodeName != ':') 0 0 0
while (*pNodeName && *pNodeName != ':') 0 0 0
3751 {
3752 0 nNodeStartLen++ ;
3753 0 pNodeName++ ;
3754 }
3755 0 ▶ if (*pNodeName == ':')
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName == ':') 0 0 0
3756 {
3757 0 pNodeEnd = ++pNodeName ;
3758 0 ▶ while (*pNodeName && *pNodeName != ':')
Branch: 2 branches
BranchTrueFalseTotal
while (*pNodeName && *pNodeName != ':') 0 0 0
while (*pNodeName && *pNodeName != ':') 0 0 0
3759 {
3760 0 nNodeEndLen++ ;
3761 0 pNodeName++ ;
3762 }
3763 }
3764 else
3765 0 pNodeEnd = "" ;
3766 0 ▶ if (*pNodeName == ':')
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName == ':') 0 0 0
3767 0 pNodeName++ ;
3768
3769 0 nNodeNameLen = 0 ;
3770 0 p = pNodeName ;
3771 0 ▶ while (*p && *p != ':')
Branch: 2 branches
BranchTrueFalseTotal
while (*p && *p != ':') 0 0 0
while (*p && *p != ':') 0 0 0
3772 {
3773 0 p++ ;
3774 0 nNodeNameLen++ ;
3775 }
3776 }
3777 0 ▶ else if (pNode -> nType == ntypProcessingInstr)
Branch: 1 branch
BranchTrueFalseTotal
else if (pNode -> nType == ntypProcessingInstr) 0 0 0
3778 {
3779 0 pNodeStart = "<?" ;
3780 0 pNodeEnd = "?>" ;
3781 0 nNodeStartLen = 2 ;
3782 0 nNodeEndLen = 2 ;
3783 0 nNodeNameLen = strlen (pNodeName) ;
3784 }
3785 else
3786 {
3787 0 nNodeStartLen = 1 ;
3788 0 ▶ nNodeEndLen = r -> Config.nOutputMode == omodeXml && pNode -> nType == ntypTag?3:1 ;
Branch: 2 branches
BranchTrueFalseTotal
nNodeEndLen = r -> Config.nOutputMode == omodeXml && pNode -> nType == ntypTag?3:1 ; 0 0 0
nNodeEndLen = r -> Config.nOutputMode == omodeXml && pNode -> nType == ntypTag?3:1 ; 0 0 0
3789 0 nNodeNameLen = strlen (pNodeName) ;
3790 0 pNodeStart = "<" ;
3791 0 ▶ pNodeEnd = nNodeEndLen == 3?" />":">" ;
Branch: 1 branch
BranchTrueFalseTotal
pNodeEnd = nNodeEndLen == 3?" />":">" ; 0 0 0
3792 }
3793  
3794 0 owrite (r, pNodeStart, nNodeStartLen) ;
3795 0 owrite (r, pNodeName, nNodeNameLen) ;
3796 0 ▶ if (*pNodeName)
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName) 0 0 0
3797 0 nLastLen = 1 ;
3798 else
3799 0 nLastLen = 0 ;
3800
3801 0 ▶ while (n--)
Branch: 1 branch
BranchTrueFalseTotal
while (n--) 0 0 0
3802 {
3803 0 ▶ if (pAttr -> bFlags)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> bFlags) 0 0 0
3804 {
3805 char * s ;
3806 int l ;
3807 0 ▶ if (nLastLen)
Branch: 1 branch
BranchTrueFalseTotal
if (nLastLen) 0 0 0
3808 {
3809 0 oputc (r, ' ') ;
3810 0 nLastLen = 0 ;
3811 }
3812 0 ▶ if (pAttr -> xName != xNoName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName != xNoName) 0 0 0
3813 {
3814 0 Ndx2StringLen (pAttr -> xName,s,l) ;
3815 0 owrite (r, s, l);
3816 0 nLastLen += l ;
3817 }
3818  
3819 0 ▶ if (pAttr -> xValue)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xValue) 0 0 0
3820 {
3821 0 ▶ if (pAttr -> xName != xNoName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName != xNoName) 0 0 0
3822 {
3823 0 ▶ if (pAttr -> bFlags & aflgSingleQuote)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> bFlags & aflgSingleQuote) 0 0 0
3824 0 oputs (r, "='") ;
3825 else
3826 0 oputs (r, "=\"") ;
3827 }
3828 0 ▶ if (pAttr -> bFlags & aflgAttrChilds)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> bFlags & aflgAttrChilds) 0 0 0
3829 {
3830 0 tAttrData * pAttrNode = (tAttrData * )Node_toString2 (r, pDomTree, pAttr -> xNdx, &nRepeatLevel) ;
3831 0 ▶ if (pAttrNode && pAttrNode != pAttr)
Branch: 2 branches
BranchTrueFalseTotal
if (pAttrNode && pAttrNode != pAttr) 0 0 0
if (pAttrNode && pAttrNode != pAttr) 0 0 0
3832 {
3833 0 pAttr = pAttrNode ;
3834 0 pNode = Attr_selfNode(pAttr) ;
3835 0 n = pNode -> numAttr - Attr_selfAttrNum (pAttr) - 1 ;
3836 0 ▶ if (n < 0)
Branch: 1 branch
BranchTrueFalseTotal
if (n < 0) 0 0 0
3837 0 n = 0 ;
3838 }
3839 0 nLastLen++ ;
3840 }
3841 else
3842 {
3843 0 Ndx2StringLen (pAttr -> xValue, s, l) ;
3844 0 ▶ while (isspace (*s) && l > 0)
Branch: 2 branches
BranchTrueFalseTotal
while (isspace (*s) && l > 0) 0 0 0
while (isspace (*s) && l > 0) 0 0 0
3845 0 s++, l-- ;
3846 /*OutputEscape (r, s, l, (pAttr -> bFlags & aflgEscXML)?Char2XML:(pAttr -> bFlags & aflgEscUrl)?Char2Url:Char2Html, (char)((pAttr -> bFlags & aflgEscChar)?'\\':0)) ;*/
3847 0 owrite (r, s, l) ;
3848 0 nLastLen += l ;
3849 }
3850 0 ▶ if (pAttr -> xName != xNoName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName != xNoName) 0 0 0
3851 {
3852 0 ▶ if (pAttr -> bFlags & aflgSingleQuote)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> bFlags & aflgSingleQuote) 0 0 0
3853 0 oputc (r, '\'') ;
3854 else
3855 0 oputc (r, '"') ;
3856 }
3857 }
3858 }
3859 0 pAttr++ ;
3860 }
3861 0 owrite (r, pNodeEnd, nNodeEndLen) ;
3862 }
3863 }
3864 0 ▶ else if (pNode -> nType == ntypText)
Branch: 1 branch
BranchTrueFalseTotal
else if (pNode -> nType == ntypText) 0 0 0
3865 {
3866 char * s ;
3867 int l ;
3868 0 Ndx2StringLen (pNode -> nText,s,l) ;
3869 0 ▶ OutputEscape (r, s, l, Char2XML, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ;
Branch: 1 branch
BranchTrueFalseTotal
OutputEscape (r, s, l, Char2XML, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ; 0 0 0
3870 }
3871 0 ▶ else if (pNode -> nType == ntypTextHTML)
Branch: 1 branch
BranchTrueFalseTotal
else if (pNode -> nType == ntypTextHTML) 0 0 0
3872 {
3873 char * s ;
3874 int l ;
3875 0 Ndx2StringLen (pNode -> nText,s,l) ;
3876 0 ▶ OutputEscape (r, s, l, (pNode -> bFlags & nflgEscUTF8)?(pNode -> bFlags & nflgEscUrl)?Char2Url:Char2HtmlMin:(pNode -> bFlags & nflgEscUrl)?Char2Url:pChar2Html, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ;
Branch: 4 branches
BranchTrueFalseTotal
OutputEscape (r, s, l, (pNode -> bFlags & nflgEscUTF8)?(pNode -> bFlags & nflgEscUrl)?Char2Url:Char2HtmlMin:(pNode -> bFlags & nflgEscUrl)?Char2Url:pChar2Html, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ; 0 0 0
OutputEscape (r, s, l, (pNode -> bFlags & nflgEscUTF8)?(pNode -> bFlags & nflgEscUrl)?Char2Url:Char2HtmlMin:(pNode -> bFlags & nflgEscUrl)?Char2Url:pChar2Html, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ; 0 0 0
OutputEscape (r, s, l, (pNode -> bFlags & nflgEscUTF8)?(pNode -> bFlags & nflgEscUrl)?Char2Url:Char2HtmlMin:(pNode -> bFlags & nflgEscUrl)?Char2Url:pChar2Html, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ; 0 0 0
OutputEscape (r, s, l, (pNode -> bFlags & nflgEscUTF8)?(pNode -> bFlags & nflgEscUrl)?Char2Url:Char2HtmlMin:(pNode -> bFlags & nflgEscUrl)?Char2Url:pChar2Html, (char)((pNode -> bFlags & nflgEscChar)?'\\':0)) ; 0 0 0
3877 }
3878 else
3879 {
3880 char * s ;
3881 int l ;
3882 0 Ndx2StringLen (pNode -> nText,s,l) ;
3883 0 owrite (r, s, l);
3884 }
3885  
3886 0 Node_toString2 (r, pDomTree, pNode -> xNdx, &nRepeatLevel) ;
3887  
3888 0 ▶ if (pNode -> nType == ntypStartTag && (pNode -> bFlags & nflgIgnore) == 0)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode -> nType == ntypStartTag && (pNode -> bFlags & nflgIgnore) == 0) 0 0 0
if (pNode -> nType == ntypStartTag && (pNode -> bFlags & nflgIgnore) == 0) 0 0 0
3889 {
3890 0 char * pNodeName = Node_selfNodeName (pNode) ;
3891
3892 0 ▶ if (*pNodeName == ':')
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName == ':') 0 0 0
3893 {
3894 0 int i = 4 ;
3895 0 ▶ while (i > 0 && *pNodeName)
Branch: 2 branches
BranchTrueFalseTotal
while (i > 0 && *pNodeName) 0 0 0
while (i > 0 && *pNodeName) 0 0 0
3896 0 ▶ if (*pNodeName++ == ':')
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName++ == ':') 0 0 0
3897 0 i-- ;
3898 0 ▶ if (*pNodeName)
Branch: 1 branch
BranchTrueFalseTotal
if (*pNodeName) 0 0 0
3899 0 oputs (r, pNodeName) ;
3900 }
3901 else
3902 {
3903 0 oputs (r, "</") ;
3904 0 oputs (r, Node_selfNodeName (pNode)) ;
3905 0 oputc (r, '>') ;
3906 }
3907 }
3908 }
3909  
3910 0 pLast = pNode ;
3911 0 pNode = Node_selfNextSibling (a, pDomTree, pNode, nRepeatLevel) ;
3912  
3913 0 ▶ if (pNode && pLast -> bFlags & nflgNewLevelNext)
Branch: 2 branches
BranchTrueFalseTotal
if (pNode && pLast -> bFlags & nflgNewLevelNext) 0 0 0
if (pNode && pLast -> bFlags & nflgNewLevelNext) 0 0 0
3914 0 nRepeatLevel = pNode -> nRepeatLevel ;
3915  
3916 }
3917  
3918 0 *pRepeatLevel = nRepeatLevel ;
3919  
3920 0 return NULL ;
3921 }
3922  
3923  
3924 #if 0
3925 if (nOrderNdx == nOrderIndexNode)
3926 nOrderNdx++ ;
3927  
3928 if (pNode -> nType == ntypDocumentFraq)
3929 pNextNode = NULL ;
3930 else
3931 pNextNode = Node_selfFirstChild (a, pDomTree, pNode, nRepeatLevel) ;
3932 if (pNextNode == NULL)
3933 {
3934 pNextNode = Node_selfNextSibling (a, pDomTree, pNode, nRepeatLevel) ;
3935 while (pNextNode == NULL)
3936 {
3937 pNextNode = Node_selfParentNode (pDomTree, pNode, nRepeatLevel) ;
3938 if (pNextNode == NULL || pNextNode == pFirstNode || pNextNode -> nType == ntypAttr)
3939 {
3940 return bCheckpointFound?pNextNode:NULL ;
3941 }
3942
3943 pNode = pNextNode ;
3944 pNextNode = Node_selfNextSibling (a, pDomTree, pNextNode, nRepeatLevel) ;
3945 if (pNode -> nType == ntypStartTag && (pNode -> bFlags & nflgIgnore) == 0)
3946 {
3947 char * pNodeName = Node_selfNodeName (pNode) ;
3948
3949 if (*pNodeName == ':')
3950 {
3951 int i = 4 ;
3952 while (i > 0 && *pNodeName)
3953 if (*pNodeName++ == ':')
3954 i-- ;
3955 if (*pNodeName)
3956 oputs (r, pNodeName) ;
3957 }
3958 else
3959 {
3960 oputs (r, "</") ;
3961 oputs (r, Node_selfNodeName (pNode)) ;
3962 oputc (r, '>') ;
3963 }
3964 pLastStartTag = Node_selfParentNode (pDomTree, pNextNode?pNextNode:pNode, nRepeatLevel) ;
3965 }
3966 }
3967 }
3968 pNode = pNextNode ;
3969 }
3970  
3971 *pOrderNdx = nOrderNdx ;
3972  
3973 return NULL ;
3974 }
3975 #endif
3976  
3977  
3978  
3979 0 void Node_toString (/*i/o*/ register req * r,
3980 /*in*/ tDomTree * pDomTree,
3981 /*in*/ tNode xNode,
3982 /*in*/ tRepeatLevel nRepeatLevel)
3983  
3984  
3985 {
3986 0 Node_toString2 (r, pDomTree, xNode, &nRepeatLevel) ;
3987 0 }
3988  
3989  
3990 /* ------------------------------------------------------------------------ */
3991 /* */
3992 /* NodeList_toString */
3993 /* */
3994 /* */
3995 /* */
3996 /* ------------------------------------------------------------------------ */
3997  
3998  
3999 0 void NodeList_toString (/*in*/ tDomTree * pDomTree,
4000 /*in*/ tNode xNode)
4001  
4002  
4003 {
4004
4005  
4006 0 }
4007  
4008
4009 /* ------------------------------------------------------------------------
4010  
4011 interface Element : Node {
4012 readonly attribute DOMString tagName;
4013 DOMString getAttribute(in DOMString name);
4014 void setAttribute(in DOMString name,
4015 in DOMString value)
4016 raises(DOMException);
4017 void removeAttribute(in DOMString name)
4018 raises(DOMException);
4019 Attr getAttributeNode(in DOMString name);
4020 Attr setAttributeNode(in Attr newAttr)
4021 raises(DOMException);
4022 Attr removeAttributeNode(in Attr oldAttr)
4023 raises(DOMException);
4024 NodeList getElementsByTagName(in DOMString name);
4025 # Introduced in DOM Level 2:
4026 DOMString getAttributeNS(in DOMString namespaceURI,
4027 in DOMString localName);
4028 # Introduced in DOM Level 2:
4029 void setAttributeNS(in DOMString namespaceURI,
4030 in DOMString qualifiedName,
4031 in DOMString value)
4032 raises(DOMException);
4033 # Introduced in DOM Level 2:
4034 void removeAttributeNS(in DOMString namespaceURI,
4035 in DOMString localName)
4036 raises(DOMException);
4037 # Introduced in DOM Level 2:
4038 Attr getAttributeNodeNS(in DOMString namespaceURI,
4039 in DOMString localName);
4040 # Introduced in DOM Level 2:
4041 Attr setAttributeNodeNS(in Attr newAttr)
4042 raises(DOMException);
4043 # Introduced in DOM Level 2:
4044 NodeList getElementsByTagNameNS(in DOMString namespaceURI,
4045 in DOMString localName);
4046 # Introduced in DOM Level 2:
4047 boolean hasAttribute(in DOMString name);
4048 # Introduced in DOM Level 2:
4049 boolean hasAttributeNS(in DOMString namespaceURI,
4050 in DOMString localName);
4051 };
4052  
4053  
4054 ------------------------------------------------------------------------- */
4055  
4056 /* ------------------------------------------------------------------------ */
4057 /* */
4058 /* Element_selfGetAttribut */
4059 /* */
4060 /* Get attribute value of Element by name */
4061 /* */
4062 /* ------------------------------------------------------------------------ */
4063  
4064  
4065  
4066 0 tAttrData * Element_selfGetAttribut (/*in*/ tApp * a,
4067 /*in*/ tDomTree * pDomTree,
4068 /*in*/ struct tNodeData * pNode,
4069 /*in*/ const char * sAttrName,
4070 /*in*/ int nAttrNameLen)
4071  
4072 {
4073 0 ▶ int nAttrName = sAttrName?String2NdxNoInc (a, sAttrName, nAttrNameLen):nAttrNameLen ;
Branch: 1 branch
BranchTrueFalseTotal
int nAttrName = sAttrName?String2NdxNoInc (a, sAttrName, nAttrNameLen):nAttrNameLen ; 0 0 0
4074 0 struct tAttrData * pAttr = (struct tAttrData * )(pNode + 1) ;
4075 0 int n = pNode -> numAttr ;
4076  
4077 0 ▶ while (n > 0 && (nAttrName != pAttr -> xName || !pAttr -> bFlags))
Branch: 3 branches
BranchTrueFalseTotal
while (n > 0 && (nAttrName != pAttr -> xName || !pAttr -> bFlags)) 0 0 0
while (n > 0 && (nAttrName != pAttr -> xName || !pAttr -> bFlags)) 0 0 0
while (n > 0 && (nAttrName != pAttr -> xName || !pAttr -> bFlags)) 0 0 0
4078 {
4079 0 n-- ;
4080 0 pAttr++ ;
4081 }
4082  
4083 0 ▶ if (n)
Branch: 1 branch
BranchTrueFalseTotal
if (n) 0 0 0
4084 0 return pAttr ;
4085  
4086 0 return NULL ;
4087 }
4088  
4089  
4090  
4091 /* ------------------------------------------------------------------------ */
4092 /* */
4093 /* Element_selfGetNthAttribut */
4094 /* */
4095 /* Get attribute value of Element by index */
4096 /* */
4097 /* ------------------------------------------------------------------------ */
4098  
4099  
4100  
4101 0 tAttrData * Element_selfGetNthAttribut (/*in*/ tApp * a,
4102 /*in*/ tDomTree * pDomTree,
4103 /*in*/ struct tNodeData * pNode,
4104 /*in*/ int n)
4105  
4106 {
4107 0 struct tAttrData * pAttr = (struct tAttrData * )(pNode + 1) ;
4108 0 int num = pNode -> numAttr ;
4109  
4110 0 ▶ if (n < 0 || n >= num)
Branch: 2 branches
BranchTrueFalseTotal
if (n < 0 || n >= num) 0 0 0
if (n < 0 || n >= num) 0 0 0
4111 0 return NULL ;
4112  
4113 0 return pAttr + n ;
4114 }
4115  
4116  
4117  
4118  
4119 /* ------------------------------------------------------------------------ */
4120 /* */
4121 /* Element_selfSetAttribut */
4122 /* */
4123 /* Set attribute value of Element by name */
4124 /* */
4125 /* ------------------------------------------------------------------------ */
4126  
4127  
4128  
4129 0 tAttrData * Element_selfSetAttribut (/*in*/ tApp * a,
4130 /*in*/ tDomTree * pDomTree,
4131 /*in*/ struct tNodeData * pNode,
4132 /*in*/ tRepeatLevel nRepeatLevel,
4133 /*in*/ const char * sAttrName,
4134 /*in*/ int nAttrNameLen,
4135 /*in*/ const char * sNewValue,
4136 /*in*/ int nNewValueLen)
4137  
4138 {
4139 epaTHX_
4140 tAttrData * pAttr ;
4141 tNode xAttr ;
4142 tNodeData * pNewNode ;
4143  
4144 0 pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
4145  
4146 0 pAttr = Element_selfGetAttribut (a, pDomTree, pNode, sAttrName, nAttrNameLen) ;
4147  
4148 0 ▶ if (pAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr) 0 0 0
4149 {
4150 0 ▶ tIndex xValue = sNewValue?String2NdxNoInc (a, sNewValue, nNewValueLen):nNewValueLen ;
Branch: 1 branch
BranchTrueFalseTotal
tIndex xValue = sNewValue?String2NdxNoInc (a, sNewValue, nNewValueLen):nNewValueLen ; 0 0 0
4151 0 NdxStringRefcntInc (a, xValue) ;
4152  
4153 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
4154 0 NdxStringFree (a, pAttr -> xValue) ;
4155  
4156 0 pAttr -> bFlags |= aflgAttrValue ;
4157 0 pAttr -> bFlags &= ~aflgAttrChilds ;
4158  
4159 0 pAttr -> xValue = xValue ;
4160 0 return pAttr ;
4161 }
4162  
4163 0 pNewNode = pNode ;
4164  
4165
4166 0 xAttr = Node_appendChild (a, pDomTree, pNewNode -> xNdx, nRepeatLevel, ntypAttr, 0, sAttrName, nAttrNameLen, 0, pNewNode -> nLinenumber, NULL) ;
4167 0 Node_appendChild (a, pDomTree, xAttr, nRepeatLevel, ntypAttrValue, 0, sNewValue, nNewValueLen, 0, pNewNode -> nLinenumber, NULL) ;
4168 0 return (tAttrData *)Node_self(pDomTree, xAttr) ;
4169 }
4170  
4171  
4172 /* ------------------------------------------------------------------------ */
4173 /* */
4174 /* Element_selfRemoveAttribut */
4175 /* */
4176 /* Remove attribute of Element by name */
4177 /* */
4178 /* ------------------------------------------------------------------------ */
4179  
4180  
4181  
4182 0 tAttrData * Element_selfRemoveAttributPtr (/*in*/ tApp * a,
4183 /*in*/ tDomTree * pDomTree,
4184 /*in*/ struct tNodeData * pNode,
4185 /*in*/ tRepeatLevel nRepeatLevel,
4186 /*in*/ tAttrData * pAttr)
4187  
4188 {
4189 0 pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
4190  
4191 0 ▶ if (pAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr) 0 0 0
4192 {
4193 0 ▶ if (pAttr -> xName)
Branch: 1 branch
BranchTrueFalseTotal
if (pAttr -> xName) 0 0 0
4194 0 NdxStringFree (a, pAttr -> xName) ;
4195 0 ▶ if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue))
Branch: 2 branches
BranchTrueFalseTotal
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
if (pAttr -> xValue && (pAttr -> bFlags & aflgAttrValue)) 0 0 0
4196 0 NdxStringFree (a, pAttr -> xValue) ;
4197 0 pAttr -> bFlags = 0 ;
4198 }
4199  
4200 /*
4201 int nCopyAttr ;
4202  
4203 if (pAttr)
4204 {
4205 nAttr = pAttr - ((struct tAttrData * )(pNode + 1)) ;
4206 pNode -> numAttr-- ;
4207 nCopyAttr = pNode -> numAttr - nAttr ;
4208 if (nCopyAttr)
4209 {
4210 memcpy (pAttr, pAttr + 1, nCopyAttr * sizeof (tAttrData)) ;
4211 while (nCopyAttr--)
4212 {
4213 pDomTree -> pLookup[pAttr -> xNdx] = pAttr ;
4214 pAttr++ ;
4215 }
4216 }
4217 }
4218 */
4219  
4220 0 return pAttr ;
4221 }
4222  
4223  
4224 0 tAttrData * Element_selfRemoveAttribut (/*in*/ tApp * a,
4225 /*in*/ tDomTree * pDomTree,
4226 /*in*/ struct tNodeData * pNode,
4227 /*in*/ tRepeatLevel nRepeatLevel,
4228 /*in*/ const char * sAttrName,
4229 /*in*/ int nAttrNameLen)
4230  
4231 {
4232 tAttrData * pAttr ;
4233  
4234 0 pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
4235  
4236 0 pAttr = Element_selfGetAttribut (a, pDomTree, pNode, sAttrName, nAttrNameLen) ;
4237  
4238 0 return Element_selfRemoveAttributPtr (a, pDomTree, pNode, nRepeatLevel, pAttr) ;
4239 }
4240
4241 0 tAttrData * Element_selfRemoveNthAttribut (/*in*/ tApp * a,
4242 /*in*/ tDomTree * pDomTree,
4243 /*in*/ struct tNodeData * pNode,
4244 /*in*/ tRepeatLevel nRepeatLevel,
4245 /*in*/ int n)
4246  
4247 {
4248 tAttrData * pAttr ;
4249  
4250 0 pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ;
4251  
4252 0 pAttr = Element_selfGetNthAttribut (a, pDomTree, pNode, n) ;
4253  
4254 0 return Element_selfRemoveAttributPtr (a, pDomTree, pNode, nRepeatLevel, pAttr) ;
4255 }
4256
4257  
4258 /* ------------------------------------------------------------------------
4259  
4260  
4261 interface Attr : Node {
4262 readonly attribute DOMString name;
4263 readonly attribute boolean specified;
4264 attribute DOMString value;
4265 # raises(DOMException) on setting
4266  
4267 # Introduced in DOM Level 2:
4268 readonly attribute Element ownerElement;
4269 };
4270  
4271 ------------------------------------------------------------------------ */
4272  
4273  
4274  
4275 /* ------------------------------------------------------------------------ */
4276 /* */
4277 /* Attr_selfValue */
4278 /* */
4279 /* */
4280 /* */
4281 /* ------------------------------------------------------------------------ */
4282  
4283  
4284  
4285 0 char * Attr_selfValue (/*in*/ tApp * a,
4286 /*in*/ tDomTree * pDomTree,
4287 /*in*/ struct tAttrData * pAttr,
4288 /*in*/ tRepeatLevel nRepeatLevel,
4289 /*out*/ char * * ppAttr)
4290  
4291 {
4292 struct tNodeData * pNode ;
4293 struct tNodeData * pAttrNode ;
4294 tIndex xFirstAttr ;
4295  
4296 ASSERT_ATTR_VALID(a,pAttr) ;
4297
4298 0 ▶ if (!pAttr || pAttr -> bFlags == aflgDeleted)
Branch: 2 branches
BranchTrueFalseTotal
if (!pAttr || pAttr -> bFlags == aflgDeleted) 0 0 0
if (!pAttr || pAttr -> bFlags == aflgDeleted) 0 0 0
4299 0 return NULL ;
4300 /* lprintf (a, "selvalue 1 f=%x a=%x aa=%x an=%d off=%d av=%d\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue) ; */
4301  
4302 0 pAttrNode = Attr_selfNode(pAttr) ;
4303 ASSERT_NODE_VALID(a,pAttrNode) ;
4304  
4305 /* lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ; */
4306  
4307
4308 0 ▶ pNode = Node_selfLevel (a, pDomTree, pAttrNode -> xNdx, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pNode = Node_selfLevel (a, pDomTree, pAttrNode -> xNdx, nRepeatLevel) ; 0 0 0
pNode = Node_selfLevel (a, pDomTree, pAttrNode -> xNdx, nRepeatLevel) ; 0 0 0
4309 ASSERT_NODE_VALID(a,pNode) ;
4310  
4311 /* lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d node=%x\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx, pNode) ;*/
4312
4313
4314 0 ▶ if (pNode != pAttrNode)
Branch: 1 branch
BranchTrueFalseTotal
if (pNode != pAttrNode) 0 0 0
4315 {
4316 0 pAttr = Element_selfGetAttribut (a, pDomTree, pNode, NULL, pAttr -> xName) ;
4317 0 ▶ if (!pAttr)
Branch: 1 branch
BranchTrueFalseTotal
if (!pAttr) 0 0 0
4318 0 return NULL ;
4319 }
4320 ASSERT_ATTR_VALID(a,pAttr) ;
4321 ASSERT_NODE_VALID(a,pNode) ;
4322 ASSERT_NODE_VALID(a,pAttrNode) ;
4323  
4324 /*lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ;*/
4325 0 ▶ if ((pAttr -> bFlags & aflgAttrChilds) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ((pAttr -> bFlags & aflgAttrChilds) == 0) 0 0 0
4326 0 return Ndx2String (pAttr -> xValue) ;
4327  
4328 0 ▶ pNode = Node_selfLevel (a, pDomTree, pAttr -> xValue, nRepeatLevel) ;
Branch: 2 branches
BranchTrueFalseTotal
pNode = Node_selfLevel (a, pDomTree, pAttr -> xValue, nRepeatLevel) ; 0 0 0
pNode = Node_selfLevel (a, pDomTree, pAttr -> xValue, nRepeatLevel) ; 0 0 0
4329
4330 0 StringNew (a, ppAttr, 512) ;
4331 0 xFirstAttr = pNode -> xNdx ;
4332
4333 0 ▶ while (pNode)
Branch: 1 branch
BranchTrueFalseTotal
while (pNode) 0 0 0
4334 {
4335 char * s ;
4336 int l ;
4337  
4338 ASSERT_NODE_VALID(a,pNode) ;
4339  
4340 /*lprintf (a, "selvalue f=%x node=%x nodendx=%d aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , pNode, pNode -> xNdx, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ;*/
4341  
4342 0 ▶ if ((pNode -> bFlags & nflgIgnore) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ((pNode -> bFlags & nflgIgnore) == 0) 0 0 0
4343 {
4344 0 Ndx2StringLen (pNode -> nText,s,l) ;
4345 0 StringAdd (a, ppAttr, s, l) ;
4346 }
4347 0 pNode = Node_selfNextSibling (a, pDomTree, pNode, nRepeatLevel) ;
4348 0 ▶ if (!pNode || pNode -> xNdx == xFirstAttr)
Branch: 2 branches
BranchTrueFalseTotal
if (!pNode || pNode -> xNdx == xFirstAttr) 0 0 0
if (!pNode || pNode -> xNdx == xFirstAttr) 0 0 0
4349 break ;
4350 }
4351  
4352 0 return *ppAttr ;
4353 }
« epdefault.c ↑ Summary epeval.c »