ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/UUlib.xs
(Generate patch)

Comparing Convert-UUlib/UUlib.xs (file contents):
Revision 1.4 by root, Sun Mar 31 20:19:09 2002 UTC vs.
Revision 1.5 by root, Sun Mar 31 21:42:35 2002 UTC

179 PUTBACK; FREETMPS; LEAVE; 179 PUTBACK; FREETMPS; LEAVE;
180 180
181 return retval; 181 return retval;
182} 182}
183 183
184static char *uu_filename_callback (void *cb, char *subject, char *filename)
185{
186 dSP;
187 int count;
188 SV *retval;
189 STRLEN dc;
190
191 ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,3);
192
193 PUSHs(sv_2mortal(newSVpv(subject, 0)));
194 PUSHs(filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef);
195
196 PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN;
197
198 if (count > 1)
199 croak ("filenamecallback perl callback returned more than one argument");
200
201 if (count)
202 {
203 _FP_free (filename);
204
205 retval = POPs;
206
207 if (SvOK (retval))
208 {
209 STRLEN len;
210 char *fn = SvPV (retval, len);
211
212 filename = malloc (len + 1);
213
214 if (filename)
215 {
216 memcpy (filename, fn, len);
217 filename[len] = 0;
218 }
219 }
220 else
221 filename = 0;
222 }
223
224 PUTBACK; FREETMPS; LEAVE;
225
226 return filename;
227}
228
184static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv; 229static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv;
185 230
186#define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL 231#define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL
187 232
188static int uu_info_file(void *cb, char *info) 233static int uu_info_file(void *cb, char *info)
189{ 234{
317void 362void
318UUSetFNameFilter(func=0) 363UUSetFNameFilter(func=0)
319 SV * func 364 SV * func
320 CODE: 365 CODE:
321 UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); 366 UUSetFNameFilter (FUNC_CB(uu_fnamefilter));
367
368void
369UUSetFileNameCallback(func=0)
370 SV * func
371 CODE:
372 UUSetFileNameCallback (FUNC_CB(uu_filename));
322 373
323char * 374char *
324UUFNameFilter(fname) 375UUFNameFilter(fname)
325 char * fname 376 char * fname
326 377
575 p = p->NEXT; 626 p = p->NEXT;
576 } 627 }
577 } 628 }
578 629
579BOOT: 630BOOT:
580uu_msg_sv = newSVsv(&PL_sv_undef); 631 uu_msg_sv = newSVsv(&PL_sv_undef);
581uu_busy_sv = newSVsv(&PL_sv_undef); 632 uu_busy_sv = newSVsv(&PL_sv_undef);
582uu_file_sv = newSVsv(&PL_sv_undef); 633 uu_file_sv = newSVsv(&PL_sv_undef);
583uu_fnamefilter_sv = newSVsv(&PL_sv_undef); 634 uu_fnamefilter_sv = newSVsv(&PL_sv_undef);
635 uu_filename_sv = newSVsv(&PL_sv_undef);
584 636

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines