libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / bin / unzip / gbloffs.c
blob4dd6157b02bbef8372e6fbf864aa2a69792731d1
1 /*
2 Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
4 See the accompanying file LICENSE, version 2000-Apr-09 or later
5 (the contents of which are also included in unzip.h) for terms of use.
6 If, for some reason, all these files are missing, the Info-ZIP license
7 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
8 */
9 /* Write out a fragment of assembly source giving offsets in "Uz_Globs"
10 * and "struct huft":
13 #define UNZIP_INTERNAL
14 #include "unzip.h"
15 #include "crypt.h"
17 #ifndef REENTRANT
18 Uz_Globs G;
19 #endif
21 static int asm_setflag(const char *flagname);
22 static int ccp_setflag(const char *flagname);
24 static int asm_setflag(const char *flagname)
26 static const char asm_flagdef[] = "%-15s EQU 1\n";
27 return printf(asm_flagdef, flagname);
29 static int ccp_setflag(const char *flagname)
31 static const char ccp_flagdef[] = "#ifndef %s\n# define %s\n#endif\n";
32 return printf(ccp_flagdef, flagname, flagname);
35 int main(argc, argv)
36 int argc;
37 char **argv;
39 #ifdef REENTRANT
40 Uz_Globs *pG = NULL;
41 #endif
42 struct huft *t = NULL;
43 static const char asm_offsdef[] = "%-15s EQU %lu\n";
44 static const char ccp_offsdef[] = "#define %-15s %lu\n";
46 const char *out_format;
47 int (*set_flag)(const char *flagname);
48 int ccp_select = 0;
50 if (argc > 1 && argv[1] != NULL && !strcmp(argv[1], "-ccp"))
51 ccp_select = 1;
53 if (ccp_select) {
54 out_format = ccp_offsdef;
55 set_flag = ccp_setflag;
56 } else {
57 out_format = asm_offsdef;
58 set_flag = asm_setflag;
61 printf(out_format, "h_e", (ulg)&t->e - (ulg)t);
62 printf(out_format, "h_b", (ulg)&t->b - (ulg)t);
63 printf(out_format, "h_v_n", (ulg)&t->v.n - (ulg)t);
64 printf(out_format, "h_v_t", (ulg)&t->v.t - (ulg)t);
65 printf(out_format, "SIZEOF_huft", (ulg)sizeof(struct huft));
67 printf(out_format, "bb", (ulg)&G.bb - (ulg)&G);
68 printf(out_format, "bk", (ulg)&G.bk - (ulg)&G);
69 printf(out_format, "wp", (ulg)&G.wp - (ulg)&G);
70 #ifdef FUNZIP
71 printf(out_format, "in", (ulg)&G.in - (ulg)&G);
72 #else
73 printf(out_format, "incnt", (ulg)&G.incnt - (ulg)&G);
74 printf(out_format, "inptr", (ulg)&G.inptr - (ulg)&G);
75 printf(out_format, "csize", (ulg)&G.csize - (ulg)&G);
76 printf(out_format, "mem_mode", (ulg)&G.mem_mode - (ulg)&G);
77 #endif
78 printf(out_format, "redirslide", (ulg)&redirSlide - (ulg)&G);
79 printf(out_format, "SIZEOF_slide", (ulg)sizeof(redirSlide));
80 #if (defined(DLL) && !defined(NO_SLIDE_REDIR))
81 printf(out_format, "_wsize", (ulg)&G._wsize - (ulg)&G);
82 #endif /* DLL && !NO_SLIDE_REDIR */
83 printf(out_format, "CRYPT", (ulg)CRYPT);
84 #ifdef FUNZIP
85 (*set_flag)("FUNZIP");
86 #endif
87 #ifdef SFX
88 (*set_flag)("SFX");
89 #endif
90 #ifdef REENTRANT
91 (*set_flag)("REENTRANT");
92 #endif
93 #ifdef DLL
94 (*set_flag)("DLL");
95 # ifdef NO_SLIDE_REDIR
96 (*set_flag)("NO_SLIDE_REDIR");
97 # endif
98 #endif
99 #ifdef USE_DEFLATE64
100 (*set_flag)("USE_DEFLATE64");
101 #endif
103 return 0;