comparison lwasm/main.c @ 484:469a130e7029

Add option to suppress output file Add --no-output to suppress creation of the output file altogether. Useful when the assembler is used for other features without needing the assembled object.
author William Astle <lost@l-w.ca>
date Tue, 19 Mar 2019 14:45:53 -0600
parents 141a1beb98ae
children 7fbf3171ca15
comparison
equal deleted inserted replaced
483:40c32a0af8c8 484:469a130e7029
62 { "includedir", 'I', "PATH", 0, "Add entry to include path" }, 62 { "includedir", 'I', "PATH", 0, "Add entry to include path" },
63 { "define", 'D', "SYM[=VAL]",0, "Automatically define SYM to be VAL (or 1)"}, 63 { "define", 'D', "SYM[=VAL]",0, "Automatically define SYM to be VAL (or 1)"},
64 { "preprocess", 'P', 0, 0, "Preprocess macros and conditionals and output revised source to stdout" }, 64 { "preprocess", 'P', 0, 0, "Preprocess macros and conditionals and output revised source to stdout" },
65 { "unicorns", 0x142, 0, 0, "Add sooper sekrit sauce"}, 65 { "unicorns", 0x142, 0, 0, "Add sooper sekrit sauce"},
66 { "6800compat", 0x200, 0, 0, "Enable 6800 compatibility instructions, equivalent to --pragma=6800compat" }, 66 { "6800compat", 0x200, 0, 0, "Enable 6800 compatibility instructions, equivalent to --pragma=6800compat" },
67 { "no-output", 0x105, 0, 0, "Inhibit creation of output file" },
67 { 0 } 68 { 0 }
68 }; 69 };
69 70
70 71
71 static int parse_opts(int key, char *arg, void *state) 72 static int parse_opts(int key, char *arg, void *state)
101 } 102 }
102 case 'o': 103 case 'o':
103 if (as -> output_file) 104 if (as -> output_file)
104 lw_free(as -> output_file); 105 lw_free(as -> output_file);
105 as -> output_file = lw_strdup(arg); 106 as -> output_file = lw_strdup(arg);
107 as -> flags &= ~FLAG_NOOUT;
108 break;
109
110 case 0x105:
111 as -> flags |= FLAG_NOOUT;
106 break; 112 break;
107 113
108 case 'd': 114 case 'd':
109 #ifdef LWASM_NODEBUG 115 #ifdef LWASM_NODEBUG
110 fprintf(stderr, "This binary has been built without debugging message support\n"); 116 fprintf(stderr, "This binary has been built without debugging message support\n");
369 { 375 {
370 fprintf(stdout, "%s\n", n); 376 fprintf(stdout, "%s\n", n);
371 lw_free(n); 377 lw_free(n);
372 } 378 }
373 } 379 }
374 else 380 else if ((asmstate.flags & FLAG_NOOUT) == 0)
375 { 381 {
376 debug_message(&asmstate, 50, "Doing output"); 382 debug_message(&asmstate, 50, "Doing output");
377 do_output(&asmstate); 383 do_output(&asmstate);
378 } 384 }
379 385