1 |
root |
1.1 |
#include "EXTERN.h" |
2 |
|
|
#include "perl.h" |
3 |
|
|
#include "XSUB.h" |
4 |
|
|
|
5 |
root |
1.17 |
#include "perlmulticore.h" |
6 |
|
|
|
7 |
root |
1.1 |
#include "uulib/fptools.h" |
8 |
root |
1.2 |
#include "uulib/uudeview.h" |
9 |
root |
1.1 |
#include "uulib/uuint.h" |
10 |
|
|
|
11 |
root |
1.19 |
static int perlinterp_released; |
12 |
root |
1.17 |
|
13 |
root |
1.19 |
#define RELEASE do { perlinterp_released = 1; perlinterp_release (); } while (0) |
14 |
|
|
#define ACQUIRE do { perlinterp_acquire (); perlinterp_released = 0; } while (0) |
15 |
root |
1.17 |
|
16 |
root |
1.19 |
#define TEMP_ACQUIRE if (perlinterp_released) perlinterp_acquire (); |
17 |
|
|
#define TEMP_RELEASE if (perlinterp_released) perlinterp_release (); |
18 |
root |
1.17 |
|
19 |
root |
1.8 |
static void |
20 |
|
|
uu_msg_callback (void *cb, char *msg, int level) |
21 |
root |
1.1 |
{ |
22 |
root |
1.17 |
TEMP_ACQUIRE { |
23 |
|
|
|
24 |
root |
1.19 |
dSP; |
25 |
|
|
|
26 |
|
|
ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
27 |
root |
1.1 |
|
28 |
root |
1.19 |
PUSHs (sv_2mortal (newSVpv (msg, 0))); |
29 |
|
|
PUSHs (sv_2mortal (newSViv (level))); |
30 |
root |
1.1 |
|
31 |
root |
1.19 |
PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; |
32 |
|
|
PUTBACK; FREETMPS; LEAVE; |
33 |
root |
1.17 |
|
34 |
|
|
} TEMP_RELEASE; |
35 |
root |
1.1 |
} |
36 |
|
|
|
37 |
root |
1.8 |
static int |
38 |
|
|
uu_busy_callback (void *cb, uuprogress *uup) |
39 |
root |
1.1 |
{ |
40 |
root |
1.17 |
int retval; |
41 |
|
|
|
42 |
|
|
TEMP_ACQUIRE { |
43 |
|
|
|
44 |
root |
1.19 |
dSP; |
45 |
|
|
int count; |
46 |
|
|
|
47 |
|
|
ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 6); |
48 |
|
|
|
49 |
|
|
PUSHs (sv_2mortal (newSViv (uup->action))); |
50 |
|
|
PUSHs (sv_2mortal (newSVpv (uup->curfile, 0))); |
51 |
|
|
PUSHs (sv_2mortal (newSViv (uup->partno))); |
52 |
|
|
PUSHs (sv_2mortal (newSViv (uup->numparts))); |
53 |
|
|
PUSHs (sv_2mortal (newSViv (uup->fsize))); |
54 |
|
|
PUSHs (sv_2mortal (newSViv (uup->percent))); |
55 |
root |
1.1 |
|
56 |
root |
1.19 |
PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
57 |
root |
1.1 |
|
58 |
root |
1.19 |
if (count != 1) |
59 |
|
|
croak ("busycallback perl callback returned more than one argument"); |
60 |
root |
1.1 |
|
61 |
root |
1.19 |
retval = POPi; |
62 |
root |
1.1 |
|
63 |
root |
1.19 |
PUTBACK; FREETMPS; LEAVE; |
64 |
root |
1.1 |
|
65 |
root |
1.17 |
} TEMP_RELEASE; |
66 |
|
|
|
67 |
root |
1.1 |
return retval; |
68 |
|
|
} |
69 |
|
|
|
70 |
root |
1.8 |
static char * |
71 |
|
|
uu_fnamefilter_callback (void *cb, char *fname) |
72 |
root |
1.1 |
{ |
73 |
root |
1.17 |
static char *str; |
74 |
|
|
|
75 |
|
|
TEMP_ACQUIRE { |
76 |
|
|
|
77 |
root |
1.19 |
dSP; |
78 |
|
|
int count; |
79 |
|
|
|
80 |
|
|
ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); |
81 |
root |
1.1 |
|
82 |
root |
1.19 |
PUSHs (sv_2mortal (newSVpv (fname, 0))); |
83 |
root |
1.1 |
|
84 |
root |
1.19 |
PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
85 |
root |
1.1 |
|
86 |
root |
1.19 |
if (count != 1) |
87 |
|
|
croak ("fnamefilter perl callback MUST return a single filename exactly"); |
88 |
root |
1.1 |
|
89 |
root |
1.22 |
FP_free (str); str = FP_strdup (SvPV_nolen (TOPs)); |
90 |
root |
1.1 |
|
91 |
root |
1.19 |
PUTBACK; FREETMPS; LEAVE; |
92 |
root |
1.1 |
|
93 |
root |
1.17 |
} TEMP_RELEASE; |
94 |
|
|
|
95 |
root |
1.1 |
return str; |
96 |
|
|
} |
97 |
|
|
|
98 |
root |
1.8 |
static int |
99 |
|
|
uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
100 |
root |
1.1 |
{ |
101 |
root |
1.17 |
int retval; |
102 |
|
|
|
103 |
|
|
TEMP_ACQUIRE { |
104 |
|
|
|
105 |
root |
1.19 |
dSP; |
106 |
|
|
int count; |
107 |
|
|
SV *xfname = newSVpv ("", 0); |
108 |
|
|
|
109 |
|
|
ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); |
110 |
root |
1.1 |
|
111 |
root |
1.19 |
PUSHs (sv_2mortal (newSVpv (id, 0))); |
112 |
|
|
PUSHs (sv_2mortal (xfname)); |
113 |
|
|
PUSHs (sv_2mortal (newSViv (retrieve))); |
114 |
root |
1.1 |
|
115 |
root |
1.19 |
PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
116 |
root |
1.1 |
|
117 |
root |
1.19 |
if (count != 1) |
118 |
|
|
croak ("filecallback perl callback must return a single return status"); |
119 |
root |
1.1 |
|
120 |
root |
1.19 |
strcpy (fname, SvPV_nolen (xfname)); |
121 |
|
|
retval = POPi; |
122 |
root |
1.1 |
|
123 |
root |
1.19 |
PUTBACK; FREETMPS; LEAVE; |
124 |
root |
1.1 |
|
125 |
root |
1.17 |
} TEMP_RELEASE; |
126 |
|
|
|
127 |
root |
1.1 |
return retval; |
128 |
|
|
} |
129 |
|
|
|
130 |
root |
1.8 |
static char * |
131 |
|
|
uu_filename_callback (void *cb, char *subject, char *filename) |
132 |
root |
1.5 |
{ |
133 |
root |
1.17 |
TEMP_ACQUIRE { |
134 |
|
|
|
135 |
root |
1.19 |
dSP; |
136 |
|
|
int count; |
137 |
|
|
|
138 |
|
|
ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
139 |
root |
1.5 |
|
140 |
root |
1.19 |
PUSHs (sv_2mortal(newSVpv(subject, 0))); |
141 |
|
|
PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); |
142 |
root |
1.5 |
|
143 |
root |
1.19 |
PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; |
144 |
root |
1.5 |
|
145 |
root |
1.19 |
if (count > 1) |
146 |
|
|
croak ("filenamecallback perl callback must return nothing or a single filename"); |
147 |
root |
1.5 |
|
148 |
root |
1.19 |
if (count) |
149 |
|
|
{ |
150 |
root |
1.22 |
FP_free (filename); |
151 |
root |
1.5 |
|
152 |
root |
1.19 |
filename = SvOK (TOPs) |
153 |
root |
1.22 |
? FP_strdup (SvPV_nolen (TOPs)) |
154 |
root |
1.19 |
: 0; |
155 |
|
|
} |
156 |
root |
1.5 |
|
157 |
root |
1.19 |
PUTBACK; FREETMPS; LEAVE; |
158 |
root |
1.5 |
|
159 |
root |
1.17 |
} TEMP_RELEASE; |
160 |
|
|
|
161 |
root |
1.5 |
return filename; |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
165 |
root |
1.1 |
|
166 |
|
|
#define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
167 |
|
|
|
168 |
root |
1.8 |
static int |
169 |
|
|
uu_info_file (void *cb, char *info) |
170 |
root |
1.1 |
{ |
171 |
root |
1.17 |
int retval; |
172 |
|
|
|
173 |
|
|
TEMP_ACQUIRE { |
174 |
|
|
|
175 |
root |
1.19 |
dSP; |
176 |
|
|
int count; |
177 |
|
|
|
178 |
|
|
ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
179 |
root |
1.1 |
|
180 |
root |
1.19 |
PUSHs(sv_2mortal(newSVpv(info,0))); |
181 |
root |
1.1 |
|
182 |
root |
1.19 |
PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
183 |
root |
1.1 |
|
184 |
root |
1.19 |
if (count != 1) |
185 |
|
|
croak ("info_file perl callback returned more than one argument"); |
186 |
root |
1.1 |
|
187 |
root |
1.19 |
retval = POPi; |
188 |
root |
1.1 |
|
189 |
root |
1.19 |
PUTBACK; FREETMPS; LEAVE; |
190 |
root |
1.1 |
|
191 |
root |
1.17 |
} TEMP_RELEASE; |
192 |
|
|
|
193 |
root |
1.1 |
return retval; |
194 |
|
|
} |
195 |
|
|
|
196 |
|
|
static int |
197 |
|
|
uu_opt_isstring (int opt) |
198 |
|
|
{ |
199 |
|
|
switch (opt) |
200 |
|
|
{ |
201 |
|
|
case UUOPT_VERSION: |
202 |
|
|
case UUOPT_SAVEPATH: |
203 |
|
|
case UUOPT_ENCEXT: |
204 |
|
|
return 1; |
205 |
|
|
default: |
206 |
|
|
return 0; |
207 |
|
|
} |
208 |
|
|
} |
209 |
|
|
|
210 |
root |
1.19 |
static void |
211 |
|
|
initialise (void) |
212 |
|
|
{ |
213 |
|
|
int retval = UUInitialize (); |
214 |
|
|
|
215 |
|
|
if (retval != UURET_OK) |
216 |
|
|
croak ("unable to initialize uudeview library (%s)", UUstrerror (retval)); |
217 |
|
|
} |
218 |
root |
1.1 |
|
219 |
|
|
MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
220 |
|
|
|
221 |
|
|
PROTOTYPES: ENABLE |
222 |
|
|
|
223 |
|
|
void |
224 |
root |
1.8 |
UUCleanUp () |
225 |
root |
1.1 |
CODE: |
226 |
root |
1.19 |
UUCleanUp (); |
227 |
|
|
initialise (); |
228 |
root |
1.1 |
|
229 |
|
|
SV * |
230 |
root |
1.8 |
UUGetOption (opt) |
231 |
root |
1.1 |
int opt |
232 |
|
|
CODE: |
233 |
root |
1.16 |
{ |
234 |
|
|
if (opt == UUOPT_PROGRESS) |
235 |
|
|
croak ("GetOption(UUOPT_PROGRESS) is not yet implemented"); |
236 |
|
|
else if (uu_opt_isstring (opt)) |
237 |
|
|
{ |
238 |
|
|
char cval[8192]; |
239 |
|
|
|
240 |
|
|
UUGetOption (opt, 0, cval, sizeof cval); |
241 |
|
|
RETVAL = newSVpv (cval, 0); |
242 |
|
|
} |
243 |
|
|
else |
244 |
|
|
{ |
245 |
|
|
RETVAL = newSViv (UUGetOption (opt, 0, 0, 0)); |
246 |
|
|
} |
247 |
|
|
} |
248 |
root |
1.1 |
OUTPUT: |
249 |
|
|
RETVAL |
250 |
|
|
|
251 |
|
|
int |
252 |
root |
1.8 |
UUSetOption (opt, val) |
253 |
root |
1.1 |
int opt |
254 |
|
|
SV * val |
255 |
|
|
CODE: |
256 |
root |
1.16 |
{ |
257 |
|
|
STRLEN dc; |
258 |
root |
1.1 |
|
259 |
root |
1.16 |
if (uu_opt_isstring (opt)) |
260 |
|
|
RETVAL = UUSetOption (opt, 0, SvPV (val, dc)); |
261 |
|
|
else |
262 |
|
|
RETVAL = UUSetOption (opt, SvIV (val), (void *)0); |
263 |
|
|
} |
264 |
root |
1.1 |
OUTPUT: |
265 |
|
|
RETVAL |
266 |
|
|
|
267 |
|
|
char * |
268 |
root |
1.8 |
UUstrerror (errcode) |
269 |
root |
1.1 |
int errcode |
270 |
|
|
|
271 |
|
|
void |
272 |
root |
1.8 |
UUSetMsgCallback (func = 0) |
273 |
root |
1.1 |
SV * func |
274 |
|
|
CODE: |
275 |
root |
1.13 |
UUSetMsgCallback (FUNC_CB (uu_msg)); |
276 |
root |
1.1 |
|
277 |
|
|
void |
278 |
root |
1.8 |
UUSetBusyCallback (func = 0,msecs = 1000) |
279 |
root |
1.1 |
SV * func |
280 |
|
|
long msecs |
281 |
|
|
CODE: |
282 |
root |
1.13 |
UUSetBusyCallback (FUNC_CB (uu_busy), msecs); |
283 |
root |
1.1 |
|
284 |
|
|
void |
285 |
root |
1.8 |
UUSetFileCallback (func = 0) |
286 |
root |
1.1 |
SV * func |
287 |
|
|
CODE: |
288 |
root |
1.13 |
UUSetFileCallback (FUNC_CB (uu_file)); |
289 |
root |
1.1 |
|
290 |
|
|
void |
291 |
root |
1.8 |
UUSetFNameFilter (func = 0) |
292 |
root |
1.1 |
SV * func |
293 |
|
|
CODE: |
294 |
root |
1.13 |
UUSetFNameFilter (FUNC_CB (uu_fnamefilter)); |
295 |
root |
1.1 |
|
296 |
root |
1.5 |
void |
297 |
root |
1.8 |
UUSetFileNameCallback (func = 0) |
298 |
root |
1.5 |
SV * func |
299 |
|
|
CODE: |
300 |
root |
1.13 |
UUSetFileNameCallback (FUNC_CB (uu_filename)); |
301 |
root |
1.5 |
|
302 |
root |
1.1 |
char * |
303 |
root |
1.8 |
UUFNameFilter (fname) |
304 |
root |
1.1 |
char * fname |
305 |
|
|
|
306 |
|
|
void |
307 |
root |
1.11 |
UULoadFile (fname, id = 0, delflag = 0, partno = -1) |
308 |
root |
1.1 |
char * fname |
309 |
|
|
char * id |
310 |
|
|
int delflag |
311 |
root |
1.11 |
int partno |
312 |
root |
1.1 |
PPCODE: |
313 |
root |
1.16 |
{ |
314 |
|
|
int count; |
315 |
root |
1.17 |
IV ret; |
316 |
|
|
|
317 |
|
|
RELEASE; |
318 |
|
|
ret = UULoadFileWithPartNo (fname, id, delflag, partno, &count); |
319 |
|
|
ACQUIRE; |
320 |
root |
1.16 |
|
321 |
root |
1.17 |
XPUSHs (sv_2mortal (newSViv (ret))); |
322 |
root |
1.16 |
if (GIMME_V == G_ARRAY) |
323 |
|
|
XPUSHs (sv_2mortal (newSViv (count))); |
324 |
|
|
} |
325 |
root |
1.1 |
|
326 |
|
|
int |
327 |
root |
1.8 |
UUSmerge (pass) |
328 |
root |
1.1 |
int pass |
329 |
|
|
|
330 |
|
|
int |
331 |
|
|
UUQuickDecode(datain,dataout,boundary,maxpos) |
332 |
|
|
FILE * datain |
333 |
|
|
FILE * dataout |
334 |
|
|
char * boundary |
335 |
|
|
long maxpos |
336 |
|
|
|
337 |
|
|
int |
338 |
|
|
UUEncodeMulti(outfile,infile,infname,encoding,outfname,mimetype,filemode) |
339 |
|
|
FILE * outfile |
340 |
|
|
FILE * infile |
341 |
|
|
char * infname |
342 |
|
|
int encoding |
343 |
|
|
char * outfname |
344 |
|
|
char * mimetype |
345 |
|
|
int filemode |
346 |
|
|
|
347 |
|
|
int |
348 |
|
|
UUEncodePartial(outfile,infile,infname,encoding,outfname,mimetype,filemode,partno,linperfile) |
349 |
|
|
FILE * outfile |
350 |
|
|
FILE * infile |
351 |
|
|
char * infname |
352 |
|
|
int encoding |
353 |
|
|
char * outfname |
354 |
|
|
char * mimetype |
355 |
|
|
int filemode |
356 |
|
|
int partno |
357 |
|
|
long linperfile |
358 |
|
|
|
359 |
|
|
int |
360 |
|
|
UUEncodeToStream(outfile,infile,infname,encoding,outfname,filemode) |
361 |
|
|
FILE * outfile |
362 |
|
|
FILE * infile |
363 |
|
|
char * infname |
364 |
|
|
int encoding |
365 |
|
|
char * outfname |
366 |
|
|
int filemode |
367 |
|
|
|
368 |
|
|
int |
369 |
|
|
UUEncodeToFile(infile,infname,encoding,outfname,diskname,linperfile) |
370 |
|
|
FILE * infile |
371 |
|
|
char * infname |
372 |
|
|
int encoding |
373 |
|
|
char * outfname |
374 |
|
|
char * diskname |
375 |
|
|
long linperfile |
376 |
|
|
|
377 |
|
|
int |
378 |
|
|
UUE_PrepSingle(outfile,infile,infname,encoding,outfname,filemode,destination,from,subject,isemail) |
379 |
|
|
FILE * outfile |
380 |
|
|
FILE * infile |
381 |
|
|
char * infname |
382 |
|
|
int encoding |
383 |
|
|
char * outfname |
384 |
|
|
int filemode |
385 |
|
|
char * destination |
386 |
|
|
char * from |
387 |
|
|
char * subject |
388 |
|
|
int isemail |
389 |
|
|
|
390 |
|
|
int |
391 |
|
|
UUE_PrepPartial(outfile,infile,infname,encoding,outfname,filemode,partno,linperfile,filesize,destination,from,subject,isemail) |
392 |
|
|
FILE * outfile |
393 |
|
|
FILE * infile |
394 |
|
|
char * infname |
395 |
|
|
int encoding |
396 |
|
|
char * outfname |
397 |
|
|
int filemode |
398 |
|
|
int partno |
399 |
|
|
long linperfile |
400 |
|
|
long filesize |
401 |
|
|
char * destination |
402 |
|
|
char * from |
403 |
|
|
char * subject |
404 |
|
|
int isemail |
405 |
|
|
|
406 |
|
|
uulist * |
407 |
root |
1.8 |
UUGetFileListItem (num) |
408 |
root |
1.1 |
int num |
409 |
|
|
|
410 |
root |
1.18 |
void |
411 |
|
|
GetFileList () |
412 |
|
|
PPCODE: |
413 |
root |
1.21 |
{ |
414 |
|
|
uulist *iter; |
415 |
|
|
|
416 |
|
|
for (iter = UUGlobalFileList; iter; iter = iter->NEXT) |
417 |
root |
1.18 |
XPUSHs (sv_setref_pv (sv_newmortal (), "Convert::UUlib::Item", iter)); |
418 |
root |
1.21 |
} |
419 |
root |
1.18 |
|
420 |
root |
1.8 |
MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
421 |
|
|
|
422 |
root |
1.1 |
int |
423 |
root |
1.8 |
rename (item, newname) |
424 |
root |
1.1 |
uulist *item |
425 |
|
|
char * newname |
426 |
root |
1.8 |
CODE: |
427 |
|
|
RETVAL = UURenameFile (item, newname); |
428 |
|
|
OUTPUT: |
429 |
|
|
RETVAL |
430 |
root |
1.1 |
|
431 |
|
|
int |
432 |
root |
1.8 |
decode_temp (item) |
433 |
root |
1.1 |
uulist *item |
434 |
root |
1.8 |
CODE: |
435 |
root |
1.17 |
RELEASE; |
436 |
root |
1.8 |
RETVAL = UUDecodeToTemp (item); |
437 |
root |
1.17 |
ACQUIRE; |
438 |
root |
1.8 |
OUTPUT: |
439 |
|
|
RETVAL |
440 |
root |
1.1 |
|
441 |
|
|
int |
442 |
root |
1.8 |
remove_temp (item) |
443 |
root |
1.1 |
uulist *item |
444 |
root |
1.8 |
CODE: |
445 |
root |
1.17 |
RELEASE; |
446 |
root |
1.8 |
RETVAL = UURemoveTemp (item); |
447 |
root |
1.17 |
ACQUIRE; |
448 |
root |
1.8 |
OUTPUT: |
449 |
|
|
RETVAL |
450 |
root |
1.1 |
|
451 |
|
|
int |
452 |
root |
1.8 |
decode (item, target = 0) |
453 |
root |
1.1 |
uulist *item |
454 |
|
|
char * target |
455 |
root |
1.8 |
CODE: |
456 |
root |
1.17 |
RELEASE; |
457 |
root |
1.8 |
RETVAL = UUDecodeFile (item, target); |
458 |
root |
1.17 |
ACQUIRE; |
459 |
root |
1.8 |
OUTPUT: |
460 |
|
|
RETVAL |
461 |
root |
1.1 |
|
462 |
|
|
void |
463 |
root |
1.8 |
info (item, func) |
464 |
root |
1.1 |
uulist *item |
465 |
|
|
SV * func |
466 |
|
|
CODE: |
467 |
root |
1.17 |
RELEASE; |
468 |
|
|
UUInfoFile (item, (void *)func, uu_info_file); |
469 |
|
|
ACQUIRE; |
470 |
root |
1.1 |
|
471 |
|
|
short |
472 |
|
|
state(li) |
473 |
|
|
uulist *li |
474 |
|
|
CODE: |
475 |
|
|
RETVAL = li->state; |
476 |
|
|
OUTPUT: |
477 |
|
|
RETVAL |
478 |
|
|
|
479 |
|
|
short |
480 |
|
|
mode(li,newmode=0) |
481 |
|
|
uulist *li |
482 |
|
|
short newmode |
483 |
|
|
CODE: |
484 |
|
|
if (newmode) |
485 |
|
|
li->mode = newmode; |
486 |
|
|
RETVAL = li->mode; |
487 |
|
|
OUTPUT: |
488 |
|
|
RETVAL |
489 |
|
|
|
490 |
|
|
short |
491 |
|
|
uudet(li) |
492 |
|
|
uulist *li |
493 |
|
|
CODE: |
494 |
|
|
RETVAL = li->uudet; |
495 |
|
|
OUTPUT: |
496 |
|
|
RETVAL |
497 |
|
|
|
498 |
|
|
long |
499 |
|
|
size(li) |
500 |
|
|
uulist *li |
501 |
|
|
CODE: |
502 |
|
|
RETVAL = li->size; |
503 |
|
|
OUTPUT: |
504 |
|
|
RETVAL |
505 |
|
|
|
506 |
|
|
char * |
507 |
root |
1.8 |
filename (li, newfilename = 0) |
508 |
root |
1.1 |
uulist *li |
509 |
|
|
char * newfilename |
510 |
|
|
CODE: |
511 |
|
|
if (newfilename) |
512 |
|
|
{ |
513 |
root |
1.22 |
FP_free (li->filename); |
514 |
|
|
li->filename = FP_strdup (newfilename); |
515 |
root |
1.1 |
} |
516 |
|
|
RETVAL = li->filename; |
517 |
|
|
OUTPUT: |
518 |
|
|
RETVAL |
519 |
|
|
|
520 |
|
|
char * |
521 |
root |
1.8 |
subfname (li) |
522 |
root |
1.1 |
uulist *li |
523 |
|
|
CODE: |
524 |
|
|
RETVAL = li->subfname; |
525 |
|
|
OUTPUT: |
526 |
|
|
RETVAL |
527 |
|
|
|
528 |
|
|
char * |
529 |
root |
1.8 |
mimeid (li) |
530 |
root |
1.1 |
uulist *li |
531 |
|
|
CODE: |
532 |
|
|
RETVAL = li->mimeid; |
533 |
|
|
OUTPUT: |
534 |
|
|
RETVAL |
535 |
|
|
|
536 |
|
|
char * |
537 |
root |
1.8 |
mimetype (li) |
538 |
root |
1.1 |
uulist *li |
539 |
|
|
CODE: |
540 |
|
|
RETVAL = li->mimetype; |
541 |
|
|
OUTPUT: |
542 |
|
|
RETVAL |
543 |
|
|
|
544 |
|
|
char * |
545 |
root |
1.8 |
binfile (li) |
546 |
root |
1.1 |
uulist *li |
547 |
|
|
CODE: |
548 |
|
|
RETVAL = li->binfile; |
549 |
|
|
OUTPUT: |
550 |
|
|
RETVAL |
551 |
|
|
|
552 |
root |
1.8 |
# methods accessing internal data(!) |
553 |
root |
1.1 |
|
554 |
|
|
void |
555 |
root |
1.8 |
parts (li) |
556 |
root |
1.1 |
uulist *li |
557 |
|
|
PPCODE: |
558 |
root |
1.16 |
{ |
559 |
|
|
struct _uufile *p = li->thisfile; |
560 |
root |
1.1 |
|
561 |
root |
1.16 |
while (p) |
562 |
|
|
{ |
563 |
|
|
HV *pi = newHV (); |
564 |
|
|
|
565 |
root |
1.20 |
hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); |
566 |
|
|
if (p->filename ) hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); |
567 |
|
|
if (p->subfname ) hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); |
568 |
|
|
if (p->mimeid ) hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); |
569 |
|
|
if (p->mimetype ) hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); |
570 |
|
|
if (p->data->subject) hv_store (pi, "subject" , 7, newSVpv (p->data->subject,0), 0); |
571 |
|
|
if (p->data->origin ) hv_store (pi, "origin" , 6, newSVpv (p->data->origin ,0), 0); |
572 |
|
|
if (p->data->sfname ) hv_store (pi, "sfname" , 6, newSVpv (p->data->sfname ,0), 0); |
573 |
root |
1.16 |
|
574 |
|
|
XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
575 |
|
|
|
576 |
|
|
p = p->NEXT; |
577 |
|
|
} |
578 |
|
|
} |
579 |
root |
1.1 |
|
580 |
|
|
BOOT: |
581 |
root |
1.20 |
{ |
582 |
|
|
HV *stash = GvSTASH (CvGV (cv)); |
583 |
|
|
|
584 |
|
|
static const struct { |
585 |
|
|
const char *name; |
586 |
|
|
IV iv; |
587 |
|
|
} *civ, const_iv[] = { |
588 |
|
|
# define const_iv(name, value) { # name, (IV) value }, |
589 |
|
|
const_iv (ACT_COPYING , UUACT_COPYING) |
590 |
|
|
const_iv (ACT_DECODING , UUACT_DECODING) |
591 |
|
|
const_iv (ACT_ENCODING , UUACT_ENCODING) |
592 |
|
|
const_iv (ACT_IDLE , UUACT_IDLE) |
593 |
|
|
const_iv (ACT_SCANNING , UUACT_SCANNING) |
594 |
|
|
const_iv (FILE_DECODED , UUFILE_DECODED) |
595 |
|
|
const_iv (FILE_ERROR , UUFILE_ERROR) |
596 |
|
|
const_iv (FILE_MISPART , UUFILE_MISPART) |
597 |
|
|
const_iv (FILE_NOBEGIN , UUFILE_NOBEGIN) |
598 |
|
|
const_iv (FILE_NODATA , UUFILE_NODATA) |
599 |
|
|
const_iv (FILE_NOEND , UUFILE_NOEND) |
600 |
|
|
const_iv (FILE_OK , UUFILE_OK) |
601 |
|
|
const_iv (FILE_READ , UUFILE_READ) |
602 |
|
|
const_iv (FILE_TMPFILE , UUFILE_TMPFILE) |
603 |
|
|
const_iv (MSG_ERROR , UUMSG_ERROR) |
604 |
|
|
const_iv (MSG_FATAL , UUMSG_FATAL) |
605 |
|
|
const_iv (MSG_MESSAGE , UUMSG_MESSAGE) |
606 |
|
|
const_iv (MSG_NOTE , UUMSG_NOTE) |
607 |
|
|
const_iv (MSG_PANIC , UUMSG_PANIC) |
608 |
|
|
const_iv (MSG_WARNING , UUMSG_WARNING) |
609 |
|
|
const_iv (OPT_VERSION , UUOPT_VERSION) |
610 |
|
|
const_iv (OPT_FAST , UUOPT_FAST) |
611 |
|
|
const_iv (OPT_DUMBNESS , UUOPT_DUMBNESS) |
612 |
|
|
const_iv (OPT_BRACKPOL , UUOPT_BRACKPOL) |
613 |
|
|
const_iv (OPT_VERBOSE , UUOPT_VERBOSE) |
614 |
|
|
const_iv (OPT_DESPERATE, UUOPT_DESPERATE) |
615 |
|
|
const_iv (OPT_IGNREPLY , UUOPT_IGNREPLY) |
616 |
|
|
const_iv (OPT_OVERWRITE, UUOPT_OVERWRITE) |
617 |
|
|
const_iv (OPT_SAVEPATH , UUOPT_SAVEPATH) |
618 |
|
|
const_iv (OPT_IGNMODE , UUOPT_IGNMODE) |
619 |
|
|
const_iv (OPT_DEBUG , UUOPT_DEBUG) |
620 |
|
|
const_iv (OPT_ERRNO , UUOPT_ERRNO) |
621 |
|
|
const_iv (OPT_PROGRESS , UUOPT_PROGRESS) |
622 |
|
|
const_iv (OPT_USETEXT , UUOPT_USETEXT) |
623 |
|
|
const_iv (OPT_PREAMB , UUOPT_PREAMB) |
624 |
|
|
const_iv (OPT_TINYB64 , UUOPT_TINYB64) |
625 |
|
|
const_iv (OPT_ENCEXT , UUOPT_ENCEXT) |
626 |
|
|
const_iv (OPT_REMOVE , UUOPT_REMOVE) |
627 |
|
|
const_iv (OPT_MOREMIME , UUOPT_MOREMIME) |
628 |
|
|
const_iv (OPT_DOTDOT , UUOPT_DOTDOT) |
629 |
|
|
const_iv (OPT_RBUF , UUOPT_RBUF) |
630 |
|
|
const_iv (OPT_WBUF , UUOPT_WBUF) |
631 |
|
|
const_iv (OPT_AUTOCHECK, UUOPT_AUTOCHECK) |
632 |
|
|
const_iv (RET_CANCEL , UURET_CANCEL) |
633 |
|
|
const_iv (RET_CONT , UURET_CONT) |
634 |
|
|
const_iv (RET_EXISTS , UURET_EXISTS) |
635 |
|
|
const_iv (RET_ILLVAL , UURET_ILLVAL) |
636 |
|
|
const_iv (RET_IOERR , UURET_IOERR) |
637 |
|
|
const_iv (RET_NODATA , UURET_NODATA) |
638 |
|
|
const_iv (RET_NOEND , UURET_NOEND) |
639 |
|
|
const_iv (RET_NOMEM , UURET_NOMEM) |
640 |
|
|
const_iv (RET_OK , UURET_OK) |
641 |
|
|
const_iv (RET_UNSUP , UURET_UNSUP) |
642 |
|
|
const_iv (B64_ENCODED , B64ENCODED) |
643 |
|
|
const_iv (BH_ENCODED , BH_ENCODED) |
644 |
|
|
const_iv (PT_ENCODED , PT_ENCODED) |
645 |
|
|
const_iv (QP_ENCODED , QP_ENCODED) |
646 |
|
|
const_iv (UU_ENCODED , UU_ENCODED) |
647 |
|
|
const_iv (XX_ENCODED , XX_ENCODED) |
648 |
|
|
const_iv (YENC_ENCODED , YENC_ENCODED) |
649 |
|
|
}; |
650 |
|
|
|
651 |
|
|
for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
652 |
|
|
newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
653 |
|
|
|
654 |
root |
1.13 |
uu_msg_sv = newSVsv (&PL_sv_undef); |
655 |
|
|
uu_busy_sv = newSVsv (&PL_sv_undef); |
656 |
|
|
uu_file_sv = newSVsv (&PL_sv_undef); |
657 |
|
|
uu_fnamefilter_sv = newSVsv (&PL_sv_undef); |
658 |
|
|
uu_filename_sv = newSVsv (&PL_sv_undef); |
659 |
root |
1.20 |
|
660 |
root |
1.19 |
initialise (); |
661 |
root |
1.20 |
} |
662 |
root |
1.1 |
|