TagReader.xs

filter: Statementstmt 8.7% 18 / 207 Branchbran 1.3% 2 / 152 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 5.5% 20 / 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 300
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 0 static THEINLINE int is_start_of_tag(int ch){
61 0 ▶ if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 0 0 0
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 0 0 0
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 0 0 0
if (ch=='!' || ch=='/' || ch=='?' || isalnum(ch)){ 0 0 0
62 0 return(1);
63 }
64 0 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 int i;
77 char *str;
78 1 ▶ if (!SvPOKp(filename)){
Branch: 1 branch
BranchTrueFalseTotal
if (!SvPOKp(filename)){ 0 1 1
79 0 croak("ERROR: filename must be a string scalar");
80 }
81 /* malloc and zero the struct */
82 1 Newz(0, RETVAL, 1, struct trstuct );
83 1 str=SvPV(filename,i);
84 /* malloc */
85 1 New(0, RETVAL->filename, i+1, char );
86 1 strncpy(RETVAL->filename,str,i);
87 /* malloc initial buffer */
88 1 New(0, RETVAL->buffer, BUFFLEN+1, char );
89 1 RETVAL->currbuflen=BUFFLEN;
90 /* put a zero at the end of the string, perl might not do it */
91 1 *(RETVAL->filename + i )=(char)0;
92 1 RETVAL->fd=PerlIO_open(str,"r");
93 1 ▶ if (RETVAL->fd == NULL){
Branch: 1 branch
BranchTrueFalseTotal
if (RETVAL->fd == NULL){ 0 1 1
94 0 croak("ERROR: Can not read file \"%s\" ",str);
95 }
96 1 RETVAL->charpos=0;
97 1 RETVAL->tagcharpos=0;
98 1 RETVAL->fileline=1;
99 1 RETVAL->tagline=0;
100 OUTPUT:
101 RETVAL
102  
103 void
104 DESTROY(self)
105 HTML::TagReader self
106 CODE:
107 1 Safefree(self->filename);
108 1 Safefree(self->buffer);
109 1 PerlIO_close(self->fd);
110 1 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 0 ▶ if (! self->fileline){
Branch: 1 branch
BranchTrueFalseTotal
if (! self->fileline){ 0 0 0
123 0 croak("Object not initialized");
124 }
125 /* initialize */
126 0 state=0;
127 0 bufpos=0;
128 0 ch=(char)0;
129 0 chn=(char)0;
130 0 self->tagline=self->fileline;
131 /* find the next tag */
132 0 ▶ while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){
Branch: 2 branches
BranchTrueFalseTotal
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 0 0 0
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 0 0 0
133 0 self->charpos++;
134 0 ▶ 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 */ 0 0 0
135 0 ch=chn;
136 0 continue;
137 }
138 /* we can not run out of mem because TAGREADER_MAX_TAGLEN
139 * is much smaller than BUFFLEN */
140 0 ▶ if (bufpos > TAGREADER_MAX_TAGLEN){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos > TAGREADER_MAX_TAGLEN){ 0 0 0
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 0 ▶ if (ch=='\n') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='\n') { 0 0 0
150 0 self->fileline++;
151 0 self->charpos=0;
152 }
153 0 ▶ if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') {
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 0 0 0
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 0 0 0
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 0 0 0
if (ch=='\n'|| ch=='\r' || ch=='\t' || ch==' ') { 0 0 0
154 0 ch=' ';
155 0 ▶ if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){
Branch: 4 branches
BranchTrueFalseTotal
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 0 0 0
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 0 0 0
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 0 0 0
if (chn=='\n'|| chn=='\r' || chn=='\t' || chn==' '){ 0 0 0
156 /* delete mupltiple spaces */
157 0 ch=chn; /* shift next char */
158 0 continue;
159 }
160 }
161 0 switch (state) {
162 /*---*/
163 0 case 0:
164 /* outside of tag and we start tag here*/
165 0 ▶ if (ch=='<') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<') { 0 0 0
166 0 ▶ if (is_start_of_tag(chn)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_start_of_tag(chn)) { 0 0 0
167 0 self->buffer[0]=(char)0;
168 0 bufpos=0;
169 0 self->tagcharpos=self->charpos;
170 /*line where tag starts*/
171 0 self->tagline=self->fileline;
172 0 self->buffer[bufpos]=ch;bufpos++;
173 0 state=1;
174 }else{
175 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
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 0 break;
181 /*---*/
182 0 case 1:
183 0 self->buffer[bufpos]=ch;bufpos++;
184 0 ▶ if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){
Branch: 3 branches
BranchTrueFalseTotal
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 0 0 0
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 0 0 0
if (ch=='!' && chn=='-' && self->buffer[bufpos-2]=='<'){ 0 0 0
185 /* start of comment handling */
186 0 state=30;
187 }
188 0 ▶ if (ch=='>'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>'){ 0 0 0
189 0 state=3; /* note the exit state is hardcoded
190 * as well in the while loop above */
191 0 self->buffer[bufpos]=(char)0;bufpos++;
192 }
193 0 ▶ if(ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if(ch=='<'){ 0 0 0
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 0 break;
204 /*---*/
205 0 case 30: /*comment handling,
206 *we have found "<!--", wait for
207 *comment termination with "->" */
208 0 ▶ if(ch=='-' && chn=='>'){
Branch: 2 branches
BranchTrueFalseTotal
if(ch=='-' && chn=='>'){ 0 0 0
if(ch=='-' && chn=='>'){ 0 0 0
209 /* done reading this comment tag
210 * just get the closing '>'*/
211 0 state=31;
212 }
213 0 break;
214 /*---*/
215 0 case 31:
216 /* done reading this comment tag */
217 0 state=0;
218 0 self->buffer[0]=(char)0; /* zero buffer*/
219 0 bufpos=0;
220 0 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 0 ch=chn;
228 }
229 /* put back chn for the next round */
230 0 self->charpos--;
231 0 ▶ if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 2 branches
BranchTrueFalseTotal
if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){ 0 0 0
if (chn!=EOF && PerlIO_ungetc(self->fd,chn)==EOF){ 0 0 0
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 0 ▶ if (state == 3){
Branch: 1 branch
BranchTrueFalseTotal
if (state == 3){ 0 0 0
237 /* we have found a tag */
238 0 ▶ if(GIMME == G_ARRAY){
Branch: 2 branches
BranchTrueFalseTotal
if(GIMME == G_ARRAY){ 0 0 0
if(GIMME == G_ARRAY){ 0 0 0
239 0 ▶ EXTEND(SP,3);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,3); 0 0 0
240 0 XST_mPV(0,self->buffer);
241 0 XST_mIV(1,self->tagline);
242 0 XST_mIV(2,self->tagcharpos);
243 0 XSRETURN(3);
244 }else{
245 0 ▶ EXTEND(SP,1);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,1); 0 0 0
246 0 XST_mPV(0,self->buffer);
247 0 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 0 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 0 ▶ if (! self->fileline){
Branch: 1 branch
BranchTrueFalseTotal
if (! self->fileline){ 0 0 0
270 0 croak("Object not initialized");
271 }
272 /* initialize */
273 0 state=0;
274 0 bufpos=0;
275 0 typeposdone=0;
276 0 typepos=0;
277 0 self->buffer[bufpos]=(char)0;
278 0 self->tagline=self->fileline;
279 0 self->tagtype[typepos]=(char)0;
280 0 ch=(char)0;chn=(char)0;
281 /* find the next tag */
282 0 ▶ while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){
Branch: 2 branches
BranchTrueFalseTotal
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 0 0 0
while(state != 3 && (chn=PerlIO_getc(self->fd))!=EOF ){ 0 0 0
283 0 self->charpos++;
284 0 ▶ 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 */ 0 0 0
285 0 ch=chn;
286 0 continue;
287 }
288 0 ▶ if (ch=='\n') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='\n') { 0 0 0
289 0 self->fileline++;
290 0 self->charpos=0;
291 }
292 //printf("DBG ch%c chn%c state%d\n",ch ,chn,state);
293 0 self->buffer[bufpos]=ch;bufpos++;
294 0 switch (state) {
295 /*---*/
296 0 case 0:
297 0 self->tagcharpos=self->charpos;
298 0 ▶ if (ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<'){ 0 0 0
299 0 ▶ if ( is_start_of_tag(chn)) {
Branch: 1 branch
BranchTrueFalseTotal
if ( is_start_of_tag(chn)) { 0 0 0
300 0 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 0 state=2; /* we will be reading a text/paragraph */
309 }
310 0 break;
311 /*---*/
312 0 case 1:
313 /* inside a tag. Wait for '>' */
314 0 ▶ if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){
Branch: 2 branches
BranchTrueFalseTotal
if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){ 0 0 0
if (typeposdone==0 && typepos < TAGREADER_TAGTYPELEN -1 ){ 0 0 0
315 0 ▶ if (is_start_of_tag(ch)){
Branch: 1 branch
BranchTrueFalseTotal
if (is_start_of_tag(ch)){ 0 0 0
316 0 self->tagtype[typepos]=tolower(ch);typepos++;
317 }else{
318 /* end of tag type e.g "<a " -> save only "a" in
319 * tagtype array */
320 0 self->tagtype[typepos]=(char)0;
321 0 typeposdone=1; /* mark end */
322 }
323 }
324 0 ▶ if (ch=='<' && SvTRUE(showerrors)) {
Branch: 2 branches
BranchTrueFalseTotal
if (ch=='<' && SvTRUE(showerrors)) { 0 0 0
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 0 ▶ if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){
Branch: 2 branches
BranchTrueFalseTotal
if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){ 0 0 0
if (SvTRUE(showerrors) && bufpos > TAGREADER_MAX_TAGLEN){ 0 0 0
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 0 ▶ if (ch=='>') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>') { 0 0 0
332 /* done reading this tag */
333 0 state=3;
334 }
335 0 ▶ if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){
Branch: 4 branches
BranchTrueFalseTotal
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 0 0 0
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 0 0 0
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 0 0 0
if (ch=='!' && chn=='-' && bufpos > 1 && self->buffer[bufpos-2]=='<'){ 0 0 0
336 /* start of comment handling */
337 0 state=30;
338 /* some comments are <!-----, but we want always
339 * the same tagtype for all comments: */
340 0 strcpy(&(self->tagtype[0]),"!--");
341 0 typepos=3;
342 }
343 0 break;
344 /*---*/
345 0 case 2:
346 /* inside a text. Wait for start of tag */
347 0 ▶ if (ch=='>') {
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='>') { 0 0 0
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 0 ▶ if (ch=='<'){
Branch: 1 branch
BranchTrueFalseTotal
if (ch=='<'){ 0 0 0
353 0 ▶ if ( is_start_of_tag(chn)) { /* first char */
Branch: 1 branch
BranchTrueFalseTotal
if ( is_start_of_tag(chn)) { /* first char */ 0 0 0
354 /* put the start of tag back, we want to
355 * return only the text part */
356 0 self->charpos--;
357 0 ▶ if (PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (PerlIO_ungetc(self->fd,chn)==EOF){ 0 0 0
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 0 chn=ch;
362 0 bufpos--;
363 0 state=3;
364 }else{
365 0 state=2; /* we will be reading a text/paragraph */
366 0 ▶ if (SvTRUE(showerrors)){
Branch: 1 branch
BranchTrueFalseTotal
if (SvTRUE(showerrors)){ 0 0 0
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 0 break;
372 /*---*/
373 0 case 30: /*comment handling,
374 *we have found "<!--", wait for
375 *comment termination with "->" */
376 0 ▶ if(ch=='-' && chn=='>'){
Branch: 2 branches
BranchTrueFalseTotal
if(ch=='-' && chn=='>'){ 0 0 0
if(ch=='-' && chn=='>'){ 0 0 0
377 /* done reading this comment tag
378 * just get the closing '>'*/
379 0 state=31;
380 }
381 0 break;
382 /*---*/
383 0 case 31:
384 /* done reading this comment tag */
385 0 state=3;
386 0 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 0 ch=chn;
394 0 ▶ if (bufpos > self->currbuflen - 3){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos > self->currbuflen - 3){ 0 0 0
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 0 ▶ if (chn==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (chn==EOF){ 0 0 0
401 /* put the last char (ch) in the buffer */
402 0 ▶ if (ch) {
Branch: 1 branch
BranchTrueFalseTotal
if (ch) { 0 0 0
403 0 self->buffer[bufpos]=ch;bufpos++;
404 }
405 }else{
406 /* put back chn for the next round */
407 0 self->charpos--;
408 0 ▶ if (PerlIO_ungetc(self->fd,chn)==EOF){
Branch: 1 branch
BranchTrueFalseTotal
if (PerlIO_ungetc(self->fd,chn)==EOF){ 0 0 0
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 0 self->buffer[bufpos]=(char)0;
415 0 self->tagtype[typepos]=(char)0;
416 /* state == 3 is here or eof */
417 0 ▶ if (bufpos>0){
Branch: 1 branch
BranchTrueFalseTotal
if (bufpos>0){ 0 0 0
418 /* we have a tag or text and we return it */
419 0 ▶ if(GIMME == G_ARRAY){
Branch: 2 branches
BranchTrueFalseTotal
if(GIMME == G_ARRAY){ 0 0 0
if(GIMME == G_ARRAY){ 0 0 0
420 0 ▶ EXTEND(SP,4);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,4); 0 0 0
421 0 XST_mPV(0,self->buffer);
422 0 XST_mPV(1,self->tagtype);
423 0 XST_mIV(2,self->tagline);
424 0 XST_mIV(3,self->tagcharpos);
425 0 XSRETURN(4);
426 }else{
427 0 ▶ EXTEND(SP,1);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP,1); 0 0 0
428 0 XST_mPV(0,self->buffer);
429 0 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 0 XSRETURN_EMPTY;
437 }
438  
439 /* end of file */
↑ Summary blib/lib/HTML/TagReader.pm »