TagReader.xs

filter: Statementstmt 80.6% 167 / 207 Branchbran 73.6% 112 / 152 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 77.7% 279 / 359 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/HTML/TagReader.pm »
1 /* vim: set sw=8 ts=8 si noet: */
2  
3 /* written by Guido Socher.
4 *
5 * This program is free software; you can redistribute it
6 * and/or modify it under the same terms as Perl itself.
7 */
8  
9 /* read the following man pages to learn how to use XS and access
10 * perl from C:
11 * perlxs Perl XS application programming interface
12 * perlxstut Perl XS tutorial
13 * perlguts Perl internal functions, variables, data structures for
14 * C programmer
15 * perlcall Perl calling conventions from C
16 */
17  
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 #include "EXTERN.h"
22 #include "perl.h"
23 #include "XSUB.h"
24 #include <stdio.h>
25 #include <string.h>
26 #include <ctype.h>
27 #ifdef __cplusplus
28 }
29 #endif
30  
31  
32 /* tags longer than TAGREADER_MAX_TAGLEN produce a warning about
33 * not terminated tags, must be much smaler than BUFFLEN */
34 #define TAGREADER_MAX_TAGLEN 400
35 /* BUFFLEN is the units in which we re-allocate mem, must be much bigger than
36 * TAGREADER_MAX_TAGLEN */
37 #define BUFFLEN 6000
38 #define TAGREADER_TAGTYPELEN 20
39  
40 typedef struct trstuct{
41 char *filename;
42 int fileline;
43 int tagline; /* file line where the tag starts */
44 int charpos; /* character pos in the line */
45 int tagcharpos; /* character pos where tag starts */
46 int currbuflen;
47 PerlIO *fd;
48 char tagtype[TAGREADER_TAGTYPELEN + 1];
49 char *buffer;
50 } *HTML__TagReader;
51  
52 /* WIN32 stuff from: DH <crazyinsomniac at yahoo.com>,
53 * http://testers.cpan.org/ */
54 #ifdef WIN32
55 #define THEINLINE __forceinline
56 #else
57 #define THEINLINE inline
58 #endif
59 /* start of a html tag (first char in the tag) */
60 100 static THEINLINE int is_start_of_tag(int ch){
61 100 ▶ if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 90 10 100
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 84 6 90
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 84 0 84
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 68 16 84
62 84 return(1);
63 }
64 16 return(0);
65 }
66  
67 MODULE = HTML::TagReader PACKAGE = HTML::TagReader PREFIX = tr_
68  
69 PROTOTYPES: ENABLE
70  
71 HTML::TagReader
72 tr_new(class, filename)
73 SV *class
74 SV *filename
75 CODE:
76 STRLEN i; // int
77 char *str;
78 3 ▶ if (!SvPOKp(filename)){
Branch: 1 branch
BranchTrueFalseTotal
if (!SvPOKp(filename)){ 0 3 3
79 0 croak("ERROR: filename must be a string scalar");
80 }
81 /* malloc and zero the struct */
82 3 Newz(0, RETVAL, 1, struct trstuct );
83 3 str=SvPV(filename,i);
84 /* malloc */
85 3 New(0, RETVAL->filename, i+1, char );
86 3 strncpy(RETVAL->filename,str,i);
87 /* malloc initial buffer */
88 3 New(0, RETVAL->buffer, BUFFLEN+1, char );
89 3 RETVAL->currbuflen=BUFFLEN;
90 /* put a zero at the end of the string, perl might not do it */
91 3 *(RETVAL->filename + i )=(char)0;
92 3 RETVAL->fd=PerlIO_open(str,"r");
93 3 ▶ if (RETVAL->fd == NULL){
Branch: 1 branch
BranchTrueFalseTotal
if (RETVAL->fd == NULL){ 0 3 3
94 0 croak("ERROR: Can not read file \"%s\" ",str);
95 }
96 3 RETVAL->charpos=0;
97 3 RETVAL->tagcharpos=0;
98 3 RETVAL->fileline=1;
99 3 RETVAL->tagline=0;
100 OUTPUT:
101 RETVAL
102  
103 void
104 DESTROY(self)
105 HTML::TagReader self
106 CODE:
107 3 Safefree(self->filename);
108 3 Safefree(self->buffer);
109 3 PerlIO_close(self->fd);
110 3 Safefree(self);
111  
112 void
113 tr_gettag(self,showerrors)
114 HTML::TagReader self
115 SV *showerrors
116 PREINIT:
117 int bufpos;
118 char ch;
119 char chn;
120 int state;
121 PPCODE:
122 4 ▶ if (! self->fileline){
Branch: 1 branch
BranchTrueFalseTotal
if (! self->fileline){ 0 4 4
123 0 croak("Object not initialized");
124 }
125 /* initialize */
126 4 state=0;
127 4 bufpos=0;
128 4 ch=(char)0;
129 4 chn=(char)0;
130 4 self->tagline=self->fileline;
131 /* find the next tag */
132 74 ▶ while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){
Branch: 2 branches
BranchTrueFalseTotal
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 72 2 74
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 70 2 72
133 70 self->charpos++;
134 70 ▶ if (ch==0){ /* read one more character ahead so we have always 2 */
Branch: 1 branch
BranchTrueFalseTotal
if (ch==0){ /* read one more character ahead so we have always 2 */ 3 67 70
135 3 ch=chn;
136 3 continue;
137 }
138 /* we can not run out of mem because TAGREADER_MAX_TAGLEN
139 * is much smaller than BUFFLEN */
140 67 ▶ if (bufpos > TAGREADER_MAX_TAGLEN){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos > TAGREADER_MAX_TAGLEN){ 0 67 67
141 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
142 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, tag not terminated or too long.\n",self->filename,self->tagline,self->charpos);
143 }
144 0 self->buffer[bufpos]=ch;bufpos++;
145 0 self->buffer[bufpos]=(char)0;bufpos++;
146 0 state=3;
147 0 continue; /* jump out of while */
148 }
149 67 ▶ if (ch=='\n') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='\n') { 3 64 67
150 3 self->fileline++;
151 3 self->charpos=0;
152 }
153 67 ▶ if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') {
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 64 3 67
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 64 0 64
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 63 1 64
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 7 56 63
154 11 ch=' ';
155 11 ▶ if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){
Branch: 4 branches
BranchTrueFalseTotal
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 10 1 11
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 10 0 10
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 9 1 10
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 1 8 9
156 /* delete mupltiple spaces */
157 3 ch=chn; /* shift next char */
158 3 continue;
159 }
160 }
161 64 switch (state) {
162 /*---*/
163 11 case 0:
164 /* outside of tag and we start tag here*/
165 11 ▶ if (ch=='<') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<') { 4 7 11
166 4 ▶ if (is_start_of_tag(chn)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_start_of_tag(chn)) { 3 1 4
167 3 self->buffer[0]=(char)0;
168 3 bufpos=0;
169 3 self->tagcharpos=self->charpos;
170 /*line where tag starts*/
171 3 self->tagline=self->fileline;
172 3 self->buffer[bufpos]=ch;bufpos++;
173 3 state=1;
174 }else{
175 1 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 1 1
176 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, single \'<\' should be written as &lt;\n",self->filename,self->fileline,self->charpos);
177 }
178 }
179 }
180 11 break;
181 /*---*/
182 38 case 1:
183 38 self->buffer[bufpos]=ch;bufpos++;
184 38 ▶ if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){
Branch: 3 branches
BranchTrueFalseTotal
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 1 37 38
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 1 0 1
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 1 0 1
185 /* start of comment handling */
186 1 state=30;
187 }
188 38 ▶ if (ch=='>'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>'){ 2 36 38
189 2 state=3; /* note the exit state is hardcoded
190 * as well in the while loop above */
191 2 self->buffer[bufpos]=(char)0;bufpos++;
192 }
193 38 ▶ if(ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if(ch=='<'){ 0 38 38
194 /* the tag that we were reading was not terminated but instead we ge a new opening */
195 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
196 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, \'>\' inside a tag should be written as &gt;\n",self->filename,self->tagline,self->charpos);
197 }
198 0 state=1;
199 0 bufpos=0;
200 0 self->buffer[bufpos]=ch;bufpos++;
201 0 self->tagline=self->fileline;
202 }
203 38 break;
204 /*---*/
205 14 case 30: /*comment handling,
206 *we have found "<!--", wait for
207 *comment termination with "->" */
208 14 ▶ if(ch=='-' && chn=='>'){
Branch: 2 branches
BranchTrueFalseTotal
if(ch=='-' && chn=='>'){ 8 6 14
if(ch=='-' && chn=='>'){ 1 7 8
209 /* done reading this comment tag
210 * just get the closing '>'*/
211 1 state=31;
212 }
213 14 break;
214 /*---*/
215 1 case 31:
216 /* done reading this comment tag */
217 1 state=0;
218 1 self->buffer[0]=(char)0; /* zero buffer*/
219 1 bufpos=0;
220 1 break;
221 /*---*/
222 0 default:
223 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: Programm Error, state = %d\n",self->filename,self->fileline,state);
224 0 exit(1);
225 }
226 /* shift this and next char */
227 64 ch=chn;
228 }
229 /* put back chn for the next round */
230 4 self->charpos--;
231 4 ▶ if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 2 branches
BranchTrueFalseTotal
if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){ 2 2 4
if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){ 0 2 2
232 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: ERROR, TagReader library can not ungetc \"%c\" before returning\n",self->filename,self->fileline,chn);
233 0 exit(1);
234 }
235 /* buffer was already terminated above */
236 4 ▶ if (state == 3){
Branch: 1 branch
BranchTrueFalseTotal
if (state == 3){ 2 2 4
237 /* we have found a tag */
238 2 ▶ if(GIMME == G_ARRAY){
Branch: 2 branches
BranchTrueFalseTotal
if(GIMME == G_ARRAY){ 2 0 2
if(GIMME == G_ARRAY){ 1 1 2
239 1 ▶ EXTEND(SP,3);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,3); 0 1 1
240 1 XST_mPV(0,self->buffer);
241 1 XST_mIV(1,self->tagline);
242 1 XST_mIV(2,self->tagcharpos);
243 1 XSRETURN(3);
244 }else{
245 1 ▶ EXTEND(SP,1);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,1); 0 1 1
246 1 XST_mPV(0,self->buffer);
247 1 XSRETURN(1);
248 }
249 }else{
250 /* we are at the end of the file and no tag was found
251 * return an empty list or string such that the user
252 * will probably call destroy.
253 */
254 2 XSRETURN_EMPTY;
255 }
256  
257 void
258 tr_getbytoken(self,showerrors)
259 HTML::TagReader self
260 SV *showerrors
261 PREINIT:
262 int bufpos;
263 char ch;
264 char chn; /* next character */
265 int typepos;
266 int typeposdone;
267 int state;
268 PPCODE:
269 27 ▶ if (! self->fileline){
Branch: 1 branch
BranchTrueFalseTotal
if (! self->fileline){ 0 27 27
270 0 croak("Object not initialized");
271 }
272 /* initialize */
273 27 state=0;
274 27 bufpos=0;
275 27 typeposdone=0;
276 27 typepos=0;
277 27 self->buffer[bufpos]=(char)0;
278 27 self->tagline=self->fileline;
279 27 self->tagtype[typepos]=(char)0;
280 27 ch=(char)0;chn=(char)0;
281 /* find the next tag */
282 240 ▶ while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){
Branch: 2 branches
BranchTrueFalseTotal
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 217 23 240
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 213 4 217
283 213 self->charpos++;
284 213 ▶ if (ch==0){ /* read one more character ahead so we have always 2 */
Branch: 1 branch
BranchTrueFalseTotal
if (ch==0){ /* read one more character ahead so we have always 2 */ 25 188 213
285 25 ch=chn;
286 25 continue;
287 }
288 188 ▶ if (ch=='\n') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='\n') { 8 180 188
289 8 self->fileline++;
290 8 self->charpos=0;
291 }
292 //printf("DBG ch%c chn%c state%d\n",ch ,chn,state);
293 188 self->buffer[bufpos]=ch;bufpos++;
294 188 switch (state) {
295 /*---*/
296 23 case 0:
297 23 self->tagcharpos=self->charpos;
298 23 ▶ if (ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<'){ 14 9 23
299 14 ▶ if ( is_start_of_tag(chn)) {
Branch: 1 branch
BranchTrueFalseTotal
if ( is_start_of_tag(chn)) { 14 0 14
300 14 state=1; /* we will be reading a tag */
301 }else{
302 0 state=2; /* we will be reading a text/paragraph */
303 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
304 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, single \'<\' should be written as &lt;\n",self->filename,self->fileline,self->charpos);
305 }
306 }
307 }else{
308 9 state=2; /* we will be reading a text/paragraph */
309 }
310 23 break;
311 /*---*/
312 122 case 1:
313 /* inside a tag. Wait for '>' */
314 122 ▶ if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){
Branch: 2 branches
BranchTrueFalseTotal
if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){ 71 51 122
if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){ 71 0 71
315 71 ▶ if (is_start_of_tag(ch)){
Branch: 1 branch
BranchTrueFalseTotal
if (is_start_of_tag(ch)){ 58 13 71
316 58 self->tagtype[typepos]=tolower(ch);typepos++;
317 }else{
318 /* end of tag type e.g "<a " -> save only "a" in
319 * tagtype array */
320 13 self->tagtype[typepos]=(char)0;
321 13 typeposdone=1; /* mark end */
322 }
323 }
324 122 ▶ if (ch=='<' && SvTRUE(showerrors)) {
Branch: 2 branches
BranchTrueFalseTotal
if (ch=='<' && SvTRUE(showerrors)) { 0 122 122
if (ch=='<' && SvTRUE(showerrors)) { 0 0 0
325 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: Warning, single \'<\' or tag starting at line %d not terminated\n",self->filename,self->fileline,self->tagline);
326 }
327 122 ▶ if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){
Branch: 2 branches
BranchTrueFalseTotal
if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){ 81 41 122
if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){ 0 81 81
328 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: Warning, tag not terminated or too long.\n",self->filename,self->tagline);
329 0 state=3;
330 }
331 122 ▶ if (ch=='>') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>') { 13 109 122
332 /* done reading this tag */
333 13 state=3;
334 }
335 122 ▶ if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 3 119 122
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 1 2 3
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 1 0 1
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 1 0 1
336 /* start of comment handling */
337 1 state=30;
338 /* some comments are <!-----, but we want always
339 * the same tagtype for all comments: */
340 1 strcpy(&(self->tagtype[0]),"!--");
341 1 typepos=3;
342 }
343 122 break;
344 /*---*/
345 27 case 2:
346 /* inside a text. Wait for start of tag */
347 27 ▶ if (ch=='>') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>') { 0 27 27
348 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
349 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, single \'>\' should be written as &gt;\n",self->filename,self->fileline,self->charpos);
350 }
351 }
352 27 ▶ if (ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<'){ 11 16 27
353 11 ▶ if ( is_start_of_tag(chn)) { /* first char */
Branch: 1 branch
BranchTrueFalseTotal
if ( is_start_of_tag(chn)) { /* first char */ 9 2 11
354 /* put the start of tag back, we want to
355 * return only the text part */
356 9 self->charpos--;
357 9 ▶ if (PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (PerlIO_ungetc(self->fd,chn)==EOF){ 0 9 9
358 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: ERROR, TagReader library can not ungetc \"%c\"\n",self->filename,self->fileline,chn);
359 0 exit(1);
360 }
361 9 chn=ch;
362 9 bufpos--;
363 9 state=3;
364 }else{
365 2 state=2; /* we will be reading a text/paragraph */
366 2 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 2 2
367 0 PerlIO_printf(PerlIO_stderr(),"%s:%d:%d: Warning, single \'<\' should be written as &lt;\n",self->filename,self->fileline,self->charpos);
368 }
369 }
370 }
371 27 break;
372 /*---*/
373 15 case 30: /*comment handling,
374 *we have found "<!--", wait for
375 *comment termination with "->" */
376 15 ▶ if(ch=='-' && chn=='>'){
Branch: 2 branches
BranchTrueFalseTotal
if(ch=='-' && chn=='>'){ 9 6 15
if(ch=='-' && chn=='>'){ 1 8 9
377 /* done reading this comment tag
378 * just get the closing '>'*/
379 1 state=31;
380 }
381 15 break;
382 /*---*/
383 1 case 31:
384 /* done reading this comment tag */
385 1 state=3;
386 1 break;
387 /*---*/
388 0 default:
389 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: Programm Error, state = %d\n",self->filename,self->fileline,state);
390 0 exit(1);
391 }
392 /* shift this and next char */
393 188 ch=chn;
394 188 ▶ if (bufpos > self->currbuflen - 3){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos > self->currbuflen - 3){ 0 188 188
395 /* we need more memory */
396 0 Renew(self->buffer, self->currbuflen + BUFFLEN + 1, char );
397 0 self->currbuflen+=BUFFLEN;
398 }
399 } /* end of while */
400 27 ▶ if (chn==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (chn==EOF){ 4 23 27
401 /* put the last char (ch) in the buffer */
402 4 ▶ if (ch) {
Branch: 1 branch
BranchTrueFalseTotal
if (ch) { 2 2 4
403 2 self->buffer[bufpos]=ch;bufpos++;
404 }
405 }else{
406 /* put back chn for the next round */
407 23 self->charpos--;
408 23 ▶ if (PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (PerlIO_ungetc(self->fd,chn)==EOF){ 0 23 23
409 0 PerlIO_printf(PerlIO_stderr(),"%s:%d: ERROR, TagReader library can not ungetc \"%c\" before returning\n",self->filename,self->fileline,chn);
410 0 exit(1);
411 }
412 }
413 /* terminate buffer*/
414 27 self->buffer[bufpos]=(char)0;
415 27 self->tagtype[typepos]=(char)0;
416 /* state == 3 is here or eof */
417 27 ▶ if (bufpos>0){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos>0){ 25 2 27
418 /* we have a tag or text and we return it */
419 25 ▶ if(GIMME == G_ARRAY){
Branch: 2 branches
BranchTrueFalseTotal
if(GIMME == G_ARRAY){ 25 0 25
if(GIMME == G_ARRAY){ 24 1 25
420 24 ▶ EXTEND(SP,4);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,4); 0 24 24
421 24 XST_mPV(0,self->buffer);
422 24 XST_mPV(1,self->tagtype);
423 24 XST_mIV(2,self->tagline);
424 24 XST_mIV(3,self->tagcharpos);
425 24 XSRETURN(4);
426 }else{
427 1 ▶ EXTEND(SP,1);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,1); 0 1 1
428 1 XST_mPV(0,self->buffer);
429 1 XSRETURN(1);
430 }
431 }else{
432 /* we are at the end of the file and no tag was found
433 * return an empty list or string such that the user
434 * will probably call destroy.
435 */
436 2 XSRETURN_EMPTY;
437 }
438  
439 /* end of file */
↑ Summary blib/lib/HTML/TagReader.pm »