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 | |
|
|
11 | static int perlinterp_released; |
|
|
12 | |
|
|
13 | #define RELEASE do { perlinterp_released = 1; perlinterp_release (); } while (0) |
|
|
14 | #define ACQUIRE do { perlinterp_acquire (); perlinterp_released = 0; } while (0) |
|
|
15 | |
|
|
16 | #define TEMP_ACQUIRE if (perlinterp_released) perlinterp_acquire (); |
|
|
17 | #define TEMP_RELEASE if (perlinterp_released) perlinterp_release (); |
|
|
18 | |
|
|
19 | static void |
|
|
20 | uu_msg_callback (void *cb, char *msg, int level) |
|
|
21 | { |
|
|
22 | TEMP_ACQUIRE { |
|
|
23 | |
|
|
24 | dSP; |
|
|
25 | |
|
|
26 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
|
|
27 | |
|
|
28 | PUSHs (sv_2mortal (newSVpv (msg, 0))); |
|
|
29 | PUSHs (sv_2mortal (newSViv (level))); |
|
|
30 | |
|
|
31 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; |
|
|
32 | PUTBACK; FREETMPS; LEAVE; |
|
|
33 | |
|
|
34 | } TEMP_RELEASE; |
|
|
35 | } |
|
|
36 | |
9 | static int |
37 | static int |
10 | not_here(char *s) |
38 | uu_busy_callback (void *cb, uuprogress *uup) |
11 | { |
39 | { |
12 | croak("%s not implemented on this architecture", s); |
40 | int retval; |
13 | return -1; |
41 | |
|
|
42 | TEMP_ACQUIRE { |
|
|
43 | |
|
|
44 | 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 | |
|
|
56 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
|
|
57 | |
|
|
58 | if (count != 1) |
|
|
59 | croak ("busycallback perl callback returned more than one argument"); |
|
|
60 | |
|
|
61 | retval = POPi; |
|
|
62 | |
|
|
63 | PUTBACK; FREETMPS; LEAVE; |
|
|
64 | |
|
|
65 | } TEMP_RELEASE; |
|
|
66 | |
|
|
67 | return retval; |
|
|
68 | } |
|
|
69 | |
|
|
70 | static char * |
|
|
71 | uu_fnamefilter_callback (void *cb, char *fname) |
|
|
72 | { |
|
|
73 | static char *str; |
|
|
74 | |
|
|
75 | TEMP_ACQUIRE { |
|
|
76 | |
|
|
77 | dSP; |
|
|
78 | int count; |
|
|
79 | |
|
|
80 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); |
|
|
81 | |
|
|
82 | PUSHs (sv_2mortal (newSVpv (fname, 0))); |
|
|
83 | |
|
|
84 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
|
|
85 | |
|
|
86 | if (count != 1) |
|
|
87 | croak ("fnamefilter perl callback MUST return a single filename exactly"); |
|
|
88 | |
|
|
89 | _FP_free (str); str = _FP_strdup (SvPV_nolen (TOPs)); |
|
|
90 | |
|
|
91 | PUTBACK; FREETMPS; LEAVE; |
|
|
92 | |
|
|
93 | } TEMP_RELEASE; |
|
|
94 | |
|
|
95 | return str; |
14 | } |
96 | } |
15 | |
97 | |
16 | static int |
98 | static int |
17 | constant(char *name) |
99 | uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
18 | { |
100 | { |
19 | errno = 0; |
|
|
20 | switch (*name) { |
|
|
21 | case 'A': |
|
|
22 | if (strEQ(name, "ACT_COPYING")) return UUACT_COPYING; |
|
|
23 | if (strEQ(name, "ACT_DECODING")) return UUACT_DECODING; |
|
|
24 | if (strEQ(name, "ACT_ENCODING")) return UUACT_ENCODING; |
|
|
25 | if (strEQ(name, "ACT_IDLE")) return UUACT_IDLE; |
|
|
26 | if (strEQ(name, "ACT_SCANNING")) return UUACT_SCANNING; |
|
|
27 | case 'F': |
|
|
28 | if (strEQ(name, "FILE_DECODED")) return UUFILE_DECODED; |
|
|
29 | if (strEQ(name, "FILE_ERROR")) return UUFILE_ERROR; |
|
|
30 | if (strEQ(name, "FILE_MISPART")) return UUFILE_MISPART; |
|
|
31 | if (strEQ(name, "FILE_NOBEGIN")) return UUFILE_NOBEGIN; |
|
|
32 | if (strEQ(name, "FILE_NODATA")) return UUFILE_NODATA; |
|
|
33 | if (strEQ(name, "FILE_NOEND")) return UUFILE_NOEND; |
|
|
34 | if (strEQ(name, "FILE_OK")) return UUFILE_OK; |
|
|
35 | if (strEQ(name, "FILE_READ")) return UUFILE_READ; |
|
|
36 | if (strEQ(name, "FILE_TMPFILE")) return UUFILE_TMPFILE; |
|
|
37 | break; |
|
|
38 | case 'M': |
|
|
39 | if (strEQ(name, "MSG_ERROR")) return UUMSG_ERROR; |
|
|
40 | if (strEQ(name, "MSG_FATAL")) return UUMSG_FATAL; |
|
|
41 | if (strEQ(name, "MSG_MESSAGE")) return UUMSG_MESSAGE; |
|
|
42 | if (strEQ(name, "MSG_NOTE")) return UUMSG_NOTE; |
|
|
43 | if (strEQ(name, "MSG_PANIC")) return UUMSG_PANIC; |
|
|
44 | if (strEQ(name, "MSG_WARNING")) return UUMSG_WARNING; |
|
|
45 | case 'O': |
|
|
46 | if (strEQ(name, "OPT_BRACKPOL")) return UUOPT_BRACKPOL; |
|
|
47 | if (strEQ(name, "OPT_DEBUG")) return UUOPT_DEBUG; |
|
|
48 | if (strEQ(name, "OPT_DESPERATE")) return UUOPT_DESPERATE; |
|
|
49 | if (strEQ(name, "OPT_DUMBNESS")) return UUOPT_DUMBNESS; |
|
|
50 | if (strEQ(name, "OPT_ENCEXT")) return UUOPT_ENCEXT; |
|
|
51 | if (strEQ(name, "OPT_ERRNO")) return UUOPT_ERRNO; |
|
|
52 | if (strEQ(name, "OPT_FAST")) return UUOPT_FAST; |
|
|
53 | if (strEQ(name, "OPT_IGNMODE")) return UUOPT_IGNMODE; |
|
|
54 | if (strEQ(name, "OPT_IGNREPLY")) return UUOPT_IGNREPLY; |
|
|
55 | if (strEQ(name, "OPT_OVERWRITE")) return UUOPT_OVERWRITE; |
|
|
56 | if (strEQ(name, "OPT_PREAMB")) return UUOPT_PREAMB; |
|
|
57 | if (strEQ(name, "OPT_PROGRESS")) return UUOPT_PROGRESS; |
|
|
58 | if (strEQ(name, "OPT_SAVEPATH")) return UUOPT_SAVEPATH; |
|
|
59 | if (strEQ(name, "OPT_TINYB64")) return UUOPT_TINYB64; |
|
|
60 | if (strEQ(name, "OPT_USETEXT")) return UUOPT_USETEXT; |
|
|
61 | if (strEQ(name, "OPT_VERBOSE")) return UUOPT_VERBOSE; |
|
|
62 | if (strEQ(name, "OPT_VERSION")) return UUOPT_VERSION; |
|
|
63 | if (strEQ(name, "OPT_REMOVE")) return UUOPT_REMOVE; |
|
|
64 | if (strEQ(name, "OPT_MOREMIME")) return UUOPT_MOREMIME; |
|
|
65 | case 'R': |
|
|
66 | if (strEQ(name, "RET_CANCEL")) return UURET_CANCEL; |
|
|
67 | if (strEQ(name, "RET_CONT")) return UURET_CONT; |
|
|
68 | if (strEQ(name, "RET_EXISTS")) return UURET_EXISTS; |
|
|
69 | if (strEQ(name, "RET_ILLVAL")) return UURET_ILLVAL; |
|
|
70 | if (strEQ(name, "RET_IOERR")) return UURET_IOERR; |
|
|
71 | if (strEQ(name, "RET_NODATA")) return UURET_NODATA; |
|
|
72 | if (strEQ(name, "RET_NOEND")) return UURET_NOEND; |
|
|
73 | if (strEQ(name, "RET_NOMEM")) return UURET_NOMEM; |
|
|
74 | if (strEQ(name, "RET_OK")) return UURET_OK; |
|
|
75 | if (strEQ(name, "RET_UNSUP")) return UURET_UNSUP; |
|
|
76 | case 'B': |
|
|
77 | if (strEQ(name, "B64ENCODED")) return B64ENCODED; |
|
|
78 | if (strEQ(name, "BH_ENCODED")) return BH_ENCODED; |
|
|
79 | case 'P': |
|
|
80 | if (strEQ(name, "PT_ENCODED")) return PT_ENCODED; |
|
|
81 | case 'Q': |
|
|
82 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
|
|
83 | case 'U': |
|
|
84 | if (strEQ(name, "UU_ENCODED")) return UU_ENCODED; |
|
|
85 | case 'X': |
|
|
86 | if (strEQ(name, "XX_ENCODED")) return XX_ENCODED; |
|
|
87 | case 'Y': |
|
|
88 | if (strEQ(name, "YENC_ENCODED")) return YENC_ENCODED; |
|
|
89 | } |
|
|
90 | errno = EINVAL; |
|
|
91 | return 0; |
|
|
92 | } |
|
|
93 | |
|
|
94 | static void uu_msg_callback (void *cb, char *msg, int level) |
|
|
95 | { |
|
|
96 | dSP; |
|
|
97 | |
|
|
98 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,2); |
|
|
99 | |
|
|
100 | PUSHs(sv_2mortal(newSVpv(msg,0))); |
|
|
101 | PUSHs(sv_2mortal(newSViv(level))); |
|
|
102 | |
|
|
103 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; |
|
|
104 | PUTBACK; FREETMPS; LEAVE; |
|
|
105 | } |
|
|
106 | |
|
|
107 | static int uu_busy_callback (void *cb, uuprogress *uup) |
|
|
108 | { |
|
|
109 | dSP; |
|
|
110 | int count; |
|
|
111 | int retval; |
101 | int retval; |
|
|
102 | |
|
|
103 | TEMP_ACQUIRE { |
|
|
104 | |
|
|
105 | dSP; |
|
|
106 | int count; |
|
|
107 | SV *xfname = newSVpv ("", 0); |
112 | |
108 | |
113 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,6); |
109 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); |
114 | |
110 | |
115 | PUSHs(sv_2mortal(newSViv(uup->action))); |
|
|
116 | PUSHs(sv_2mortal(newSVpv(uup->curfile,0))); |
111 | PUSHs (sv_2mortal (newSVpv (id, 0))); |
117 | PUSHs(sv_2mortal(newSViv(uup->partno))); |
112 | PUSHs (sv_2mortal (xfname)); |
118 | PUSHs(sv_2mortal(newSViv(uup->numparts))); |
|
|
119 | PUSHs(sv_2mortal(newSViv(uup->fsize))); |
|
|
120 | PUSHs(sv_2mortal(newSViv(uup->percent))); |
113 | PUSHs (sv_2mortal (newSViv (retrieve))); |
121 | |
114 | |
122 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
115 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
123 | |
116 | |
124 | if (count != 1) |
117 | if (count != 1) |
125 | croak ("busycallback perl callback returned more than one argument"); |
118 | croak ("filecallback perl callback must return a single return status"); |
126 | |
119 | |
|
|
120 | strcpy (fname, SvPV_nolen (xfname)); |
127 | retval = POPi; |
121 | retval = POPi; |
128 | |
122 | |
129 | PUTBACK; FREETMPS; LEAVE; |
123 | PUTBACK; FREETMPS; LEAVE; |
|
|
124 | |
|
|
125 | } TEMP_RELEASE; |
130 | |
126 | |
131 | return retval; |
127 | return retval; |
132 | } |
128 | } |
133 | |
129 | |
134 | static char *uu_fnamefilter_callback (void *cb, char *fname) |
130 | static char * |
|
|
131 | uu_filename_callback (void *cb, char *subject, char *filename) |
135 | { |
132 | { |
|
|
133 | TEMP_ACQUIRE { |
|
|
134 | |
136 | dSP; |
135 | dSP; |
137 | int count; |
136 | int count; |
138 | static char *str; |
|
|
139 | |
137 | |
140 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
138 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); |
141 | |
139 | |
142 | PUSHs(sv_2mortal(newSVpv(fname,0))); |
140 | PUSHs (sv_2mortal(newSVpv(subject, 0))); |
|
|
141 | PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); |
143 | |
142 | |
144 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
143 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; |
145 | |
144 | |
146 | if (count != 1) |
145 | if (count > 1) |
147 | croak ("fnamefilter perl callback returned more than one argument"); |
146 | croak ("filenamecallback perl callback must return nothing or a single filename"); |
148 | |
147 | |
149 | FP_free(str); str = FP_strdup (POPp); |
148 | if (count) |
|
|
149 | { |
|
|
150 | _FP_free (filename); |
150 | |
151 | |
|
|
152 | filename = SvOK (TOPs) |
|
|
153 | ? _FP_strdup (SvPV_nolen (TOPs)) |
|
|
154 | : 0; |
|
|
155 | } |
|
|
156 | |
151 | PUTBACK; FREETMPS; LEAVE; |
157 | PUTBACK; FREETMPS; LEAVE; |
152 | |
158 | |
153 | return str; |
159 | } TEMP_RELEASE; |
154 | } |
|
|
155 | |
160 | |
156 | static int uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
161 | return filename; |
|
|
162 | } |
|
|
163 | |
|
|
164 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
|
|
165 | |
|
|
166 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
|
|
167 | |
|
|
168 | static int |
|
|
169 | uu_info_file (void *cb, char *info) |
157 | { |
170 | { |
158 | dSP; |
|
|
159 | int count; |
|
|
160 | int retval; |
171 | int retval; |
161 | SV *xfname = newSVpv ("", 0); |
172 | |
162 | STRLEN dc; |
173 | TEMP_ACQUIRE { |
|
|
174 | |
|
|
175 | dSP; |
|
|
176 | int count; |
163 | |
177 | |
164 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,3); |
178 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
165 | |
179 | |
166 | PUSHs(sv_2mortal(newSVpv(id,0))); |
180 | PUSHs(sv_2mortal(newSVpv(info,0))); |
167 | PUSHs(sv_2mortal(xfname)); |
|
|
168 | PUSHs(sv_2mortal(newSViv(retrieve))); |
|
|
169 | |
181 | |
170 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
182 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
171 | |
183 | |
172 | if (count != 1) |
184 | if (count != 1) |
173 | croak ("filecallback perl callback returned more than one argument"); |
|
|
174 | |
|
|
175 | strcpy (fname, SvPV (xfname, dc)); |
|
|
176 | |
|
|
177 | retval = POPi; |
|
|
178 | |
|
|
179 | PUTBACK; FREETMPS; LEAVE; |
|
|
180 | |
|
|
181 | return retval; |
|
|
182 | } |
|
|
183 | |
|
|
184 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv; |
|
|
185 | |
|
|
186 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
|
|
187 | |
|
|
188 | static int uu_info_file(void *cb, char *info) |
|
|
189 | { |
|
|
190 | dSP; |
|
|
191 | int count; |
|
|
192 | int retval; |
|
|
193 | |
|
|
194 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); |
|
|
195 | |
|
|
196 | PUSHs(sv_2mortal(newSVpv(info,0))); |
|
|
197 | |
|
|
198 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; |
|
|
199 | |
|
|
200 | if (count != 1) |
|
|
201 | croak ("info_file perl callback returned more than one argument"); |
185 | croak ("info_file perl callback returned more than one argument"); |
202 | |
186 | |
203 | retval = POPi; |
187 | retval = POPi; |
204 | |
188 | |
205 | PUTBACK; FREETMPS; LEAVE; |
189 | PUTBACK; FREETMPS; LEAVE; |
|
|
190 | |
|
|
191 | } TEMP_RELEASE; |
206 | |
192 | |
207 | return retval; |
193 | return retval; |
208 | } |
194 | } |
209 | |
195 | |
210 | static int |
196 | static int |
… | |
… | |
219 | default: |
205 | default: |
220 | return 0; |
206 | return 0; |
221 | } |
207 | } |
222 | } |
208 | } |
223 | |
209 | |
224 | 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 | } |
225 | |
218 | |
226 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
219 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
227 | |
220 | |
228 | PROTOTYPES: ENABLE |
221 | PROTOTYPES: ENABLE |
229 | |
222 | |
230 | int |
|
|
231 | constant(name) |
|
|
232 | char * name |
|
|
233 | |
|
|
234 | |
|
|
235 | void |
223 | void |
236 | UUInitialize() |
224 | UUCleanUp () |
237 | CODE: |
225 | CODE: |
238 | if (!uu_initialized) |
226 | UUCleanUp (); |
|
|
227 | initialise (); |
|
|
228 | |
|
|
229 | SV * |
|
|
230 | UUGetOption (opt) |
|
|
231 | int opt |
|
|
232 | CODE: |
|
|
233 | { |
|
|
234 | if (opt == UUOPT_PROGRESS) |
|
|
235 | croak ("GetOption(UUOPT_PROGRESS) is not yet implemented"); |
|
|
236 | else if (uu_opt_isstring (opt)) |
239 | { |
237 | { |
240 | int retval; |
238 | char cval[8192]; |
241 | |
239 | |
242 | if ((retval = UUInitialize ()) != UURET_OK) |
240 | UUGetOption (opt, 0, cval, sizeof cval); |
243 | croak ("unable to initialize uudeview library (%s)", UUstrerror (retval)); |
241 | RETVAL = newSVpv (cval, 0); |
244 | |
|
|
245 | uu_initialized = 1; |
|
|
246 | } |
242 | } |
247 | |
|
|
248 | void |
|
|
249 | UUCleanUp() |
|
|
250 | CODE: |
|
|
251 | if (uu_initialized) |
|
|
252 | UUCleanUp (); |
|
|
253 | |
|
|
254 | uu_initialized = 0; |
|
|
255 | |
|
|
256 | SV * |
|
|
257 | UUGetOption(opt) |
|
|
258 | int opt |
|
|
259 | CODE: |
|
|
260 | { |
|
|
261 | if (opt == UUOPT_PROGRESS) |
|
|
262 | croak ("GetOption(UUOPT_PROGRESS) is not yet implemented"); |
|
|
263 | else if (uu_opt_isstring (opt)) |
|
|
264 | { |
|
|
265 | char cval[8192]; |
|
|
266 | |
|
|
267 | UUGetOption (opt, 0, cval, sizeof cval); |
|
|
268 | RETVAL = newSVpv (cval, 0); |
|
|
269 | } |
|
|
270 | else |
243 | else |
271 | { |
244 | { |
272 | RETVAL = newSViv (UUGetOption (opt, 0, 0, 0)); |
245 | RETVAL = newSViv (UUGetOption (opt, 0, 0, 0)); |
273 | } |
246 | } |
274 | } |
247 | } |
275 | OUTPUT: |
248 | OUTPUT: |
276 | RETVAL |
249 | RETVAL |
277 | |
250 | |
278 | int |
251 | int |
279 | UUSetOption(opt,val) |
252 | UUSetOption (opt, val) |
280 | int opt |
253 | int opt |
281 | SV * val |
254 | SV * val |
282 | CODE: |
255 | CODE: |
283 | { |
256 | { |
284 | STRLEN dc; |
257 | STRLEN dc; |
285 | |
258 | |
286 | if (uu_opt_isstring (opt)) |
259 | if (uu_opt_isstring (opt)) |
287 | RETVAL = UUSetOption (opt, 0, SvPV (val, dc)); |
260 | RETVAL = UUSetOption (opt, 0, SvPV (val, dc)); |
288 | else |
261 | else |
289 | RETVAL = UUSetOption (opt, SvIV (val), (void *)0); |
262 | RETVAL = UUSetOption (opt, SvIV (val), (void *)0); |
290 | } |
263 | } |
291 | OUTPUT: |
264 | OUTPUT: |
292 | RETVAL |
265 | RETVAL |
293 | |
266 | |
294 | char * |
267 | char * |
295 | UUstrerror(errcode) |
268 | UUstrerror (errcode) |
296 | int errcode |
269 | int errcode |
297 | |
270 | |
298 | void |
271 | void |
299 | UUSetMsgCallback(func=0) |
272 | UUSetMsgCallback (func = 0) |
300 | SV * func |
273 | SV * func |
301 | CODE: |
274 | CODE: |
302 | UUSetMsgCallback (FUNC_CB(uu_msg)); |
275 | UUSetMsgCallback (FUNC_CB (uu_msg)); |
303 | |
276 | |
304 | void |
277 | void |
305 | UUSetBusyCallback(func=0,msecs=1000) |
278 | UUSetBusyCallback (func = 0,msecs = 1000) |
306 | SV * func |
279 | SV * func |
307 | long msecs |
280 | long msecs |
308 | CODE: |
281 | CODE: |
309 | UUSetBusyCallback (FUNC_CB(uu_busy), msecs); |
282 | UUSetBusyCallback (FUNC_CB (uu_busy), msecs); |
310 | |
283 | |
311 | void |
284 | void |
312 | UUSetFileCallback(func=0) |
285 | UUSetFileCallback (func = 0) |
313 | SV * func |
286 | SV * func |
314 | CODE: |
287 | CODE: |
315 | UUSetFileCallback (FUNC_CB(uu_file)); |
288 | UUSetFileCallback (FUNC_CB (uu_file)); |
316 | |
289 | |
317 | void |
290 | void |
318 | UUSetFNameFilter(func=0) |
291 | UUSetFNameFilter (func = 0) |
319 | SV * func |
292 | SV * func |
320 | CODE: |
293 | CODE: |
321 | UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); |
294 | UUSetFNameFilter (FUNC_CB (uu_fnamefilter)); |
|
|
295 | |
|
|
296 | void |
|
|
297 | UUSetFileNameCallback (func = 0) |
|
|
298 | SV * func |
|
|
299 | CODE: |
|
|
300 | UUSetFileNameCallback (FUNC_CB (uu_filename)); |
322 | |
301 | |
323 | char * |
302 | char * |
324 | UUFNameFilter(fname) |
303 | UUFNameFilter (fname) |
325 | char * fname |
304 | char * fname |
326 | |
305 | |
327 | void |
306 | void |
328 | UULoadFile(fname,id=0,delflag=0) |
307 | UULoadFile (fname, id = 0, delflag = 0, partno = -1) |
329 | char * fname |
308 | char * fname |
330 | char * id |
309 | char * id |
331 | int delflag |
310 | int delflag |
|
|
311 | int partno |
332 | PPCODE: |
312 | PPCODE: |
333 | { |
313 | { |
334 | int count; |
314 | int count; |
335 | |
315 | IV ret; |
336 | XPUSHs(sv_2mortal(newSViv(UULoadFile (fname, id, delflag, &count)))); |
316 | |
|
|
317 | RELEASE; |
|
|
318 | ret = UULoadFileWithPartNo (fname, id, delflag, partno, &count); |
|
|
319 | ACQUIRE; |
|
|
320 | |
|
|
321 | XPUSHs (sv_2mortal (newSViv (ret))); |
337 | if (GIMME_V == G_ARRAY) |
322 | if (GIMME_V == G_ARRAY) |
338 | XPUSHs(sv_2mortal(newSViv(count))); |
323 | XPUSHs (sv_2mortal (newSViv (count))); |
339 | } |
324 | } |
340 | |
325 | |
341 | int |
326 | int |
342 | UUSmerge(pass) |
327 | UUSmerge (pass) |
343 | int pass |
328 | int pass |
344 | |
329 | |
345 | int |
330 | int |
346 | UUQuickDecode(datain,dataout,boundary,maxpos) |
331 | UUQuickDecode(datain,dataout,boundary,maxpos) |
347 | FILE * datain |
332 | FILE * datain |
… | |
… | |
417 | char * from |
402 | char * from |
418 | char * subject |
403 | char * subject |
419 | int isemail |
404 | int isemail |
420 | |
405 | |
421 | uulist * |
406 | uulist * |
422 | UUGetFileListItem(num) |
407 | UUGetFileListItem (num) |
423 | int num |
408 | int num |
424 | |
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 | |
|
|
420 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
|
|
421 | |
425 | int |
422 | int |
426 | UURenameFile(item,newname) |
423 | rename (item, newname) |
427 | uulist *item |
424 | uulist *item |
428 | char * newname |
425 | char * newname |
429 | ALIAS: |
426 | CODE: |
430 | Convert::UUlib::Item::rename = 1 |
427 | RETVAL = UURenameFile (item, newname); |
|
|
428 | OUTPUT: |
|
|
429 | RETVAL |
431 | |
430 | |
432 | int |
431 | int |
433 | UUDecodeToTemp(item) |
432 | decode_temp (item) |
434 | uulist *item |
433 | uulist *item |
435 | ALIAS: |
434 | CODE: |
436 | Convert::UUlib::Item::decode_temp = 1 |
435 | RELEASE; |
|
|
436 | RETVAL = UUDecodeToTemp (item); |
|
|
437 | ACQUIRE; |
|
|
438 | OUTPUT: |
|
|
439 | RETVAL |
437 | |
440 | |
438 | int |
441 | int |
439 | UURemoveTemp(item) |
442 | remove_temp (item) |
440 | uulist *item |
443 | uulist *item |
441 | ALIAS: |
444 | CODE: |
442 | Convert::UUlib::Item::remove_temp = 1 |
445 | RELEASE; |
|
|
446 | RETVAL = UURemoveTemp (item); |
|
|
447 | ACQUIRE; |
|
|
448 | OUTPUT: |
|
|
449 | RETVAL |
443 | |
450 | |
444 | int |
451 | int |
445 | UUDecodeFile(item,target=0) |
452 | decode (item, target = 0) |
446 | uulist *item |
453 | uulist *item |
447 | char * target |
454 | char * target |
448 | ALIAS: |
455 | CODE: |
449 | Convert::UUlib::Item::decode = 1 |
456 | RELEASE; |
|
|
457 | RETVAL = UUDecodeFile (item, target); |
|
|
458 | ACQUIRE; |
|
|
459 | OUTPUT: |
|
|
460 | RETVAL |
450 | |
461 | |
451 | void |
462 | void |
452 | UUInfoFile(item,func) |
463 | info (item, func) |
453 | uulist *item |
464 | uulist *item |
454 | SV * func |
465 | SV * func |
455 | CODE: |
466 | CODE: |
|
|
467 | RELEASE; |
456 | UUInfoFile(item,(void *)func,uu_info_file); |
468 | UUInfoFile (item, (void *)func, uu_info_file); |
457 | ALIAS: |
469 | ACQUIRE; |
458 | Convert::UUlib::Item::info = 1 |
|
|
459 | |
|
|
460 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
|
|
461 | |
470 | |
462 | short |
471 | short |
463 | state(li) |
472 | state(li) |
464 | uulist *li |
473 | uulist *li |
465 | CODE: |
474 | CODE: |
… | |
… | |
493 | RETVAL = li->size; |
502 | RETVAL = li->size; |
494 | OUTPUT: |
503 | OUTPUT: |
495 | RETVAL |
504 | RETVAL |
496 | |
505 | |
497 | char * |
506 | char * |
498 | filename(li,newfilename=0) |
507 | filename (li, newfilename = 0) |
499 | uulist *li |
508 | uulist *li |
500 | char * newfilename |
509 | char * newfilename |
501 | CODE: |
510 | CODE: |
502 | if (newfilename) |
511 | if (newfilename) |
503 | { |
512 | { |
504 | FP_free (li->filename); |
513 | _FP_free (li->filename); |
505 | li->filename = FP_strdup (newfilename); |
514 | li->filename = _FP_strdup (newfilename); |
506 | } |
515 | } |
507 | RETVAL = li->filename; |
516 | RETVAL = li->filename; |
508 | OUTPUT: |
517 | OUTPUT: |
509 | RETVAL |
518 | RETVAL |
510 | |
519 | |
511 | char * |
520 | char * |
512 | subfname(li) |
521 | subfname (li) |
513 | uulist *li |
522 | uulist *li |
514 | CODE: |
523 | CODE: |
515 | RETVAL = li->subfname; |
524 | RETVAL = li->subfname; |
516 | OUTPUT: |
525 | OUTPUT: |
517 | RETVAL |
526 | RETVAL |
518 | |
527 | |
519 | char * |
528 | char * |
520 | mimeid(li) |
529 | mimeid (li) |
521 | uulist *li |
530 | uulist *li |
522 | CODE: |
531 | CODE: |
523 | RETVAL = li->mimeid; |
532 | RETVAL = li->mimeid; |
524 | OUTPUT: |
533 | OUTPUT: |
525 | RETVAL |
534 | RETVAL |
526 | |
535 | |
527 | char * |
536 | char * |
528 | mimetype(li) |
537 | mimetype (li) |
529 | uulist *li |
538 | uulist *li |
530 | CODE: |
539 | CODE: |
531 | RETVAL = li->mimetype; |
540 | RETVAL = li->mimetype; |
532 | OUTPUT: |
541 | OUTPUT: |
533 | RETVAL |
542 | RETVAL |
534 | |
543 | |
535 | char * |
544 | char * |
536 | binfile(li) |
545 | binfile (li) |
537 | uulist *li |
546 | uulist *li |
538 | CODE: |
547 | CODE: |
539 | RETVAL = li->binfile; |
548 | RETVAL = li->binfile; |
540 | OUTPUT: |
549 | OUTPUT: |
541 | RETVAL |
550 | RETVAL |
542 | |
551 | |
543 | # functions accessing internal data(!) |
552 | # methods accessing internal data(!) |
544 | |
553 | |
545 | void |
554 | void |
546 | parts(li) |
555 | parts (li) |
547 | uulist *li |
556 | uulist *li |
548 | PPCODE: |
557 | PPCODE: |
549 | { |
558 | { |
550 | struct _uufile *p = li->thisfile; |
559 | struct _uufile *p = li->thisfile; |
551 | |
560 | |
552 | while (p) |
561 | while (p) |
553 | { |
562 | { |
554 | HV *pi = newHV (); |
563 | HV *pi = newHV (); |
555 | |
564 | |
556 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); |
565 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); |
557 | |
|
|
558 | if (p->filename) |
|
|
559 | hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); |
566 | if (p->filename ) hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); |
560 | if(p->subfname) |
|
|
561 | hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); |
567 | if (p->subfname ) hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); |
562 | if(p->mimeid) |
568 | if (p->mimeid ) hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); |
563 | hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); |
|
|
564 | if(p->mimetype) |
|
|
565 | hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); |
569 | if (p->mimetype ) hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); |
566 | if (p->data->subject) |
|
|
567 | 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); |
568 | if (p->data->origin) |
571 | if (p->data->origin ) hv_store (pi, "origin" , 6, newSVpv (p->data->origin ,0), 0); |
569 | 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); |
570 | if (p->data->sfname) |
|
|
571 | hv_store (pi, "sfname" , 6, newSVpv (p->data->sfname ,0), 0); |
|
|
572 | |
573 | |
573 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
574 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
574 | |
575 | |
575 | p = p->NEXT; |
576 | p = p->NEXT; |
576 | } |
|
|
577 | } |
577 | } |
|
|
578 | } |
578 | |
579 | |
579 | 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 | |
580 | uu_msg_sv = newSVsv(&PL_sv_undef); |
654 | uu_msg_sv = newSVsv (&PL_sv_undef); |
581 | uu_busy_sv = newSVsv(&PL_sv_undef); |
655 | uu_busy_sv = newSVsv (&PL_sv_undef); |
582 | uu_file_sv = newSVsv(&PL_sv_undef); |
656 | uu_file_sv = newSVsv (&PL_sv_undef); |
583 | uu_fnamefilter_sv = newSVsv(&PL_sv_undef); |
657 | uu_fnamefilter_sv = newSVsv (&PL_sv_undef); |
|
|
658 | uu_filename_sv = newSVsv (&PL_sv_undef); |
584 | |
659 | |
|
|
660 | initialise (); |
|
|
661 | } |
|
|
662 | |