]>
Commit | Line | Data |
---|---|---|
1 | typedef unsigned int size_t; | |
2 | typedef struct _IO_FILE FILE; | |
3 | extern struct _IO_FILE *stdin; | |
4 | enum { | |
5 | __LC_CTYPE = 0, __LC_NUMERIC = 1, __LC_TIME = 2, __LC_COLLATE = | |
6 | 3, __LC_MONETARY = 4, __LC_MESSAGES = 5, __LC_ALL = 6, __LC_PAPER = | |
7 | 7, __LC_NAME = 8, __LC_ADDRESS = 9, __LC_TELEPHONE = | |
8 | 10, __LC_MEASUREMENT = 11, __LC_IDENTIFICATION = 12 | |
9 | }; | |
10 | typedef struct yasm_objfmt_base { | |
11 | const char *extension; | |
12 | } yasm_objfmt_module; | |
13 | static char *obj_filename = ((void *)0), *in_filename = ((void *)0); | |
14 | static const yasm_objfmt_module *cur_objfmt_module = ((void *)0); | |
15 | static int preproc_only = 0; | |
16 | static int generate_make_dependencies = 0; | |
17 | static char *replace_extension(const char *orig, const char *ext, | |
18 | const char *def); | |
19 | static int do_preproc_only(FILE * in) | |
20 | { | |
21 | const char *base_filename; | |
22 | if (!obj_filename || generate_make_dependencies) { | |
23 | if (generate_make_dependencies && !obj_filename) { | |
24 | if (in == stdin) | |
25 | obj_filename = yasm__xstrdup("yasm.out"); | |
26 | else { | |
27 | if (base_filename[0] == '\0') | |
28 | obj_filename = | |
29 | yasm__xstrdup("yasm.out"); | |
30 | else | |
31 | obj_filename = | |
32 | replace_extension(base_filename, | |
33 | cur_objfmt_module-> | |
34 | extension, | |
35 | "yasm.out"); | |
36 | } | |
37 | } | |
38 | } | |
39 | } | |
40 | static int do_assemble(FILE * in) | |
41 | { | |
42 | const char *base_filename; | |
43 | if (!obj_filename) { | |
44 | if (in == stdin) | |
45 | obj_filename = yasm__xstrdup("yasm.out"); | |
46 | else { | |
47 | if (base_filename[0] == '\0') | |
48 | obj_filename = yasm__xstrdup("yasm.out"); | |
49 | else | |
50 | obj_filename = | |
51 | replace_extension(base_filename, | |
52 | cur_objfmt_module-> | |
53 | extension, "yasm.out"); | |
54 | } | |
55 | } | |
56 | } | |
57 | int main(int argc, char *argv[]) | |
58 | { | |
59 | FILE *in = ((void *)0); | |
60 | if (preproc_only) | |
61 | return do_preproc_only(in); | |
62 | return do_assemble(in); | |
63 | } | |
64 | static char *replace_extension(const char *orig, const char *ext, | |
65 | const char *def) | |
66 | { | |
67 | char *out, *outext; | |
68 | out = yasm_xmalloc(strlen(orig) + (ext ? (strlen(ext) + 2) : 1)); | |
69 | if (outext) { | |
70 | if (ext && __extension__( { | |
71 | size_t __s1_len, __s2_len; | |
72 | (__builtin_constant_p(outext) | |
73 | && __builtin_constant_p(ext) | |
74 | && (__s1_len = | |
75 | strlen(outext), __s2_len = | |
76 | strlen(ext), | |
77 | (!((size_t) (const void *) | |
78 | ((outext) + 1) - | |
79 | (size_t) (const void *)(outext) | |
80 | == 1) || __s1_len >= 4) | |
81 | && | |
82 | (!((size_t) (const void *) | |
83 | ((ext) + 1) - | |
84 | (size_t) (const void *)(ext) == | |
85 | 1) | |
86 | || __s2_len >= | |
87 | 4)) ? __builtin_strcmp(outext, | |
88 | ext) | |
89 | : (__builtin_constant_p(outext) | |
90 | && | |
91 | ((size_t) (const void *) | |
92 | ((outext) + 1) - | |
93 | (size_t) (const void *)(outext) == | |
94 | 1) | |
95 | && (__s1_len = | |
96 | strlen(outext), | |
97 | __s1_len < | |
98 | 4) ? (__builtin_constant_p(ext) | |
99 | && | |
100 | ((size_t) (const void *) | |
101 | ((ext) + 1) - | |
102 | (size_t) (const void | |
103 | *)(ext) == | |
104 | 1) ? | |
105 | __builtin_strcmp(outext, | |
106 | ext) | |
107 | : (__extension__( { | |
108 | __const | |
109 | unsigned | |
110 | char | |
111 | *__s2 = | |
112 | (__const | |
113 | unsigned | |
114 | char | |
115 | *) | |
116 | (__const | |
117 | char | |
118 | *) | |
119 | (ext); | |
120 | register | |
121 | int | |
122 | __result | |
123 | = | |
124 | (((__const unsigned char *)(__const char *)(outext))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { | |
125 | } | |
126 | __result;} | |
127 | ))): (__builtin_constant_p(ext) && ((size_t) (const void *)((ext) + 1) - (size_t) (const void *)(ext) == 1) && (__s2_len = strlen(ext), __s2_len < 4) ? (__builtin_constant_p(outext) && ((size_t) (const void *)((outext) + 1) - (size_t) (const void *)(outext) == 1) ? __builtin_strcmp(outext, ext) : (__extension__( { | |
128 | __const | |
129 | unsigned | |
130 | char | |
131 | *__s1 | |
132 | = | |
133 | (__const | |
134 | unsigned | |
135 | char | |
136 | *) | |
137 | (__const | |
138 | char | |
139 | *) | |
140 | (outext); | |
141 | register | |
142 | int | |
143 | __result | |
144 | = | |
145 | __s1 | |
146 | [0] | |
147 | - | |
148 | ((__const unsigned char *)(__const char *)(ext))[0]; if (__s2_len > 0 && __result == 0) { | |
149 | } | |
150 | __result;} | |
151 | ))): __builtin_strcmp(outext, ext))));} | |
152 | ) == 0) { | |
153 | print_error(dcgettext | |
154 | (((void *)0), | |
155 | "file name already ends in `.%s': output will be in `%s'", | |
156 | __LC_MESSAGES), ext, def); | |
157 | } | |
158 | } | |
159 | } |