diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2014-04-07 06:04:18 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2014-04-07 06:04:18 +0000 |
commit | fec65e0b5766ade69e086d1c5b859d97494fce56 (patch) | |
tree | c22b07938e9ad590184f1276bc2bead6d888a78d /src/tools | |
parent | 30d94e51c53f30187a1bc565ef33e4744319790e (diff) |
Cleanups and version bumpmame0153
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/nltool.c | 211 | ||||
-rw-r--r-- | src/tools/srcclean.c | 94 | ||||
-rw-r--r-- | src/tools/unidasm.c | 6 |
3 files changed, 155 insertions, 156 deletions
diff --git a/src/tools/nltool.c b/src/tools/nltool.c index 5c86cace00a..2a3e68339da 100644 --- a/src/tools/nltool.c +++ b/src/tools/nltool.c @@ -59,16 +59,16 @@ void free_file_line( void *memory, const char *file, int line ) void CLIB_DECL logerror(const char *format, ...) { - va_list arg; - va_start(arg, format); - vprintf(format, arg); - va_end(arg); + va_list arg; + va_start(arg, format); + vprintf(format, arg); + va_end(arg); } struct options_entry oplist[] = { { "time_to_run;t", "1.0", OPTION_FLOAT, "time to run the emulation (seconds)" }, - { "logs;l", "", OPTION_STRING, "colon separated list of terminals to log" }, + { "logs;l", "", OPTION_STRING, "colon separated list of terminals to log" }, { "f", "-", OPTION_STRING, "file to process (default is stdin)" }, { "listdevices;ld", "", OPTION_BOOLEAN, "list all devices available for use" }, { "help;h", "0", OPTION_BOOLEAN, "display help" }, @@ -123,20 +123,19 @@ public: void init() { - m_setup = new netlist_setup_t(*this); - this->init_object(*this, "netlist"); - m_setup->init(); + m_setup = new netlist_setup_t(*this); + this->init_object(*this, "netlist"); + m_setup->init(); } - void read_netlist(const char *buffer) - { - + void read_netlist(const char *buffer) + { // read the netlist ... - netlist_sources_t sources; + netlist_sources_t sources; - sources.add(netlist_source_t(buffer)); - sources.parse(*m_setup,""); + sources.add(netlist_source_t(buffer)); + sources.parse(*m_setup,""); //m_setup->parse(buffer); log_setup(); @@ -147,37 +146,37 @@ public: this->reset(); } - void log_setup() - { - NL_VERBOSE_OUT(("Creating dynamic logs ...\n")); - nl_util::pstring_list ll = nl_util::split(m_logs, ":"); - for (int i=0; i < ll.count(); i++) - { - netlist_device_t *nc = m_setup->factory().new_device_by_classname("nld_log", *m_setup); - pstring name = "log_" + ll[i]; - m_setup->register_dev(nc, name); - m_setup->register_link(name + ".I", ll[i]); - } - } - - pstring m_logs; + void log_setup() + { + NL_VERBOSE_OUT(("Creating dynamic logs ...\n")); + nl_util::pstring_list ll = nl_util::split(m_logs, ":"); + for (int i=0; i < ll.count(); i++) + { + netlist_device_t *nc = m_setup->factory().new_device_by_classname("nld_log", *m_setup); + pstring name = "log_" + ll[i]; + m_setup->register_dev(nc, name); + m_setup->register_link(name + ".I", ll[i]); + } + } + + pstring m_logs; protected: void verror(const loglevel_e level, const char *format, va_list ap) const { - switch (level) - { - case NL_LOG: - case NL_WARNING: - vprintf(format, ap); - printf("\n"); - break; - case NL_ERROR: - vprintf(format, ap); - printf("\n"); - throw; - break; - } + switch (level) + { + case NL_LOG: + case NL_WARNING: + vprintf(format, ap); + printf("\n"); + break; + case NL_ERROR: + vprintf(format, ap); + printf("\n"); + throw; + break; + } } private: @@ -200,71 +199,71 @@ void usage(core_options &opts) static void run(core_options &opts) { - netlist_tool_t nt; - osd_ticks_t t = osd_ticks(); + netlist_tool_t nt; + osd_ticks_t t = osd_ticks(); - nt.init(); - nt.m_logs = opts.value("l"); - nt.read_netlist(filetobuf(opts.value("f"))); - double ttr = opts.float_value("t"); + nt.init(); + nt.m_logs = opts.value("l"); + nt.read_netlist(filetobuf(opts.value("f"))); + double ttr = opts.float_value("t"); - printf("startup time ==> %5.3f\n", (double) (osd_ticks() - t) / (double) osd_ticks_per_second() ); - printf("runnning ...\n"); - t = osd_ticks(); + printf("startup time ==> %5.3f\n", (double) (osd_ticks() - t) / (double) osd_ticks_per_second() ); + printf("runnning ...\n"); + t = osd_ticks(); - nt.process_queue(netlist_time::from_double(ttr)); + nt.process_queue(netlist_time::from_double(ttr)); - double emutime = (double) (osd_ticks() - t) / (double) osd_ticks_per_second(); - printf("%f seconds emulation took %f real time ==> %5.2f%%\n", ttr, emutime, ttr/emutime*100.0); + double emutime = (double) (osd_ticks() - t) / (double) osd_ticks_per_second(); + printf("%f seconds emulation took %f real time ==> %5.2f%%\n", ttr, emutime, ttr/emutime*100.0); } static void listdevices() { - netlist_tool_t nt; - nt.init(); - const netlist_factory_t::list_t &list = nt.setup().factory().list(); - - nt.setup().start_devices(); - nt.setup().resolve_inputs(); - - for (int i=0; i < list.count(); i++) - { - pstring out = pstring::sprintf("%-20s %s(<id>", list[i]->classname().cstr(), - list[i]->name().cstr() ); - pstring terms(""); - - net_device_t_base_factory *f = list[i]; - netlist_device_t *d = f->Create(); - d->init(nt, pstring::sprintf("dummy%d", i)); - d->start_dev(); - - // get the list of terminals ... - for (int j=0; j < d->m_terminals.count(); j++) - { - pstring inp = d->m_terminals[j]; - if (inp.startsWith(d->name() + ".")) - inp = inp.substr(d->name().len() + 1); - terms += "," + inp; - } - - if (list[i]->param_desc().startsWith("+")) - { - out += "," + list[i]->param_desc().substr(1); - terms = ""; - } - else if (list[i]->param_desc() == "-") - { - /* no params at all */ - } - else - { - out += "," + list[i]->param_desc(); - } - out += ")"; - printf("%s\n", out.cstr()); - if (terms != "") - printf("Terminals: %s\n", terms.substr(1).cstr()); - } + netlist_tool_t nt; + nt.init(); + const netlist_factory_t::list_t &list = nt.setup().factory().list(); + + nt.setup().start_devices(); + nt.setup().resolve_inputs(); + + for (int i=0; i < list.count(); i++) + { + pstring out = pstring::sprintf("%-20s %s(<id>", list[i]->classname().cstr(), + list[i]->name().cstr() ); + pstring terms(""); + + net_device_t_base_factory *f = list[i]; + netlist_device_t *d = f->Create(); + d->init(nt, pstring::sprintf("dummy%d", i)); + d->start_dev(); + + // get the list of terminals ... + for (int j=0; j < d->m_terminals.count(); j++) + { + pstring inp = d->m_terminals[j]; + if (inp.startsWith(d->name() + ".")) + inp = inp.substr(d->name().len() + 1); + terms += "," + inp; + } + + if (list[i]->param_desc().startsWith("+")) + { + out += "," + list[i]->param_desc().substr(1); + terms = ""; + } + else if (list[i]->param_desc() == "-") + { + /* no params at all */ + } + else + { + out += "," + list[i]->param_desc(); + } + out += ")"; + printf("%s\n", out.cstr()); + if (terms != "") + printf("Terminals: %s\n", terms.substr(1).cstr()); + } } /*------------------------------------------------- @@ -291,14 +290,14 @@ int main(int argc, char *argv[]) return 1; } - if (opts.bool_value("ld")) - { - listdevices(); - } - else - { - run(opts); - } + if (opts.bool_value("ld")) + { + listdevices(); + } + else + { + run(opts); + } return 0; } diff --git a/src/tools/srcclean.c b/src/tools/srcclean.c index 5ac248e330d..d0cbb6da0ab 100644 --- a/src/tools/srcclean.c +++ b/src/tools/srcclean.c @@ -33,20 +33,20 @@ static UINT8 modified[MAX_FILE_SIZE]; static int le_convert(char *buffer, int size) { - char *pos; - char *end = buffer + size; - - /* brute force */ - *end = 0; - pos = strchr(buffer, 0x0d); - while (pos != NULL) - { - memmove(pos, pos+1,end - pos + 1); - size--; - buffer = pos + 1; - pos = strchr(buffer, 0x0d); - } - return size; + char *pos; + char *end = buffer + size; + + /* brute force */ + *end = 0; + pos = strchr(buffer, 0x0d); + while (pos != NULL) + { + memmove(pos, pos+1,end - pos + 1); + size--; + buffer = pos + 1; + pos = strchr(buffer, 0x0d); + } + return size; } /*************************************************************************** @@ -55,12 +55,12 @@ static int le_convert(char *buffer, int size) int main(int argc, char *argv[]) { - bool unix_le = false; + bool unix_le = false; int removed_tabs = 0; int added_tabs = 0; int removed_spaces = 0; int removed_continuations = 0; - int fixed_dos_style = 0; + int fixed_dos_style = 0; int fixed_mac_style = 0; int fixed_nix_style = 0; int added_newline = 0; @@ -85,29 +85,29 @@ int main(int argc, char *argv[]) bool dry_run = false; while (arg_found && argc > 1) { - if (strcmp(argv[1], "-u") == 0) - { - unix_le = true; - argc--; - argv++; - } - else if (strcmp(argv[1], "-d") == 0) - { - dry_run = true; - argc--; - argv++; - } - else - arg_found = false; + if (strcmp(argv[1], "-u") == 0) + { + unix_le = true; + argc--; + argv++; + } + else if (strcmp(argv[1], "-d") == 0) + { + dry_run = true; + argc--; + argv++; + } + else + arg_found = false; } - /* print usage info */ - if (argc < 2) - { - printf("Usage:\nsrcclean [-u] [-d] <file>\n"); - return 0; - } + /* print usage info */ + if (argc < 2) + { + printf("Usage:\nsrcclean [-u] [-d] <file>\n"); + return 0; + } /* read the file */ file = fopen(argv[1], "rb"); @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) /* check whether we have dos line endings and are in unix mode */ if (unix_le && (strchr((char *) original, 0x0d) != NULL)) - fixed_dos_style = 1; + fixed_dos_style = 1; /* determine if we are a C file */ ext = strrchr(argv[1], '.'); @@ -245,13 +245,13 @@ int main(int argc, char *argv[]) } /* insert a proper CR/LF */ - modified[dst++] = 0x0d; + modified[dst++] = 0x0d; modified[dst++] = 0x0a; col = 0; /* skip over any LF in the source file */ if (ch == 0x0d && original[src] == 0x0a) - src++; + src++; else if (ch == 0x0a) fixed_nix_style = 1; else @@ -367,10 +367,10 @@ int main(int argc, char *argv[]) } } - /* convert to unix_le if requested */ + /* convert to unix_le if requested */ - if (unix_le) - dst = le_convert((char *) modified, dst); + if (unix_le) + dst = le_convert((char *) modified, dst); /* if the result == original, skip it */ if (dst != bytes || memcmp(original, modified, bytes)) @@ -386,15 +386,15 @@ int main(int argc, char *argv[]) if (hichars) printf(" fixed %d high-ASCII char(s)", hichars); if (fixed_nix_style && !unix_le) printf(" fixed *nix-style line-ends"); if (fixed_mac_style) printf(" fixed Mac-style line-ends"); - if (fixed_dos_style) printf(" fixed Dos-style line-ends"); + if (fixed_dos_style) printf(" fixed Dos-style line-ends"); printf("\n"); if (!dry_run) { - /* write the file */ - file = fopen(argv[1], "wb"); - fwrite(modified, 1, dst, file); - fclose(file); + /* write the file */ + file = fopen(argv[1], "wb"); + fwrite(modified, 1, dst, file); + fclose(file); } } diff --git a/src/tools/unidasm.c b/src/tools/unidasm.c index d3d4bd04d6f..ffb6ceaa84f 100644 --- a/src/tools/unidasm.c +++ b/src/tools/unidasm.c @@ -231,9 +231,9 @@ static const dasm_table_entry dasm_table[] = { "f8", _8bit, 0, CPU_DISASSEMBLE_NAME(f8) }, { "g65816", _8bit, 0, CPU_DISASSEMBLE_NAME(g65816_generic) }, { "h6280", _8bit, 0, CPU_DISASSEMBLE_NAME(h6280) }, - // { "h8", _16be, 0, CPU_DISASSEMBLE_NAME(h8) }, - // { "h8_24", _16be, 0, CPU_DISASSEMBLE_NAME(h8_24) }, - // { "h8_32", _16be, 0, CPU_DISASSEMBLE_NAME(h8_32) }, + // { "h8", _16be, 0, CPU_DISASSEMBLE_NAME(h8) }, + // { "h8_24", _16be, 0, CPU_DISASSEMBLE_NAME(h8_24) }, + // { "h8_32", _16be, 0, CPU_DISASSEMBLE_NAME(h8_32) }, { "hc11", _8bit, 0, CPU_DISASSEMBLE_NAME(mb88) }, { "hcd62121", _16be, 0, CPU_DISASSEMBLE_NAME(hcd62121) }, { "hd61700", _8bit, 0, CPU_DISASSEMBLE_NAME(hd61700) }, |