1 | #include "EXTERN.h" |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
2 | #include "perl.h" |
3 | #include "XSUB.h" |
3 | #include "XSUB.h" |
4 | |
4 | |
|
|
5 | #include "perlmulticore.h" |
|
|
6 | |
5 | #include "uulib/fptools.h" |
7 | #include "uulib/fptools.h" |
6 | #include "uulib/uudeview.h" |
8 | #include "uulib/uudeview.h" |
7 | #include "uulib/uuint.h" |
9 | #include "uulib/uuint.h" |
8 | |
10 | |
9 | static int |
11 | static int perlinterp_released; |
10 | not_here (char *s) |
|
|
11 | { |
|
|
12 | croak("%s not implemented", s); |
|
|
13 | return -1; |
|
|
14 | } |
|
|
15 | |
12 | |
16 | static int |
13 | #define RELEASE do { perlinterp_released = 1; perlinterp_release (); } while (0) |
17 | constant (char *name) |
14 | #define ACQUIRE do { perlinterp_acquire (); perlinterp_released = 0; } while (0) |
18 | { |
|
|
19 | errno = 0; |
|
|
20 | switch (*name) |
|
|
21 | { |
|
|
22 | case 'A': |
|
|
23 | if (strEQ(name, "ACT_COPYING")) return UUACT_COPYING; |
|
|
24 | if (strEQ(name, "ACT_DECODING")) return UUACT_DECODING; |
|
|
25 | if (strEQ(name, "ACT_ENCODING")) return UUACT_ENCODING; |
|
|
26 | if (strEQ(name, "ACT_IDLE")) return UUACT_IDLE; |
|
|
27 | if (strEQ(name, "ACT_SCANNING")) return UUACT_SCANNING; |
|
|
28 | case 'F': |
|
|
29 | if (strEQ(name, "FILE_DECODED")) return UUFILE_DECODED; |
|
|
30 | if (strEQ(name, "FILE_ERROR")) return UUFILE_ERROR; |
|
|
31 | if (strEQ(name, "FILE_MISPART")) return UUFILE_MISPART; |
|
|
32 | if (strEQ(name, "FILE_NOBEGIN")) return UUFILE_NOBEGIN; |
|
|
33 | if (strEQ(name, "FILE_NODATA")) return UUFILE_NODATA; |
|
|
34 | if (strEQ(name, "FILE_NOEND")) return UUFILE_NOEND; |
|
|
35 | if (strEQ(name, "FILE_OK")) return UUFILE_OK; |
|
|
36 | if (strEQ(name, "FILE_READ")) return UUFILE_READ; |
|
|
37 | if (strEQ(name, "FILE_TMPFILE")) return UUFILE_TMPFILE; |
|
|
38 | break; |
|
|
39 | case 'M': |
|
|
40 | if (strEQ(name, "MSG_ERROR")) return UUMSG_ERROR; |
|
|
41 | if (strEQ(name, "MSG_FATAL")) return UUMSG_FATAL; |
|
|
42 | if (strEQ(name, "MSG_MESSAGE")) return UUMSG_MESSAGE; |
|
|
43 | if (strEQ(name, "MSG_NOTE")) return UUMSG_NOTE; |
|
|
44 | if (strEQ(name, "MSG_PANIC")) return UUMSG_PANIC; |
|
|
45 | if (strEQ(name, "MSG_WARNING")) return UUMSG_WARNING; |
|
|
46 | case 'O': |
|
|
47 | if (strEQ(name, "OPT_VERSION")) return UUOPT_VERSION; |
|
|
48 | if (strEQ(name, "OPT_FAST")) return UUOPT_FAST; |
|
|
49 | if (strEQ(name, "OPT_DUMBNESS")) return UUOPT_DUMBNESS; |
|
|
50 | if (strEQ(name, "OPT_BRACKPOL")) return UUOPT_BRACKPOL; |
|
|
51 | if (strEQ(name, "OPT_VERBOSE")) return UUOPT_VERBOSE; |
|
|
52 | if (strEQ(name, "OPT_DESPERATE")) return UUOPT_DESPERATE; |
|
|
53 | if (strEQ(name, "OPT_IGNREPLY")) return UUOPT_IGNREPLY; |
|
|
54 | if (strEQ(name, "OPT_OVERWRITE")) return UUOPT_OVERWRITE; |
|
|
55 | if (strEQ(name, "OPT_SAVEPATH")) return UUOPT_SAVEPATH; |
|
|
56 | if (strEQ(name, "OPT_IGNMODE")) return UUOPT_IGNMODE; |
|
|
57 | if (strEQ(name, "OPT_DEBUG")) return UUOPT_DEBUG; |
|
|
58 | if (strEQ(name, "OPT_ERRNO")) return UUOPT_ERRNO; |
|
|
59 | if (strEQ(name, "OPT_PROGRESS")) return UUOPT_PROGRESS; |
|
|
60 | if (strEQ(name, "OPT_USETEXT")) return UUOPT_USETEXT; |
|
|
61 | if (strEQ(name, "OPT_PREAMB")) return UUOPT_PREAMB; |
|
|
62 | if (strEQ(name, "OPT_TINYB64")) return UUOPT_TINYB64; |
|
|
63 | if (strEQ(name, "OPT_ENCEXT")) return UUOPT_ENCEXT; |
|
|
64 | if (strEQ(name, "OPT_REMOVE")) return UUOPT_REMOVE; |
|
|
65 | if (strEQ(name, "OPT_MOREMIME")) return UUOPT_MOREMIME; |
|
|
66 | if (strEQ(name, "OPT_DOTDOT")) return UUOPT_DOTDOT; |
|
|
67 | if (strEQ(name, "OPT_RBUF")) return UUOPT_RBUF; |
|
|
68 | if (strEQ(name, "OPT_WBUF")) return UUOPT_WBUF; |
|
|
69 | if (strEQ(name, "OPT_AUTOCHECK")) return UUOPT_AUTOCHECK; |
|
|
70 | case 'R': |
|
|
71 | if (strEQ(name, "RET_CANCEL")) return UURET_CANCEL; |
|
|
72 | if (strEQ(name, "RET_CONT")) return UURET_CONT; |
|
|
73 | if (strEQ(name, "RET_EXISTS")) return UURET_EXISTS; |
|
|
74 | if (strEQ(name, "RET_ILLVAL")) return UURET_ILLVAL; |
|
|
75 | if (strEQ(name, "RET_IOERR")) return UURET_IOERR; |
|
|
76 | if (strEQ(name, "RET_NODATA")) return UURET_NODATA; |
|
|
77 | if (strEQ(name, "RET_NOEND")) return UURET_NOEND; |
|
|
78 | if (strEQ(name, "RET_NOMEM")) return UURET_NOMEM; |
|
|
79 | if (strEQ(name, "RET_OK")) return UURET_OK; |
|
|
80 | if (strEQ(name, "RET_UNSUP")) return UURET_UNSUP; |
|
|
81 | case 'B': |
|
|
82 | if (strEQ(name, "B64_ENCODED")) return B64ENCODED; |
|
|
83 | if (strEQ(name, "BH_ENCODED")) return BH_ENCODED; |
|
|
84 | case 'P': |
|
|
85 | if (strEQ(name, "PT_ENCODED")) return PT_ENCODED; |
|
|
86 | case 'Q': |
|
|
87 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
|
|
88 | case 'U': |
|
|
89 | if (strEQ(name, "UU_ENCODED")) return UU_ENCODED; |
|
|
90 | case 'X': |
|
|
91 | if (strEQ(name, "XX_ENCODED")) return XX_ENCODED; |
|
|
92 | case 'Y': |
|
|
93 | if (strEQ(name, "YENC_ENCODED")) return YENC_ENCODED; |
|
|
94 | } |
|
|
95 | |
15 | |
96 | errno = EINVAL; |
16 | #define TEMP_ACQUIRE if (perlinterp_released) perlinterp_acquire (); |
97 | return 0; |
17 | #define TEMP_RELEASE if (perlinterp_released) perlinterp_release (); |
98 | } |
|
|
99 | |
18 | |
100 | static void |
19 | static void |
101 | uu_msg_callback (void *cb, char *msg, int level) |
20 | uu_msg_callback (void *cb, char *msg, int level) |
102 | { |
21 | { |
|
|
22 | TEMP_ACQUIRE { |
|
|
23 | |
103 | dSP; |
24 | dSP; |
104 | |
25 | |
105 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
26 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
106 | |
27 | |
107 | PUSHs (sv_2mortal (newSVpv (msg, 0))); |
28 | PUSHs (sv_2mortal (newSVpv (msg, 0))); |
108 | PUSHs (sv_2mortal (newSViv (level))); |
29 | PUSHs (sv_2mortal (newSViv (level))); |
109 | |
30 | |
110 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; |
31 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; |
111 | PUTBACK; FREETMPS; LEAVE; |
32 | PUTBACK; FREETMPS; LEAVE; |
|
|
33 | |
|
|
34 | } TEMP_RELEASE; |
112 | } |
35 | } |
113 | |
36 | |
114 | static int |
37 | static int |
115 | uu_busy_callback (void *cb, uuprogress *uup) |
38 | uu_busy_callback (void *cb, uuprogress *uup) |
116 | { |
39 | { |
117 | dSP; |
|
|
118 | int count; |
|
|
119 | int retval; |
40 | int retval; |
120 | |
41 | |
|
|
42 | TEMP_ACQUIRE { |
|
|
43 | |
|
|
44 | dSP; |
|
|
45 | int count; |
|
|
46 | |
121 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 6); |
47 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 6); |
122 | |
48 | |
123 | PUSHs (sv_2mortal (newSViv (uup->action))); |
49 | PUSHs (sv_2mortal (newSViv (uup->action))); |
124 | PUSHs (sv_2mortal (newSVpv (uup->curfile, 0))); |
50 | PUSHs (sv_2mortal (newSVpv (uup->curfile, 0))); |
125 | PUSHs (sv_2mortal (newSViv (uup->partno))); |
51 | PUSHs (sv_2mortal (newSViv (uup->partno))); |
126 | PUSHs (sv_2mortal (newSViv (uup->numparts))); |
52 | PUSHs (sv_2mortal (newSViv (uup->numparts))); |
127 | PUSHs (sv_2mortal (newSViv (uup->fsize))); |
53 | PUSHs (sv_2mortal (newSViv (uup->fsize))); |
128 | PUSHs (sv_2mortal (newSViv (uup->percent))); |
54 | PUSHs (sv_2mortal (newSViv (uup->percent))); |
129 | |
55 | |
130 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
56 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
131 | |
57 | |
132 | if (count != 1) |
58 | if (count != 1) |
133 | croak ("busycallback perl callback returned more than one argument"); |
59 | croak ("busycallback perl callback returned more than one argument"); |
134 | |
60 | |
135 | retval = POPi; |
61 | retval = POPi; |
136 | |
62 | |
137 | PUTBACK; FREETMPS; LEAVE; |
63 | PUTBACK; FREETMPS; LEAVE; |
|
|
64 | |
|
|
65 | } TEMP_RELEASE; |
138 | |
66 | |
139 | return retval; |
67 | return retval; |
140 | } |
68 | } |
141 | |
69 | |
142 | static char * |
70 | static char * |
143 | uu_fnamefilter_callback (void *cb, char *fname) |
71 | uu_fnamefilter_callback (void *cb, char *fname) |
144 | { |
72 | { |
145 | dSP; |
|
|
146 | int count; |
|
|
147 | static char *str; |
73 | static char *str; |
148 | |
74 | |
|
|
75 | TEMP_ACQUIRE { |
|
|
76 | |
|
|
77 | dSP; |
|
|
78 | int count; |
|
|
79 | |
149 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); |
80 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); |
150 | |
81 | |
151 | PUSHs (sv_2mortal (newSVpv (fname, 0))); |
82 | PUSHs (sv_2mortal (newSVpv (fname, 0))); |
152 | |
83 | |
153 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
84 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
154 | |
85 | |
155 | if (count != 1) |
86 | if (count != 1) |
156 | croak ("fnamefilter perl callback MUST return a single filename exactly"); |
87 | croak ("fnamefilter perl callback MUST return a single filename exactly"); |
157 | |
88 | |
158 | _FP_free (str); str = _FP_strdup (SvPV_nolen (TOPs)); |
89 | _FP_free (str); str = _FP_strdup (SvPV_nolen (TOPs)); |
159 | |
90 | |
160 | PUTBACK; FREETMPS; LEAVE; |
91 | PUTBACK; FREETMPS; LEAVE; |
|
|
92 | |
|
|
93 | } TEMP_RELEASE; |
161 | |
94 | |
162 | return str; |
95 | return str; |
163 | } |
96 | } |
164 | |
97 | |
165 | static int |
98 | static int |
166 | uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
99 | uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
167 | { |
100 | { |
168 | dSP; |
|
|
169 | int count; |
|
|
170 | int retval; |
101 | int retval; |
|
|
102 | |
|
|
103 | TEMP_ACQUIRE { |
|
|
104 | |
|
|
105 | dSP; |
|
|
106 | int count; |
171 | SV *xfname = newSVpv ("", 0); |
107 | SV *xfname = newSVpv ("", 0); |
172 | |
108 | |
173 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); |
109 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); |
174 | |
110 | |
175 | PUSHs (sv_2mortal (newSVpv (id, 0))); |
111 | PUSHs (sv_2mortal (newSVpv (id, 0))); |
176 | PUSHs (sv_2mortal (xfname)); |
112 | PUSHs (sv_2mortal (xfname)); |
177 | PUSHs (sv_2mortal (newSViv (retrieve))); |
113 | PUSHs (sv_2mortal (newSViv (retrieve))); |
178 | |
114 | |
179 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
115 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
180 | |
116 | |
181 | if (count != 1) |
117 | if (count != 1) |
182 | croak ("filecallback perl callback must return a single return status"); |
118 | croak ("filecallback perl callback must return a single return status"); |
183 | |
119 | |
184 | strcpy (fname, SvPV_nolen (xfname)); |
120 | strcpy (fname, SvPV_nolen (xfname)); |
185 | retval = POPi; |
121 | retval = POPi; |
186 | |
122 | |
187 | PUTBACK; FREETMPS; LEAVE; |
123 | PUTBACK; FREETMPS; LEAVE; |
|
|
124 | |
|
|
125 | } TEMP_RELEASE; |
188 | |
126 | |
189 | return retval; |
127 | return retval; |
190 | } |
128 | } |
191 | |
129 | |
192 | static char * |
130 | static char * |
193 | uu_filename_callback (void *cb, char *subject, char *filename) |
131 | uu_filename_callback (void *cb, char *subject, char *filename) |
194 | { |
132 | { |
|
|
133 | TEMP_ACQUIRE { |
|
|
134 | |
195 | dSP; |
135 | dSP; |
196 | int count; |
136 | int count; |
197 | |
137 | |
198 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
138 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
199 | |
139 | |
200 | PUSHs (sv_2mortal(newSVpv(subject, 0))); |
140 | PUSHs (sv_2mortal(newSVpv(subject, 0))); |
201 | PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); |
141 | PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); |
202 | |
142 | |
203 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; |
143 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; |
204 | |
144 | |
205 | if (count > 1) |
145 | if (count > 1) |
206 | croak ("filenamecallback perl callback must return nothing or a single filename"); |
146 | croak ("filenamecallback perl callback must return nothing or a single filename"); |
207 | |
147 | |
208 | if (count) |
148 | if (count) |
209 | { |
149 | { |
210 | _FP_free (filename); |
150 | _FP_free (filename); |
211 | |
151 | |
212 | filename = SvOK (TOPs) |
152 | filename = SvOK (TOPs) |
213 | ? _FP_strdup (SvPV_nolen (TOPs)) |
153 | ? _FP_strdup (SvPV_nolen (TOPs)) |
214 | : 0; |
154 | : 0; |
215 | } |
155 | } |
216 | |
156 | |
217 | PUTBACK; FREETMPS; LEAVE; |
157 | PUTBACK; FREETMPS; LEAVE; |
|
|
158 | |
|
|
159 | } TEMP_RELEASE; |
218 | |
160 | |
219 | return filename; |
161 | return filename; |
220 | } |
162 | } |
221 | |
163 | |
222 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
164 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
… | |
… | |
224 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
166 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
225 | |
167 | |
226 | static int |
168 | static int |
227 | uu_info_file (void *cb, char *info) |
169 | uu_info_file (void *cb, char *info) |
228 | { |
170 | { |
229 | dSP; |
|
|
230 | int count; |
|
|
231 | int retval; |
171 | int retval; |
232 | |
172 | |
|
|
173 | TEMP_ACQUIRE { |
|
|
174 | |
|
|
175 | dSP; |
|
|
176 | int count; |
|
|
177 | |
233 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
178 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
234 | |
179 | |
235 | PUSHs(sv_2mortal(newSVpv(info,0))); |
180 | PUSHs(sv_2mortal(newSVpv(info,0))); |
236 | |
181 | |
237 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
182 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
238 | |
183 | |
239 | if (count != 1) |
184 | if (count != 1) |
240 | croak ("info_file perl callback returned more than one argument"); |
185 | croak ("info_file perl callback returned more than one argument"); |
241 | |
186 | |
242 | retval = POPi; |
187 | retval = POPi; |
243 | |
188 | |
244 | PUTBACK; FREETMPS; LEAVE; |
189 | PUTBACK; FREETMPS; LEAVE; |
|
|
190 | |
|
|
191 | } TEMP_RELEASE; |
245 | |
192 | |
246 | return retval; |
193 | return retval; |
247 | } |
194 | } |
248 | |
195 | |
249 | static int |
196 | static int |
… | |
… | |
258 | default: |
205 | default: |
259 | return 0; |
206 | return 0; |
260 | } |
207 | } |
261 | } |
208 | } |
262 | |
209 | |
263 | static int uu_initialized; |
210 | 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 | } |
264 | |
218 | |
265 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
219 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
266 | |
220 | |
267 | PROTOTYPES: ENABLE |
221 | PROTOTYPES: ENABLE |
268 | |
|
|
269 | int |
|
|
270 | constant (name) |
|
|
271 | char * name |
|
|
272 | |
|
|
273 | |
|
|
274 | void |
|
|
275 | UUInitialize () |
|
|
276 | CODE: |
|
|
277 | if (!uu_initialized) |
|
|
278 | { |
|
|
279 | int retval; |
|
|
280 | |
|
|
281 | if ((retval = UUInitialize ()) != UURET_OK) |
|
|
282 | croak ("unable to initialize uudeview library (%s)", UUstrerror (retval)); |
|
|
283 | |
|
|
284 | uu_initialized = 1; |
|
|
285 | } |
|
|
286 | |
222 | |
287 | void |
223 | void |
288 | UUCleanUp () |
224 | UUCleanUp () |
289 | CODE: |
225 | CODE: |
290 | if (uu_initialized) |
|
|
291 | UUCleanUp (); |
226 | UUCleanUp (); |
292 | |
227 | initialise (); |
293 | uu_initialized = 0; |
|
|
294 | |
228 | |
295 | SV * |
229 | SV * |
296 | UUGetOption (opt) |
230 | UUGetOption (opt) |
297 | int opt |
231 | int opt |
298 | CODE: |
232 | CODE: |
… | |
… | |
376 | int delflag |
310 | int delflag |
377 | int partno |
311 | int partno |
378 | PPCODE: |
312 | PPCODE: |
379 | { |
313 | { |
380 | int count; |
314 | int count; |
|
|
315 | IV ret; |
381 | |
316 | |
382 | XPUSHs (sv_2mortal (newSViv (UULoadFileWithPartNo (fname, id, delflag, partno, &count)))); |
317 | RELEASE; |
|
|
318 | ret = UULoadFileWithPartNo (fname, id, delflag, partno, &count); |
|
|
319 | ACQUIRE; |
|
|
320 | |
|
|
321 | XPUSHs (sv_2mortal (newSViv (ret))); |
383 | if (GIMME_V == G_ARRAY) |
322 | if (GIMME_V == G_ARRAY) |
384 | XPUSHs (sv_2mortal (newSViv (count))); |
323 | XPUSHs (sv_2mortal (newSViv (count))); |
385 | } |
324 | } |
386 | |
325 | |
387 | int |
326 | int |
… | |
… | |
466 | |
405 | |
467 | uulist * |
406 | uulist * |
468 | UUGetFileListItem (num) |
407 | UUGetFileListItem (num) |
469 | int num |
408 | int num |
470 | |
409 | |
|
|
410 | void |
|
|
411 | GetFileList () |
|
|
412 | PPCODE: |
|
|
413 | { |
|
|
414 | uulist *iter; |
|
|
415 | |
|
|
416 | for (iter = UUGlobalFileList; iter; iter = iter->NEXT) |
|
|
417 | XPUSHs (sv_setref_pv (sv_newmortal (), "Convert::UUlib::Item", iter)); |
|
|
418 | } |
|
|
419 | |
471 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
420 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
472 | |
421 | |
473 | int |
422 | int |
474 | rename (item, newname) |
423 | rename (item, newname) |
475 | uulist *item |
424 | uulist *item |
… | |
… | |
481 | |
430 | |
482 | int |
431 | int |
483 | decode_temp (item) |
432 | decode_temp (item) |
484 | uulist *item |
433 | uulist *item |
485 | CODE: |
434 | CODE: |
|
|
435 | RELEASE; |
486 | RETVAL = UUDecodeToTemp (item); |
436 | RETVAL = UUDecodeToTemp (item); |
|
|
437 | ACQUIRE; |
487 | OUTPUT: |
438 | OUTPUT: |
488 | RETVAL |
439 | RETVAL |
489 | |
440 | |
490 | int |
441 | int |
491 | remove_temp (item) |
442 | remove_temp (item) |
492 | uulist *item |
443 | uulist *item |
493 | CODE: |
444 | CODE: |
|
|
445 | RELEASE; |
494 | RETVAL = UURemoveTemp (item); |
446 | RETVAL = UURemoveTemp (item); |
|
|
447 | ACQUIRE; |
495 | OUTPUT: |
448 | OUTPUT: |
496 | RETVAL |
449 | RETVAL |
497 | |
450 | |
498 | int |
451 | int |
499 | decode (item, target = 0) |
452 | decode (item, target = 0) |
500 | uulist *item |
453 | uulist *item |
501 | char * target |
454 | char * target |
502 | CODE: |
455 | CODE: |
|
|
456 | RELEASE; |
503 | RETVAL = UUDecodeFile (item, target); |
457 | RETVAL = UUDecodeFile (item, target); |
|
|
458 | ACQUIRE; |
504 | OUTPUT: |
459 | OUTPUT: |
505 | RETVAL |
460 | RETVAL |
506 | |
461 | |
507 | void |
462 | void |
508 | info (item, func) |
463 | info (item, func) |
509 | uulist *item |
464 | uulist *item |
510 | SV * func |
465 | SV * func |
511 | CODE: |
466 | CODE: |
|
|
467 | RELEASE; |
512 | UUInfoFile (item,(void *)func, uu_info_file); |
468 | UUInfoFile (item, (void *)func, uu_info_file); |
|
|
469 | ACQUIRE; |
513 | |
470 | |
514 | short |
471 | short |
515 | state(li) |
472 | state(li) |
516 | uulist *li |
473 | uulist *li |
517 | CODE: |
474 | CODE: |
… | |
… | |
603 | |
560 | |
604 | while (p) |
561 | while (p) |
605 | { |
562 | { |
606 | HV *pi = newHV (); |
563 | HV *pi = newHV (); |
607 | |
564 | |
608 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); |
565 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); |
609 | |
|
|
610 | if (p->filename) |
|
|
611 | hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); |
566 | if (p->filename ) hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); |
612 | if(p->subfname) |
|
|
613 | hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); |
567 | if (p->subfname ) hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); |
614 | if(p->mimeid) |
568 | if (p->mimeid ) hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); |
615 | hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); |
|
|
616 | if(p->mimetype) |
|
|
617 | hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); |
569 | if (p->mimetype ) hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); |
618 | if (p->data->subject) |
|
|
619 | hv_store (pi, "subject" , 7, newSVpv (p->data->subject,0), 0); |
570 | if (p->data->subject) hv_store (pi, "subject" , 7, newSVpv (p->data->subject,0), 0); |
620 | if (p->data->origin) |
571 | if (p->data->origin ) hv_store (pi, "origin" , 6, newSVpv (p->data->origin ,0), 0); |
621 | 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); |
622 | if (p->data->sfname) |
|
|
623 | hv_store (pi, "sfname" , 6, newSVpv (p->data->sfname ,0), 0); |
|
|
624 | |
573 | |
625 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
574 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
626 | |
575 | |
627 | p = p->NEXT; |
576 | p = p->NEXT; |
628 | } |
577 | } |
629 | } |
578 | } |
630 | |
579 | |
631 | BOOT: |
580 | BOOT: |
|
|
581 | { |
|
|
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 | |
632 | uu_msg_sv = newSVsv (&PL_sv_undef); |
654 | uu_msg_sv = newSVsv (&PL_sv_undef); |
633 | uu_busy_sv = newSVsv (&PL_sv_undef); |
655 | uu_busy_sv = newSVsv (&PL_sv_undef); |
634 | uu_file_sv = newSVsv (&PL_sv_undef); |
656 | uu_file_sv = newSVsv (&PL_sv_undef); |
635 | uu_fnamefilter_sv = newSVsv (&PL_sv_undef); |
657 | uu_fnamefilter_sv = newSVsv (&PL_sv_undef); |
636 | uu_filename_sv = newSVsv (&PL_sv_undef); |
658 | uu_filename_sv = newSVsv (&PL_sv_undef); |
637 | |
659 | |
|
|
660 | initialise (); |
|
|
661 | } |
|
|
662 | |