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

Comparing Convert-UUlib/uulib/uuint.h (file contents):
Revision 1.2.2.5 by root, Sun Apr 18 19:55:46 2004 UTC vs.
Revision 1.17 by root, Sat Sep 24 10:55:42 2022 UTC

15 */ 15 */
16 16
17#ifndef __UUINT_H__ 17#ifndef __UUINT_H__
18#define __UUINT_H__ 18#define __UUINT_H__
19 19
20#include <stdio.h>
21
22#include "uudeview.h"
23
20/* 24/*
21 * This file describes the internal structures, variables and definitions 25 * This file describes the internal structures, variables and definitions
22 * of UUDeview. It should not be included from other packages. Subject to 26 * of UUDeview. It should not be included from other packages. Subject to
23 * change without notice. Do not depend on anything here. 27 * change without notice. Do not depend on anything here.
24 * 28 */
25 * $Id: uuint.h,v 1.2.2.5 2004/04/18 19:55:46 root Exp $
26 */
27 29
28#ifndef _ANSI_ARGS_ 30#if COMPILE_SEPERATELY
29#ifdef PROTOTYPES 31#define UULIBINT_VAR extern
30#define _ANSI_ARGS_(c) c 32#define UULIBINT_FUNC
31#else 33#else
32#define _ANSI_ARGS_(c) () 34#define UULIBINT_VAR extern
33#endif 35#define UULIBINT_FUNC static
34#endif 36#endif
35 37
36/* 38/*
37 * Busy Polls will be made after processing ... lines 39 * Busy Polls will be made after processing ... lines
38 */ 40 */
75 * by zero for b<100 and the result doesn't become larger than 100% 77 * by zero for b<100 and the result doesn't become larger than 100%
76 */ 78 */
77 79
78#define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ 80#define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \
79 (((unsigned long)(b)/100)+1))) 81 (((unsigned long)(b)/100)+1)))
80 82
81/* 83/*
82 * Make the Busy Callback easier. The macro returns true if the BusyCallback 84 * Make the Busy Callback easier. The macro returns true if the BusyCallback
83 * wants us to terminate. 85 * wants us to terminate.
84 */ 86 */
85 87
86extern unsigned long uuyctr; 88UULIBINT_VAR unsigned long uuyctr;
87#define UUBUSYPOLL(a,b) (((++uuyctr%BUSY_LINE_TICKS)==0) ? (progress.percent=UUPERCENT((a),(b)),UUBusyPoll()):0) 89#define UUBUSYPOLL(a,b) (((++uuyctr%BUSY_LINE_TICKS)==0) ? (progress.percent=UUPERCENT((a),(b)),UUBusyPoll()):0)
88 90
89/* 91/*
90 * How many lines of headers do we need to believe another mail 92 * How many lines of headers do we need to believe another mail
91 * header is approaching? Use more restrictive values for MIME 93 * header is approaching? Use more restrictive values for MIME
96 int restart; /* restarting after a MIME body (not subpart) */ 98 int restart; /* restarting after a MIME body (not subpart) */
97 int afterdata; /* after we had useful data in freestyle mode */ 99 int afterdata; /* after we had useful data in freestyle mode */
98 int afternl; /* after an empty line in freestyle mode */ 100 int afternl; /* after an empty line in freestyle mode */
99} headercount; 101} headercount;
100 102
101extern headercount hlcount; 103UULIBINT_VAR headercount hlcount;
102 104
103/* 105/*
104 * Information from the headers of a message. Each instance must 106 * Information from the headers of a message. Each instance must
105 * have its very own copy of the strings. If `mimevers' is NULL, 107 * have its very own copy of the strings. If `mimevers' is NULL,
106 * then this message does not comply to the MIME standard. 108 * then this message does not comply to the MIME standard.
132 int mimeenc; /* encoding of this MIME file */ 134 int mimeenc; /* encoding of this MIME file */
133 char *source; /* source filename */ 135 char *source; /* source filename */
134 headers envelope; /* mail envelope headers */ 136 headers envelope; /* mail envelope headers */
135} scanstate; 137} scanstate;
136 138
137/* 139UULIBINT_VAR void *uu_MsgCBArg;
138 * Structure that holds the information for a single file / part of 140UULIBINT_VAR void *uu_BusyCBArg;
139 * a file. If a subject line is encountered, it is copied to subject; 141UULIBINT_VAR void *uu_FileCBArg;
140 * if a begin is found, the mode and name of the file is extracted. 142UULIBINT_VAR void *uu_FFCBArg;
141 * flags are set if 'begin' or 'end' is detected and 'uudet' if valid 143UULIBINT_VAR void *uu_FNCBArg;
142 * uuencoded data is found. If the file contains a 'From:' line with
143 * a '@' in it (indicating an origin email address), it is preserved
144 * in 'origin'.
145 **/
146
147typedef struct _fileread {
148 char *subject; /* Whole subject line */
149 char *filename; /* Only filled in if begin detected */
150 char *origin; /* Whole 'From:' line */
151 char *mimeid; /* the ID for Mime-encoded files */
152 char *mimetype; /* Content-Type */
153 short mode; /* Mode of File (from 'begin') */
154 int begin; /* begin detected */
155 int end; /* end detected */
156 int flags; /* associated flags */
157
158 short uudet; /* valid encoded data. value indicates encoding */
159 short partno; /* Mime-files have a part number within */
160 short maxpno; /* ... plus the total number of parts */
161
162 char *sfname; /* Associated source file */
163 long startpos; /* ftell() position where data starts */
164 long length; /* length of data */
165} fileread;
166
167/*
168 * Structure for holding one part of a file, with some more information
169 * about it. The UUPreProcessPart() function takes one a fileread structure
170 * and produces this uufile structure.
171 * Linked List, ordered by partno.
172 **/
173
174typedef struct _uufile {
175 char *filename;
176 char *subfname;
177 char *mimeid;
178 char *mimetype;
179 short partno;
180 fileread *data;
181 struct _uufile *NEXT;
182} uufile;
183
184extern void *uu_MsgCBArg;
185extern void *uu_BusyCBArg;
186extern void *uu_FileCBArg;
187extern void *uu_FFCBArg;
188 144
189/* 145/*
190 * variables 146 * variables
191 */ 147 */
192 148
193extern int uu_fast_scanning; 149UULIBINT_VAR int uu_autocheck;
194extern int uu_bracket_policy; 150UULIBINT_VAR int uu_rbuf;
195extern int uu_verbose; 151UULIBINT_VAR int uu_wbuf;
196extern int uu_desperate; 152#define UUSETBUF(fp,buff,size) if (size) setvbuf ((fp), ((buff) = malloc (size)), _IOFBF, (size))
197extern int uu_ignreply; 153#define UUCLRBUF(size,buff) if (size) free (buff)
198extern int uu_debug;
199extern int uu_errno;
200extern int uu_dumbness;
201extern int uu_overwrite;
202extern int uu_ignmode;
203extern int uu_headercount;
204extern int uu_usepreamble;
205extern int uu_handletext;
206extern int uu_tinyb64;
207extern int uu_remove_input;
208extern int uu_more_mime;
209 154
210extern char *uusavepath; 155UULIBINT_VAR int uu_fast_scanning;
211extern char *uuencodeext; 156UULIBINT_VAR int uu_bracket_policy;
157UULIBINT_VAR int uu_verbose;
158UULIBINT_VAR int uu_desperate;
159UULIBINT_VAR int uu_ignreply;
160UULIBINT_VAR int uu_debug;
161UULIBINT_VAR int uu_errno;
162UULIBINT_VAR int uu_dumbness;
163UULIBINT_VAR int uu_overwrite;
164UULIBINT_VAR int uu_ignmode;
165UULIBINT_VAR int uu_headercount;
166UULIBINT_VAR int uu_usepreamble;
167UULIBINT_VAR int uu_handletext;
168UULIBINT_VAR int uu_tinyb64;
169UULIBINT_VAR int uu_remove_input;
170UULIBINT_VAR int uu_more_mime;
171UULIBINT_VAR int uu_dotdot;
172
173UULIBINT_VAR char *uusavepath;
174UULIBINT_VAR char *uuencodeext;
212 175
213/* 176/*
214 * Encoding/Decoding tables 177 * Encoding/Decoding tables
215 */ 178 */
216 179
217extern unsigned char UUEncodeTable[]; 180UULIBINT_VAR unsigned char UUEncodeTable[];
218extern unsigned char XXEncodeTable[]; 181UULIBINT_VAR unsigned char XXEncodeTable[];
219extern unsigned char B64EncodeTable[]; 182UULIBINT_VAR unsigned char B64EncodeTable[];
220extern unsigned char BHEncodeTable[]; 183UULIBINT_VAR unsigned char BHEncodeTable[];
221 184
222/* 185/*
223 * String tables from uustring.c 186 * String tables from uustring.c
224 */ 187 */
225 188
226extern char *msgnames[]; 189UULIBINT_VAR char *msgnames[];
227extern char *codenames[]; 190UULIBINT_VAR char *codenames[];
228extern char *uuretcodes[]; 191UULIBINT_VAR char *uuretcodes[];
229
230extern uulist *UUGlobalFileList;
231 192
232/* 193/*
233 * State of MIME variables and current progress 194 * State of MIME variables and current progress
234 */ 195 */
235 196
236extern int nofnum, mssdepth; 197UULIBINT_VAR int nofnum, mssdepth;
237extern int mimseqno, lastvalid; 198UULIBINT_VAR int mimseqno, lastvalid;
238extern int lastenc; 199UULIBINT_VAR int lastenc;
239extern scanstate multistack[]; 200UULIBINT_VAR scanstate multistack[];
240extern headers localenv; 201UULIBINT_VAR headers localenv;
241extern scanstate sstate; 202UULIBINT_VAR scanstate sstate;
242extern uuprogress progress; 203UULIBINT_VAR uuprogress progress;
243 204
244/* 205/*
245 * mallocable areas 206 * mallocable areas
246 */ 207 */
247 208
248extern char *uugen_fnbuffer, *uugen_inbuffer; 209UULIBINT_VAR char *uugen_fnbuffer, *uugen_inbuffer;
249extern char *uucheck_lastname, *uucheck_tempname; 210UULIBINT_VAR char *uucheck_lastname, *uucheck_tempname;
250extern char *uuestr_itemp, *uuestr_otemp; 211UULIBINT_VAR char *uuestr_itemp, *uuestr_otemp;
251extern char *uulib_msgstring, *uuncdl_fulline; 212UULIBINT_VAR char *uulib_msgstring, *uuncdl_fulline;
252extern char *uuncdp_oline, *uuscan_shlline, *uuscan_shlline2; 213UULIBINT_VAR char *uuncdp_oline, *uuscan_shlline, *uuscan_shlline2;
253extern char *uuscan_pvvalue, *uuscan_phtext; 214UULIBINT_VAR char *uuscan_pvvalue, *uuscan_phtext;
254extern char *uuscan_sdline, *uuscan_sdbhds1; 215UULIBINT_VAR char *uuscan_sdline, *uuscan_sdbhds1;
255extern char *uuscan_sdbhds2, *uuscan_spline; 216UULIBINT_VAR char *uuscan_sdbhds2, *uuscan_spline;
256extern char *uuutil_bhwtmp; 217UULIBINT_VAR char *uuutil_bhwtmp;
257extern char *uunconc_UUxlat, *uunconc_UUxlen; 218UULIBINT_VAR char *uunconc_UUxlat, *uunconc_UUxlen;
258extern char *uunconc_B64xlat, *uunconc_XXxlat; 219UULIBINT_VAR char *uunconc_B64xlat, *uunconc_XXxlat;
259extern char *uunconc_BHxlat, *uunconc_save; 220UULIBINT_VAR char *uunconc_BHxlat, *uunconc_save;
260 221
261#ifdef __cplusplus 222#ifdef __cplusplus
262extern "C" { 223extern "C" {
263#endif 224#endif
264 225
265extern void (*uu_MsgCallback) _ANSI_ARGS_((void *, char *, int));
266extern int (*uu_BusyCallback) _ANSI_ARGS_((void *, uuprogress *));
267extern int (*uu_FileCallback) _ANSI_ARGS_((void *, char *, char *, int));
268extern char * (*uu_FNameFilter) _ANSI_ARGS_((void *, char *));
269
270/* 226/*
271 * Functions from uulib.c that aren't defined in <uudeview.h> 227 * Functions from uulib.c that aren't defined in <uudeview.h>
272 * Be careful about the definition with variable arguments. 228 * Be careful about the definition with variable arguments.
273 */ 229 */
274 230
275#if defined(STDC_HEADERS) || defined(HAVE_STDARG_H) 231#define UUMessage(level, ...) UUMessage_ (__FILE__, __LINE__ * 16 + level, __VA_ARGS__)
276int UUMessage _ANSI_ARGS_((char *, int, 232UULIBINT_FUNC int UUMessage_ (const char *, int, const char *, ...);
277 int, char *, ...)); 233UULIBINT_FUNC int UUBusyPoll (void);
278#else
279int UUMessage ();
280#endif
281int UUBusyPoll _ANSI_ARGS_((void));
282 234
283/* 235/*
284 * Functions from uucheck.c 236 * Functions from uucheck.c
285 */ 237 */
286 238
287uufile * UUPreProcessPart _ANSI_ARGS_((fileread *, int *)); 239UULIBINT_FUNC uufile * UUPreProcessPart (fileread *, int *);
288int UUInsertPartToList _ANSI_ARGS_((uufile *)); 240UULIBINT_FUNC int UUInsertPartToList (uufile *);
289uulist * UUCheckGlobalList _ANSI_ARGS_((void));
290 241
291/* 242/*
292 * Functions from uuutil.c 243 * Functions from uuutil.c
293 */ 244 */
294 245
295void UUkillfread _ANSI_ARGS_((fileread *)); 246UULIBINT_FUNC void UUkillfread (fileread *);
296void UUkillfile _ANSI_ARGS_((uufile *)); 247UULIBINT_FUNC void UUkillfile (uufile *);
297void UUkilllist _ANSI_ARGS_((uulist *)); 248UULIBINT_FUNC void UUkilllist (uulist *);
298void UUkillheaders _ANSI_ARGS_((headers *)); 249UULIBINT_FUNC void UUkillheaders (headers *);
299 250
300fileread * ScanPart _ANSI_ARGS_((FILE *, char *, int *)); 251UULIBINT_FUNC fileread *UUScanPart (FILE *, char *, int *);
301 252
302int UUbhdecomp _ANSI_ARGS_((char *, char *, 253UULIBINT_FUNC int UUbhdecomp (char *, char *,
303 char *, int *, 254 char *, int *,
304 size_t, size_t, 255 size_t, size_t,
305 size_t *)); 256 size_t *);
306size_t UUbhwrite _ANSI_ARGS_((char *, size_t, size_t, 257UULIBINT_FUNC size_t UUbhwrite (char *, size_t, size_t, FILE *);
307 FILE *));
308 258
309/* 259/*
310 * Functions from uunconc.c 260 * Functions from uunconc.c
311 */ 261 */
312 262
313int UURepairData _ANSI_ARGS_((FILE *, char *, 263UULIBINT_FUNC int UURepairData (FILE *, char *, int, int *);
314 int, int *));
315 264
316void UUInitConc _ANSI_ARGS_((void)); 265UULIBINT_FUNC void UUInitConc (void);
317int UUValidData _ANSI_ARGS_((char *, int, int *)); 266UULIBINT_FUNC int UUValidData (char *, int, int *);
318size_t UUDecodeLine _ANSI_ARGS_((char *, char *, int)); 267UULIBINT_FUNC size_t UUDecodeLine (char *, char *, int);
319int UUDecodeField _ANSI_ARGS_((char *, char *, int)); 268UULIBINT_FUNC int UUDecodeField (char *, char *, int);
320int UUDecodePart _ANSI_ARGS_((FILE *, FILE *, int *, 269UULIBINT_FUNC int UUDecodePart (FILE *, FILE *, int *,
321 long, int, int, char *)); 270 long, int, int, char *);
322int UUDecode _ANSI_ARGS_((uulist *)); 271UULIBINT_FUNC int UUDecode (uulist *);
323 272
324/* 273/*
325 * Message retrieval from uustring.c 274 * Message retrieval from uustring.c
326 */ 275 */
327 276
328char * uustring _ANSI_ARGS_((int)); 277UULIBINT_FUNC char * uustring (int);
329 278
330/* 279/*
331 * From uuscan.c 280 * From uuscan.c
332 */ 281 */
333 282
334int UUScanHeader _ANSI_ARGS_((FILE *, headers *)); 283UULIBINT_FUNC int UUScanHeader (FILE *, headers *);
335 284
336#ifdef __cplusplus 285#ifdef __cplusplus
337} 286}
338#endif 287#endif
339#endif 288#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines