… | |
… | |
82 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
82 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
83 | case 'U': |
83 | case 'U': |
84 | if (strEQ(name, "UU_ENCODED")) return UU_ENCODED; |
84 | if (strEQ(name, "UU_ENCODED")) return UU_ENCODED; |
85 | case 'X': |
85 | case 'X': |
86 | if (strEQ(name, "XX_ENCODED")) return XX_ENCODED; |
86 | if (strEQ(name, "XX_ENCODED")) return XX_ENCODED; |
|
|
87 | case 'Y': |
|
|
88 | if (strEQ(name, "YENC_ENCODED")) return YENC_ENCODED; |
87 | } |
89 | } |
88 | errno = EINVAL; |
90 | errno = EINVAL; |
89 | return 0; |
91 | return 0; |
90 | } |
92 | } |
91 | |
93 | |
… | |
… | |
142 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
144 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
143 | |
145 | |
144 | if (count != 1) |
146 | if (count != 1) |
145 | croak ("fnamefilter perl callback returned more than one argument"); |
147 | croak ("fnamefilter perl callback returned more than one argument"); |
146 | |
148 | |
147 | FP_free(str); str = FP_strdup (POPp); |
149 | _FP_free(str); str = _FP_strdup (POPp); |
148 | |
150 | |
149 | PUTBACK; FREETMPS; LEAVE; |
151 | PUTBACK; FREETMPS; LEAVE; |
150 | |
152 | |
151 | return str; |
153 | return str; |
152 | } |
154 | } |
… | |
… | |
177 | PUTBACK; FREETMPS; LEAVE; |
179 | PUTBACK; FREETMPS; LEAVE; |
178 | |
180 | |
179 | return retval; |
181 | return retval; |
180 | } |
182 | } |
181 | |
183 | |
|
|
184 | static 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 | |
182 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv; |
229 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
183 | |
230 | |
184 | #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 |
185 | |
232 | |
186 | static int uu_info_file(void *cb, char *info) |
233 | static int uu_info_file(void *cb, char *info) |
187 | { |
234 | { |
… | |
… | |
315 | void |
362 | void |
316 | UUSetFNameFilter(func=0) |
363 | UUSetFNameFilter(func=0) |
317 | SV * func |
364 | SV * func |
318 | CODE: |
365 | CODE: |
319 | UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); |
366 | UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); |
|
|
367 | |
|
|
368 | void |
|
|
369 | UUSetFileNameCallback(func=0) |
|
|
370 | SV * func |
|
|
371 | CODE: |
|
|
372 | UUSetFileNameCallback (FUNC_CB(uu_filename)); |
320 | |
373 | |
321 | char * |
374 | char * |
322 | UUFNameFilter(fname) |
375 | UUFNameFilter(fname) |
323 | char * fname |
376 | char * fname |
324 | |
377 | |
… | |
… | |
497 | uulist *li |
550 | uulist *li |
498 | char * newfilename |
551 | char * newfilename |
499 | CODE: |
552 | CODE: |
500 | if (newfilename) |
553 | if (newfilename) |
501 | { |
554 | { |
502 | FP_free (li->filename); |
555 | _FP_free (li->filename); |
503 | li->filename = FP_strdup (newfilename); |
556 | li->filename = _FP_strdup (newfilename); |
504 | } |
557 | } |
505 | RETVAL = li->filename; |
558 | RETVAL = li->filename; |
506 | OUTPUT: |
559 | OUTPUT: |
507 | RETVAL |
560 | RETVAL |
508 | |
561 | |
… | |
… | |
573 | p = p->NEXT; |
626 | p = p->NEXT; |
574 | } |
627 | } |
575 | } |
628 | } |
576 | |
629 | |
577 | BOOT: |
630 | BOOT: |
578 | uu_msg_sv = newSVsv(&PL_sv_undef); |
631 | uu_msg_sv = newSVsv(&PL_sv_undef); |
579 | uu_busy_sv = newSVsv(&PL_sv_undef); |
632 | uu_busy_sv = newSVsv(&PL_sv_undef); |
580 | uu_file_sv = newSVsv(&PL_sv_undef); |
633 | uu_file_sv = newSVsv(&PL_sv_undef); |
581 | uu_fnamefilter_sv = newSVsv(&PL_sv_undef); |
634 | uu_fnamefilter_sv = newSVsv(&PL_sv_undef); |
|
|
635 | uu_filename_sv = newSVsv(&PL_sv_undef); |
582 | |
636 | |