]>
Commit | Line | Data |
---|---|---|
45516216 | 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 = 3, __LC_MONETARY = 4, __LC_MESSAGES = 5, __LC_ALL = 6, __LC_PAPER = 7, __LC_NAME = 8, __LC_ADDRESS = 9, __LC_TELEPHONE = 10, __LC_MEASUREMENT = 11, __LC_IDENTIFICATION = 12 }; | |
6 | typedef struct yasm_objfmt_base { | |
7 | const char *extension; | |
8 | } | |
9 | yasm_objfmt_module; | |
10 | static char *obj_filename = ((void *)0), *in_filename = ((void *)0); | |
11 | static const yasm_objfmt_module * cur_objfmt_module = ((void *)0); | |
12 | static int preproc_only = 0; | |
13 | static int generate_make_dependencies = 0; | |
14 | static char *replace_extension(const char *orig, const char *ext, const char *def); | |
15 | static int do_preproc_only(FILE *in) { | |
16 | const char *base_filename; | |
17 | if (!obj_filename || generate_make_dependencies) { | |
18 | if (generate_make_dependencies && !obj_filename) { | |
19 | if (in == stdin) obj_filename = yasm__xstrdup("yasm.out"); | |
20 | else { | |
21 | if (base_filename[0] == '\0') obj_filename = yasm__xstrdup("yasm.out"); | |
22 | else obj_filename = replace_extension(base_filename, cur_objfmt_module->extension, "yasm.out"); | |
23 | } | |
24 | } | |
25 | } | |
26 | } | |
27 | static int do_assemble(FILE *in) { | |
28 | const char *base_filename; | |
29 | if (!obj_filename) { | |
30 | if (in == stdin) obj_filename = yasm__xstrdup("yasm.out"); | |
31 | else { | |
32 | if (base_filename[0] == '\0') obj_filename = yasm__xstrdup("yasm.out"); | |
33 | else obj_filename = replace_extension(base_filename, cur_objfmt_module->extension, "yasm.out"); | |
34 | } | |
35 | } | |
36 | } | |
37 | int main(int argc, char *argv[]) { | |
38 | FILE *in = ((void *)0); | |
39 | if (preproc_only) return do_preproc_only(in); | |
40 | return do_assemble(in); | |
41 | } | |
42 | static char * replace_extension(const char *orig, const char *ext, const char *def) { | |
43 | char *out, *outext; | |
44 | out = yasm_xmalloc(strlen(orig)+(ext ? (strlen(ext)+2) : 1)); | |
45 | if (outext) { | |
46 | if (ext && __extension__ ({ | |
47 | size_t __s1_len, __s2_len; | |
48 | (__builtin_constant_p (outext) && __builtin_constant_p (ext) && (__s1_len = strlen (outext), __s2_len = strlen (ext), (!((size_t)(const void *)((outext) + 1) - (size_t)(const void *)(outext) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((ext) + 1) - (size_t)(const void *)(ext) == 1) || __s2_len >= 4)) ? __builtin_strcmp (outext, ext) : (__builtin_constant_p (outext) && ((size_t)(const void *)((outext) + 1) - (size_t)(const void *)(outext) == 1) && (__s1_len = strlen (outext), __s1_len < 4) ? (__builtin_constant_p (ext) && ((size_t)(const void *)((ext) + 1) - (size_t)(const void *)(ext) == 1) ? __builtin_strcmp (outext, ext) : (__extension__ ({ | |
49 | __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (ext); | |
50 | register int __result = (((__const unsigned char *) (__const char *) (outext))[0] - __s2[0]); | |
51 | if (__s1_len > 0 && __result == 0) { | |
52 | } | |
53 | __result; | |
54 | } | |
55 | ))) : (__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__ ({ | |
56 | __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (outext); | |
57 | register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (ext))[0]; | |
58 | if (__s2_len > 0 && __result == 0) { | |
59 | } | |
60 | __result; | |
61 | } | |
62 | ))) : __builtin_strcmp (outext, ext)))); | |
63 | } | |
64 | ) == 0) { | |
65 | print_error( dcgettext (((void *)0), "file name already ends in `.%s': output will be in `%s'", __LC_MESSAGES), ext, def); | |
66 | } | |
67 | } | |
68 | } |