From: drdani Date: Fri, 16 Jul 2004 16:36:33 +0000 (+0000) Subject: version 0.5.2 X-Git-Url: https://git.gag.com/?p=fw%2Fsdcc;a=commitdiff_plain;h=f27da39dbcab5678aca6d8462f1cc37a643f37e9 version 0.5.2 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3383 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/sim/ucsim/.version b/sim/ucsim/.version index edb78d6c..cb0c939a 100644 --- a/sim/ucsim/.version +++ b/sim/ucsim/.version @@ -1 +1 @@ -0.4.1-pre5 +0.5.2 diff --git a/sim/ucsim/Makefile b/sim/ucsim/Makefile index ce162ff1..b5c0278a 100644 --- a/sim/ucsim/Makefile +++ b/sim/ucsim/Makefile @@ -89,9 +89,9 @@ realclean: distclean # --------------------- dist: distclean @if [ -f devel ]; then\ - rm -f devel; mkdist ucsim; touch devel;\ + rm -f devel; mkdist; touch devel;\ else\ - mkdist ucsim;\ + mkdist;\ fi @@ -163,22 +163,33 @@ lines: # ---------------------- configure: configure.in @$(PRJDIR)/mkecho $(PRJDIR) "RE-CREATING CONFIGURE" - $(SHELL) autoconf configure.in >configure + autoconf configure.in >configure chmod 755 configure config.status: configure - @$(PRJDIR)/mkecho $(PRJDIR) "RE-CHECKING CONFIGURATION" - ./config.status -recheck + @$(PRJDIR)/mkecho $(PRJDIR) "RE-CHECKING CONFIGURATION (re-creating config.status from configure)" + @if [ -x ./config.status ]; then \ + ./config.status -recheck;\ + else\ + if [ -x ./conf ]; then\ + ./conf;\ + else\ + ./configure;\ + fi\ + fi makefiles: config.status @$(PRJDIR)/mkecho $(PRJDIR) "RE-MAKING MAKEFILES" $(SHELL) ./config.status -main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in +main.mk: $(srcdir)/main_in.mk config.status @$(PRJDIR)/mkecho $(PRJDIR) "RE-MAKING MAIN.MK" $(SHELL) ./config.status -freshconf: echo_freshconf configure main.mk +freshconf: echo_freshconf configure main.mk ddconfig.h + +ddconfig.h: ddconfig_in.h config.status + $(SHELL) ./config.status echo_freshconf: @$(PRJDIR)/mkecho $(PRJDIR) "FRESHCONF" diff --git a/sim/ucsim/NEWS b/sim/ucsim/NEWS index d62e965b..ce227235 100644 --- a/sim/ucsim/NEWS +++ b/sim/ucsim/NEWS @@ -12,3 +12,30 @@ Start of libtool introduction. 0.4.1-pre5 Fix of cl_cmdline::syntax_match. + + +0.4.1-pre6 + +Stack tracking. +Error handling. + + +0.5.0 + +Expressions +Memory simulation redesigned: address space, chip, address decoder +Fix of command interpreter +Document updated + + +0.5.1 + +Implementation of missing instruction ORL C,\bit of MCS51 +Apply changes of SDCC cvs +Fix of AVR instruction decoder +Bug fixes + + +0.5.2 + +Bug fixes to run sdcc regression tests diff --git a/sim/ucsim/app.cc b/sim/ucsim/app.cc index 3c2a4d84..f357afef 100644 --- a/sim/ucsim/app.cc +++ b/sim/ucsim/app.cc @@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +#include #include #ifdef HAVE_GETOPT_H # include @@ -44,6 +45,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "utils.h" #include "appcl.h" #include "optioncl.h" +#include "globals.h" // sim.src #include "simcl.h" @@ -109,21 +111,16 @@ cl_option::get_value(int index) cl_app::cl_app(void) { - //options= new cl_options(); sim= 0; - args= new cl_arguments(); - in_files= new cl_ustrings(2, 2); + in_files= new cl_ustrings(2, 2, "input files"); options= new cl_options(); going= 1; } cl_app::~cl_app(void) { - //delete options; remove_simulator(); delete commander; - //delete cmdset; - delete args; delete in_files; delete options; } @@ -239,58 +236,53 @@ cl_app::proc_arguments(int argc, char *argv[]) int i, c; char opts[100], *cp, *subopts, *value; char *cpu_type= NULL; + bool s_done= DD_FALSE, k_done= DD_FALSE; + bool S_i_done= DD_FALSE, S_o_done= DD_FALSE; strcpy(opts, "c:C:p:PX:vVt:s:S:hHk:"); #ifdef SOCKET_AVAIL strcat(opts, "Z:r:"); #endif - //int opterr= 0; + while((c= getopt(argc, argv, opts)) != -1) switch (c) { case 'c': - //args->add(new cl_prg_arg('c', 0, optarg)); if (!options->set_value("console_on", this, optarg)) fprintf(stderr, "Warning: No \"console_on\" option found " "to set by -c\n"); break; case 'C': - args->add(new cl_prg_arg(0, "Config", optarg)); + if (!options->set_value("config_file", this, optarg)) + fprintf(stderr, "Warning: No \"config_file\" option found to set " + "parameter of -C as config file\n"); break; #ifdef SOCKET_AVAIL - case 'Z': - // By Sandeep - args->add(new cl_prg_arg('Z', 0, (long)1)); - if (!optarg || !isdigit(*optarg)) - fprintf(stderr, "expected portnumber to follow -Z\n"); - else { - char *p; - long l= strtol(optarg, &p, 0); - args->add(new cl_prg_arg(0, "Zport", l)); + case 'Z': case 'r': + { + // By Sandeep + // Modified by DD + class cl_option *o; + options->new_option(o= new cl_number_option(this, "port_number", + "Listen on port (-Z)")); + o->init(); + o->hide(); + if (!options->set_value("port_number", this, strtol(optarg, NULL, 0))) + fprintf(stderr, "Warning: No \"port_number\" option found" + " to set parameter of -Z as pot number to listen on\n"); + break; } - break; #endif case 'p': { - //args->add(new cl_prg_arg(0, "prompt", optarg)); - //class cl_option *o= options->get_option("prompt", this); - if (/*o*/!options->set_value("prompt", this, optarg)) - /*o->set_value(optarg); - else*/ + if (!options->set_value("prompt", this, optarg)) fprintf(stderr, "Warning: No \"prompt\" option found to set " "parameter of -p as default prompt\n"); break; } case 'P': - args->add(new cl_prg_arg('P', 0, (long)1)); if (!options->set_value("null_prompt", this, bool(DD_TRUE))) fprintf(stderr, "Warning: No \"null_prompt\" option found\n"); break; -#ifdef SOCKET_AVAIL - case 'r': - args->add(new cl_prg_arg('r', 0, - (long)strtol(optarg, NULL, 0))); - break; -#endif case 'X': { double XTAL; @@ -305,7 +297,9 @@ cl_app::proc_arguments(int argc, char *argv[]) fprintf(stderr, "Xtal frequency must be greather than 0\n"); exit(1); } - args->add(new cl_prg_arg('X', 0, XTAL)); + if (!options->set_value("xtal", this, XTAL)) + fprintf(stderr, "Warning: No \"xtal\" option found to set " + "parameter of -X as XTAL frequency\n"); break; } case 'v': @@ -313,41 +307,47 @@ cl_app::proc_arguments(int argc, char *argv[]) exit(0); break; case 'V': - args->add(new cl_prg_arg('V', 0, (long)1)); if (!options->set_value("debug", this, (bool)DD_TRUE)) fprintf(stderr, "Warning: No \"debug\" option found to set " "by -V parameter\n"); break; case 't': - if (cpu_type) - free(cpu_type); - cpu_type= strdup(optarg); - for (cp= cpu_type; *cp; *cp= toupper(*cp), cp++); - args->add(new cl_prg_arg('t', 0, cpu_type)); - break; + { + if (cpu_type) + free(cpu_type); + cpu_type= case_string(case_upper, optarg); + if (!options->set_value("cpu_type", this, /*optarg*/cpu_type)) + fprintf(stderr, "Warning: No \"cpu_type\" option found to set " + "parameter of -t as type of controller\n"); + break; + } case 's': { FILE *Ser_in, *Ser_out; - if (args->arg_avail('s')) + if (s_done) { fprintf(stderr, "-s option can not be used more than once.\n"); break; } - args->add(new cl_prg_arg('s', 0, (long)1)); + s_done= DD_TRUE; if ((Ser_in= fopen(optarg, "r")) == NULL) { fprintf(stderr, "Can't open `%s': %s\n", optarg, strerror(errno)); return(4); } - args->add(new cl_prg_arg(0, "Ser_in", Ser_in)); + if (!options->set_value("serial_in_file", this, (void*)Ser_in)) + fprintf(stderr, "Warning: No \"serial_in_file\" option found to set " + "parameter of -s as serial input file\n"); if ((Ser_out= fopen(optarg, "w")) == NULL) { fprintf(stderr, "Can't open `%s': %s\n", optarg, strerror(errno)); return(4); } - args->add(new cl_prg_arg(0, "Ser_out", Ser_out)); + if (!options->set_value("serial_out_file", this, Ser_out)) + fprintf(stderr, "Warning: No \"serial_out_file\" option found " + "to set parameter of -s as serial output file\n"); break; } #ifdef SOCKET_AVAIL @@ -358,13 +358,11 @@ cl_app::proc_arguments(int argc, char *argv[]) int sock; unsigned short serverport; int client_sock; - - if (args->arg_avail("Ser_in")) { + + if (k_done) { fprintf(stderr, "Serial input specified more than once.\n"); } - if (args->arg_avail("Ser_out")) { - fprintf(stderr, "Serial output specified more than once.\n"); - } + k_done= DD_TRUE; serverport = atoi(optarg); sock= make_server_socket(serverport); @@ -384,12 +382,16 @@ cl_app::proc_arguments(int argc, char *argv[]) fprintf(stderr, "Can't create input stream: %s\n", strerror(errno)); return (4); } - args->add(new cl_prg_arg(0, "Ser_in", Ser_in)); + if (!options->set_value("serial_in_file", this, (void*)Ser_in)) + fprintf(stderr, "Warning: No \"serial_in_file\" option found to " + "set parameter of -s as serial input file\n"); if ((Ser_out= fdopen(client_sock, "w")) == NULL) { fprintf(stderr, "Can't create output stream: %s\n", strerror(errno)); return (4); } - args->add(new cl_prg_arg(0, "Ser_out", Ser_out)); + if (!options->set_value("serial_out_file", this, Ser_out)) + fprintf(stderr, "Warning: No \"serial_out_file\" option found " + "to set parameter of -s as serial output file\n"); break; } #endif @@ -404,25 +406,28 @@ cl_app::proc_arguments(int argc, char *argv[]) fprintf(stderr, "No value for -S in\n"); exit(1); } - if (args->arg_avail("Ser_in")) + if (S_i_done) { fprintf(stderr, "Serial input specified more than once.\n"); break; } + S_i_done= DD_TRUE; if ((Ser_in= fopen(value, "r")) == NULL) { fprintf(stderr, "Can't open `%s': %s\n", value, strerror(errno)); exit(4); } - args->add(new cl_prg_arg(0, "Ser_in", Ser_in)); + if (!options->set_value("serial_in_file", this, (void*)Ser_in)) + fprintf(stderr, "Warning: No \"serial_in_file\" option found " + "to set parameter of -s as serial input file\n"); break; case SOPT_OUT: if (value == NULL) { fprintf(stderr, "No value for -S out\n"); exit(1); } - if (args->arg_avail("Ser_out")) + if (S_o_done) { fprintf(stderr, "Serial output specified more than once.\n"); break; @@ -433,7 +438,9 @@ cl_app::proc_arguments(int argc, char *argv[]) "Can't open `%s': %s\n", value, strerror(errno)); exit(4); } - args->add(new cl_prg_arg(0, "Ser_out", Ser_out)); + if (!options->set_value("serial_out_file", this, Ser_out)) + fprintf(stderr, "Warning: No \"serial_out_file\" option found " + "to set parameter of -s as serial output file\n"); break; default: /* Unknown suboption. */ @@ -447,14 +454,21 @@ cl_app::proc_arguments(int argc, char *argv[]) exit(0); break; case 'H': - /*i= 0; - while (cpus_51[i].type_str != NULL) - { - printf("%s\n", cpus_51[i].type_str); - i++; - }*/ - exit(0); - break; + { + if (!cpus) + { + fprintf(stderr, "CPU type is not selectable\n"); + exit(0); + } + i= 0; + while (cpus[i].type_str != NULL) + { + printf("%s\n", cpus[i].type_str); + i++; + } + exit(0); + break; + } case '?': if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt); @@ -465,8 +479,6 @@ cl_app::proc_arguments(int argc, char *argv[]) default: exit(c); } - if (!args->arg_avail("prompt")) - args->add(new cl_prg_arg(0, "prompt", "> ")); for (i= optind; i < argc; i++) in_files->add(argv[i]); @@ -497,12 +509,14 @@ cl_app::get_cmd(class cl_cmdline *cmdline) * Messages to broadcast */ +/* void -cl_app::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_app::mem_cell_changed(class cl_m *mem, t_addr addr) { if (sim) sim->mem_cell_changed(mem, addr); } +*/ /* Adding and removing components */ @@ -539,10 +553,9 @@ cl_app::build_cmdset(class cl_cmdset *cmdset) "conf Configuration", "long help of conf")); cmd->init(); - cset->add(cmd= new cl_conf_addmem_cmd("addmem", 0, -"conf addmem\n" -" Make memory", -"long help of conf addmem")); + cset->add(cmd= new cl_conf_objects_cmd("objects", 0, +"conf objects Show object tree", +"long help of conf objects")); cmd->init(); } cmdset->add(cmd= new cl_super_cmd("conf", 0, @@ -572,9 +585,20 @@ cl_app::build_cmdset(class cl_cmdset *cmdset) "long help of exec")); cmd->init(); + cmdset->add(cmd= new cl_expression_cmd("expression", 0, +"expression expr Evaluate the expression", +"long help of expression ")); + cmd->init(); + cmd->add_name("let"); + { - cset= new cl_cmdset(); - cset->init(); + super_cmd= (class cl_super_cmd *)(cmdset->get_cmd("show")); + if (super_cmd) + cset= super_cmd->commands; + else { + cset= new cl_cmdset(); + cset->init(); + } cset->add(cmd= new cl_show_copying_cmd("copying", 0, "show copying Conditions for redistributing copies of uCsim", "long help of show copying")); @@ -587,11 +611,18 @@ cl_app::build_cmdset(class cl_cmdset *cmdset) "show option [name] Show internal data of options", "long help of show option")); cmd->init(); + cset->add(cmd= new cl_show_error_cmd("error", 0, +"show error Show class of errors", +"long help of show error")); + cmd->init(); } - cmdset->add(cmd= new cl_super_cmd("show", 0, + if (!super_cmd) + { + cmdset->add(cmd= new cl_super_cmd("show", 0, "show subcommand Generic command for showing things about the uCsim", "long help of show", cset)); - cmd->init(); + cmd->init(); + } { super_cmd= (class cl_super_cmd *)(cmdset->get_cmd("get")); @@ -627,6 +658,11 @@ cl_app::build_cmdset(class cl_cmdset *cmdset) " Set value of an option", "long help of set option")); cmd->init(); + cset->add(cmd= new cl_set_error_cmd("error", 0, +"set error error_name on|off|unset\n" +" Set value of an error", +"long help of set error")); + cmd->init(); } if (!super_cmd) { @@ -645,25 +681,73 @@ cl_app::mk_options(void) options->new_option(o= new cl_bool_option(this, "null_prompt", "Use \\0 as prompt (-P)")); o->init(); - options->new_option(o= new cl_bool_option(this, "stopit", - "Stop if interrupt accepted")); - o->init(); - options->new_option(o= new cl_string_option(this, "serial_in_file", - "Input file for serial line (-s)")); + + options->new_option(o= new cl_pointer_option(this, "serial_in_file", + "Input file for serial line (-s)")); o->init(); - options->new_option(o= new cl_string_option(this, "serial_out_file", - "Output file for serial line (-s)")); + o->hide(); + + options->new_option(o= new cl_pointer_option(this, "serial_out_file", + "Output file for serial line (-s)")); o->init(); + o->hide(); + options->new_option(o= new cl_string_option(this, "prompt", "String of prompt (-p)")); o->init(); + options->new_option(o= new cl_bool_option(this, "debug", "Print debug messages (-V)")); o->init(); + options->new_option(o= new cl_string_option(this, "console_on", "Open console on this file (-c)")); o->init(); o->hide(); + + options->new_option(o= new cl_string_option(this, "config_file", + "Execute this file at startup (-C)")); + o->init(); + o->hide(); + + options->new_option(o= new cl_float_option(this, "xtal", + "Frequency of XTAL in Hz")); + o->init(); + o->set_value(11059200.0); + + options->new_option(o= new cl_string_option(this, "cpu_type", + "Type of controller (-t)")); + o->init(); + o->hide(); +} + + +int +cl_app::dd_printf(char *format, ...) +{ + va_list ap; + + if (!commander) + return(0); + + va_start(ap, format); + int i= commander->dd_printf(format, ap); + va_end(ap); + return(i); +} + +int +cl_app::debug(char *format, ...) +{ + va_list ap; + + if (!commander) + return(0); + + va_start(ap, format); + int i= commander->debug(format, ap); + va_end(ap); + return(i); } diff --git a/sim/ucsim/appcl.h b/sim/ucsim/appcl.h index e0049197..5195b32d 100644 --- a/sim/ucsim/appcl.h +++ b/sim/ucsim/appcl.h @@ -82,7 +82,7 @@ protected: public: class cl_sim *sim; class cl_ustrings *in_files; - class cl_arguments *args; + //class cl_arguments *args; class cl_options *options; int going; @@ -105,7 +105,7 @@ public: virtual class cl_cmd *get_cmd(class cl_cmdline *cmdline); public: // messages to broadcast - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); public: virtual void set_simulator(class cl_sim *simulator); @@ -114,6 +114,10 @@ public: protected: virtual void build_cmdset(class cl_cmdset *cs); virtual void mk_options(void); + +public: // output functions + virtual int dd_printf(char *format, ...); + virtual int debug(char *format, ...); }; diff --git a/sim/ucsim/avr.src/Makefile.in b/sim/ucsim/avr.src/Makefile.in index 57cbf209..55afbee0 100644 --- a/sim/ucsim/avr.src/Makefile.in +++ b/sim/ucsim/avr.src/Makefile.in @@ -23,10 +23,9 @@ CXXFLAGS = @CXXFLAGS@ -Wall M_OR_MM = @M_OR_MM@ PICOPT = @PICOPT@ SHAREDLIB = @SHAREDLIB@ +EXEEXT = @EXEEXT@ -EXEEXT = @EXEEXT@ - -LIBS = @LIBS@ -L$(PRJDIR) -lsim -lutil -lsim -lcmd -lguiucsim +LIBS = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lsim -lutil -lcmd -lguiucsim -Wl,--end-group DL = @DL@ dl_ok = @dl_ok@ @@ -71,7 +70,7 @@ install: all installdirs # Deleting all the installed files # -------------------------------- uninstall: - rm -f $(bindir)/savr$(EXEEXT) + rm -f $(bindir)/savr # Performing self-test diff --git a/sim/ucsim/avr.src/avr.cc b/sim/ucsim/avr.src/avr.cc index bef5a621..379edd09 100644 --- a/sim/ucsim/avr.src/avr.cc +++ b/sim/ucsim/avr.src/avr.cc @@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // sim #include "simcl.h" +#include "memcl.h" // local #include "portcl.h" @@ -60,8 +61,8 @@ int cl_avr::init(void) { cl_uc::init(); /* Memories now exist */ - ram= mem(MEM_IRAM); - rom= mem(MEM_ROM); + ram= address_space(MEM_IRAM_ID); + rom= address_space(MEM_ROM_ID); return(0); } @@ -75,7 +76,7 @@ cl_avr::id_string(void) /* * Making elements of the controller */ - +/* t_addr cl_avr::get_mem_size(enum mem_class type) { @@ -88,7 +89,8 @@ cl_avr::get_mem_size(enum mem_class type) //return(0); //return(cl_uc::get_mem_size(type)); } - +*/ +/* int cl_avr::get_mem_width(enum mem_class type) { @@ -96,6 +98,7 @@ cl_avr::get_mem_width(enum mem_class type) return(16); return(cl_uc::get_mem_width(type)); } +*/ void cl_avr::mk_hw_elements(void) @@ -107,6 +110,41 @@ cl_avr::mk_hw_elements(void) } +void +cl_avr::make_memories(void) +{ + class cl_address_space *as; + + rom= as= new cl_address_space(MEM_ROM_ID, 0, 0x10000, 16); + as->init(); + address_spaces->add(as); + ram= as= new cl_address_space(MEM_IRAM_ID, 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 16); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= rom/*address_space(MEM_ROM_ID)*/, + chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x80, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= ram/*address_space(MEM_IRAM_ID)*/, + chip, 0, 0x7f, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); +} + + /* * Help command interpreter */ @@ -140,7 +178,7 @@ cl_avr::disass(t_addr addr, char *sep) p= work; - code= get_mem(MEM_ROM, addr); + code= get_mem(MEM_ROM_ID, addr); i= 0; while ((code & dis_tbl()[i].mask) != dis_tbl()[i].code && dis_tbl()[i].mnemonic) @@ -202,7 +240,7 @@ cl_avr::disass(t_addr addr, char *sep) // kkkk kkkk kkkk kkkk 0<=k<=4M sprintf(temp, "0x%06x", (((code&0x1f0)>>3)|(code&1))*0x10000+ - (uint)get_mem(MEM_ROM, addr+1)); + (uint)get_mem(MEM_ROM_ID, addr+1)); break; case 'P': // P .... .... pppp p... 0<=P<=31 data= (code&0xf8)>>3; @@ -219,7 +257,7 @@ cl_avr::disass(t_addr addr, char *sep) ((code&0x2000)>>8)|((code&0xc00)>>7)|(code&7)); break; case 'R': // k SRAM address on second word 0<=k<=65535 - sprintf(temp, "0x%06x", (uint)get_mem(MEM_ROM, addr+1)); + sprintf(temp, "0x%06x", (uint)get_mem(MEM_ROM_ID, addr+1)); break; case 'a': // k .... kkkk kkkk kkkk -2k<=k<=2k { @@ -227,7 +265,7 @@ cl_avr::disass(t_addr addr, char *sep) if (code&0x800) k|= -4096; sprintf(temp, "0x%06"_A_"x", - t_addr((k+1+(signed int)addr) % rom->size)); + rom->validate_address(k+1+(signed int)addr)); break; } default: @@ -316,6 +354,7 @@ cl_avr::exec_inst(void) { t_mem code; + instPC= PC; if (fetch(&code)) return(resBREAKPOINT); tick(1); @@ -390,158 +429,208 @@ cl_avr::exec_inst(void) switch (code & 0xf000) { case 0x0000: - // 0x0... - switch (code & 0xfc00) - { - case 0x0000: - switch (code & 0xff00) + { + // 0x0... + switch (code & 0xfc00) + { + case 0x0000: { - case 0x0100: return(movw_Rd_Rr(code)); - case 0x0200: return(muls_Rd_Rr(code)); - case 0x0300: - switch (code & 0xff88) + switch (code & 0xff00) { - case 0x0300: return(mulsu_Rd_Rr(code)); - case 0x0308: return(fmul_Rd_Rr(code)); - case 0x0380: return(fmuls_Rd_Rr(code)); - case 0x0388: return(fmulsu_Rd_Rr(code)); + case 0x0100: return(movw_Rd_Rr(code)); + case 0x0200: return(muls_Rd_Rr(code)); + case 0x0300: + { + switch (code & 0xff88) + { + case 0x0300: return(mulsu_Rd_Rr(code)); + case 0x0308: return(fmul_Rd_Rr(code)); + case 0x0380: return(fmuls_Rd_Rr(code)); + case 0x0388: return(fmulsu_Rd_Rr(code)); + } + break; + } + break; } + break; } - case 0x0400: return(cpc_Rd_Rr(code)); - case 0x0800: return(sbc_Rd_Rr(code)); - case 0x0c00: return(add_Rd_Rr(code)); - } + case 0x0400: return(cpc_Rd_Rr(code)); + case 0x0800: return(sbc_Rd_Rr(code)); + case 0x0c00: return(add_Rd_Rr(code)); + } + break; + } case 0x1000: - // 0x1... - switch (code & 0xfc00) - { - case 0x1000: return(cpse_Rd_Rr(code)); - case 0x1400: return(cp_Rd_Rr(code)); - case 0x1800: return(sub_Rd_Rr(code)); - case 0x1c00: return(adc_Rd_Rr(code)); - } + { + // 0x1... + switch (code & 0xfc00) + { + case 0x1000: return(cpse_Rd_Rr(code)); + case 0x1400: return(cp_Rd_Rr(code)); + case 0x1800: return(sub_Rd_Rr(code)); + case 0x1c00: return(adc_Rd_Rr(code)); + } + break; + } case 0x2000: - // 0x2... - switch (code & 0xfc00) - { - case 0x2000: return(and_Rd_Rr(code)); - case 0x2400: return(eor_Rd_Rr(code)); - case 0x2800: return(or_Rd_Rr(code)); - case 0x2c00: return(mov_Rd_Rr(code)); + { + // 0x2... + switch (code & 0xfc00) + { + case 0x2000: return(and_Rd_Rr(code)); + case 0x2400: return(eor_Rd_Rr(code)); + case 0x2800: return(or_Rd_Rr(code)); + case 0x2c00: return(mov_Rd_Rr(code)); } + break; + } case 0x8000: - // 0x8... - switch (code &0xf208) - { - case 0x8000: return(ldd_Rd_Z_q(code)); - case 0x8008: return(ldd_Rd_Y_q(code)); - case 0x8200: return(std_Z_q_Rr(code)); - case 0x8208: return(std_Y_q_Rr(code)); - } + { + // 0x8... + switch (code &0xf208) + { + case 0x8000: return(ldd_Rd_Z_q(code)); + case 0x8008: return(ldd_Rd_Y_q(code)); + case 0x8200: return(std_Z_q_Rr(code)); + case 0x8208: return(std_Y_q_Rr(code)); + } + break; + } case 0x9000: - // 0x9... - if ((code & 0xff0f) == 0x9509) - return(icall(code)); - if ((code & 0xff0f) == 0x9409) - return(ijmp(code)); - if ((code & 0xff00) == 0x9600) - return(adiw_Rdl_K(code)); - if ((code & 0xff00) == 0x9700) - return(sbiw_Rdl_K(code)); - switch (code & 0xfc00) - { - case 0x9000: - switch (code & 0xfe0f) + { + // 0x9... + if ((code & 0xff0f) == 0x9509) + return(icall(code)); + if ((code & 0xff0f) == 0x9409) + return(ijmp(code)); + if ((code & 0xff00) == 0x9600) + return(adiw_Rdl_K(code)); + if ((code & 0xff00) == 0x9700) + return(sbiw_Rdl_K(code)); + switch (code & 0xfc00) + { + case 0x9000: { - case 0x9000: return(lds_Rd_k(code)); - case 0x9001: return(ld_Rd_ZS(code)); - case 0x9002: return(ld_Rd_SZ(code)); - case 0x9004: return(lpm_Rd_Z(code)); - case 0x9005: return(lpm_Rd_ZS(code)); - case 0x9006: return(elpm_Rd_Z(code)); - case 0x9007: return(elpm_Rd_ZS(code)); - case 0x9009: return(ld_Rd_YS(code)); - case 0x900a: return(ld_Rd_SY(code)); - case 0x900c: return(ld_Rd_X(code)); - case 0x900d: return(ld_Rd_XS(code)); - case 0x900e: return(ld_Rd_SX(code)); - case 0x900f: return(pop_Rd(code)); - case 0x9200: return(sts_k_Rr(code)); - case 0x9201: return(st_ZS_Rr(code)); - case 0x9202: return(st_SZ_Rr(code)); - case 0x9209: return(st_YS_Rr(code)); - case 0x920a: return(st_SY_Rr(code)); - case 0x920c: return(st_X_Rr(code)); - case 0x920d: return(st_XS_Rr(code)); - case 0x920e: return(st_SX_Rr(code)); - case 0x920f: return(push_Rr(code)); + switch (code & 0xfe0f) + { + case 0x9000: return(lds_Rd_k(code)); + case 0x9001: return(ld_Rd_ZS(code)); + case 0x9002: return(ld_Rd_SZ(code)); + case 0x9004: return(lpm_Rd_Z(code)); + case 0x9005: return(lpm_Rd_ZS(code)); + case 0x9006: return(elpm_Rd_Z(code)); + case 0x9007: return(elpm_Rd_ZS(code)); + case 0x9009: return(ld_Rd_YS(code)); + case 0x900a: return(ld_Rd_SY(code)); + case 0x900c: return(ld_Rd_X(code)); + case 0x900d: return(ld_Rd_XS(code)); + case 0x900e: return(ld_Rd_SX(code)); + case 0x900f: return(pop_Rd(code)); + case 0x9200: return(sts_k_Rr(code)); + case 0x9201: return(st_ZS_Rr(code)); + case 0x9202: return(st_SZ_Rr(code)); + case 0x9209: return(st_YS_Rr(code)); + case 0x920a: return(st_SY_Rr(code)); + case 0x920c: return(st_X_Rr(code)); + case 0x920d: return(st_XS_Rr(code)); + case 0x920e: return(st_SX_Rr(code)); + case 0x920f: return(push_Rr(code)); + } + break; } - case 0x9400: - switch (code & 0xfe0f) + case 0x9400: { - case 0x9400: return(com_Rd(code)); - case 0x9401: return(neg_Rd(code)); - case 0x9402: return(swap_Rd(code)); - case 0x9403: return(inc_Rd(code)); - case 0x9405: return(asr_Rd(code)); - case 0x9406: return(lsr_Rd(code)); - case 0x9407: return(ror_Rd(code)); - case 0x940a: return(dec_Rd(code)); - case 0x940c: case 0x940d: return(jmp_k(code)); - case 0x940e: case 0x940f: return(call_k(code)); + switch (code & 0xfe0f) + { + case 0x9400: return(com_Rd(code)); + case 0x9401: return(neg_Rd(code)); + case 0x9402: return(swap_Rd(code)); + case 0x9403: return(inc_Rd(code)); + case 0x9405: return(asr_Rd(code)); + case 0x9406: return(lsr_Rd(code)); + case 0x9407: return(ror_Rd(code)); + case 0x940a: return(dec_Rd(code)); + case 0x940c: case 0x940d: return(jmp_k(code)); + case 0x940e: case 0x940f: return(call_k(code)); + } + break; } - case 0x9800: - switch (code & 0xff00) + case 0x9800: { - case 0x9800: return(cbi_A_b(code)); - case 0x9900: return(sbic_P_b(code)); - case 0x9a00: return(sbi_A_b(code)); - case 0x9b00: return(sbis_P_b(code)); + switch (code & 0xff00) + { + case 0x9800: return(cbi_A_b(code)); + case 0x9900: return(sbic_P_b(code)); + case 0x9a00: return(sbi_A_b(code)); + case 0x9b00: return(sbis_P_b(code)); + } + break; } - case 0x9c00: return(mul_Rd_Rr(code)); - } + case 0x9c00: return(mul_Rd_Rr(code)); + } + break; + } case 0xa000: - // 0xa... - switch (code &0xf208) - { - case 0xa000: return(ldd_Rd_Z_q(code)); - case 0xa008: return(ldd_Rd_Y_q(code)); - case 0xa200: return(std_Z_q_Rr(code)); - case 0xa208: return(std_Y_q_Rr(code)); - } + { + // 0xa... + switch (code &0xf208) + { + case 0xa000: return(ldd_Rd_Z_q(code)); + case 0xa008: return(ldd_Rd_Y_q(code)); + case 0xa200: return(std_Z_q_Rr(code)); + case 0xa208: return(std_Y_q_Rr(code)); + } + break; + } case 0xb000: - // 0xb... - switch (code & 0xf800) - { - case 0xb000: return(in_Rd_A(code)); - case 0xb800: return(out_A_Rr(code)); - } + { + // 0xb... + switch (code & 0xf800) + { + case 0xb000: return(in_Rd_A(code)); + case 0xb800: return(out_A_Rr(code)); + } + break; + } case 0xe000: - // 0xe... - switch (code & 0xff0f) - { - case 0xef0f: return(ser_Rd(code)); - } + { + // 0xe... + switch (code & 0xff0f) + { + case 0xef0f: return(ser_Rd(code)); + } + break; + } case 0xf000: - // 0xf... - switch (code & 0xfc00) - { - case 0xf000: return(brbs_s_k(code)); - case 0xf400: return(brbc_s_k(code)); - case 0xf800: case 0xfc00: - switch (code & 0xfe08) + { + // 0xf... + switch (code & 0xfc00) + { + case 0xf000: return(brbs_s_k(code)); + case 0xf400: return(brbc_s_k(code)); + case 0xf800: case 0xfc00: { - case 0xf800: return(bld_Rd_b(code)); - case 0xfa00: return(bst_Rd_b(code)); - case 0xfc00: case 0xfc08: return(sbrc_Rr_b(code)); - case 0xfe00: case 0xfe08: return(sbrs_Rr_b(code)); + switch (code & 0xfe08) + { + case 0xf800: return(bld_Rd_b(code)); + case 0xfa00: return(bst_Rd_b(code)); + case 0xfc00: case 0xfc08: return(sbrc_Rr_b(code)); + case 0xfe00: case 0xfe08: return(sbrs_Rr_b(code)); + } + break; } - } + } + break; + } } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + class cl_error_unknown_code *e= new cl_error_unknown_code(this); + error(e); + return(resGO); + PC= rom->inc_address(PC, -1); //tick(-clock_per_cycle()); sim->stop(resINV_INST); return(resINV_INST); diff --git a/sim/ucsim/avr.src/avrcl.h b/sim/ucsim/avr.src/avrcl.h index 3572599e..712efd8f 100644 --- a/sim/ucsim/avr.src/avrcl.h +++ b/sim/ucsim/avr.src/avrcl.h @@ -28,7 +28,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef AVRCL_HEADER #define AVRCL_HEADER +// sim.src #include "uccl.h" +#include "memcl.h" /* @@ -38,17 +40,18 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_avr: public cl_uc { public: - cl_mem *ram; - cl_mem *rom; + class cl_address_space *ram; + class cl_address_space *rom; int sleep_executed; public: cl_avr(class cl_sim *asim); virtual int init(void); virtual char *id_string(void); - virtual t_addr get_mem_size(enum mem_class type); - virtual int get_mem_width(enum mem_class type); + //virtual t_addr get_mem_size(enum mem_class type); + //virtual int get_mem_width(enum mem_class type); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual struct dis_entry *dis_tbl(void); virtual struct name_entry *sfr_tbl(void); diff --git a/sim/ucsim/avr.src/jump_inst.cc b/sim/ucsim/avr.src/jump_inst.cc index 49c9769b..54f98f97 100644 --- a/sim/ucsim/avr.src/jump_inst.cc +++ b/sim/ucsim/avr.src/jump_inst.cc @@ -42,7 +42,7 @@ cl_avr::ijmp(t_mem code) t_addr z; z= ram->get(ZH)*256 + ram->get(ZL); - PC= ((PC & ~0xffff) | z) % rom->size; + PC= rom->validate_address((PC & ~0xffff) | z); //FIXME: analyze return(resGO); } @@ -99,7 +99,7 @@ cl_avr::ret(t_mem code) t_addr a; pop_addr(&a); - PC= a % rom->size; + PC= rom->validate_address(a); tick(3); return(resGO); } @@ -118,7 +118,7 @@ cl_avr::reti(t_mem code) t_addr a; pop_addr(&a); - PC= a % rom->size; + PC= rom->validate_address(a); t_mem sreg= ram->read(SREG); sreg|= BIT_I; ram->write(SREG, sreg); @@ -137,14 +137,11 @@ cl_avr::reti(t_mem code) int cl_avr::rjmp_k(t_mem code) { - long k= code & 0xfff, pc; + long k= code & 0xfff; if (k & 0x800) k|= -4096; - pc= PC+k; - if (pc < 0) - pc= rom->size + pc; - PC= pc % rom->size; + PC= rom->validate_address((signed)PC + (signed)k); tick(1); return(resGO); } @@ -166,8 +163,7 @@ cl_avr::rcall_k(t_mem code) k= code & 0xfff; if (k & 0x800) k|= ~0xfff; - PC= (signed)PC + (signed)k; - PC= PC % rom->size; + PC= rom->validate_address((signed)PC + (signed)k); tick(2); return(resGO); @@ -198,7 +194,7 @@ cl_avr::cpse_Rd_Rr(t_mem code) i++; if (dt[i].mnemonic != NULL) { - PC= (PC + dt[i].length) % get_mem_size(MEM_ROM); + PC= rom->validate_address(PC + dt[i].length); tick(1); } else @@ -223,7 +219,7 @@ cl_avr::jmp_k(t_mem code) k= ((code&0x1f0)>>3)|(code&1); k= (k<<16)|fetch(); - PC= k % rom->size; + PC= rom->validate_address(k); tick(2); return(resGO); } @@ -245,7 +241,7 @@ cl_avr::call_k(t_mem code) k= (((code&0x1f0)>>3)|(code&1))*0x10000; k= k + fetch(); push_addr(PC); - PC= k % rom->size; + PC= rom->validate_address(k); tick(3); return(resGO); } @@ -271,7 +267,7 @@ cl_avr::brbs_s_k(t_mem code) { if (code&0x200) k|= -128; - PC= (PC+k) % rom->size; + PC= rom->validate_address((signed)PC+k); tick(1); } return(resGO); @@ -298,7 +294,7 @@ cl_avr::brbc_s_k(t_mem code) { if (code&0x200) k|= -128; - PC= (PC+k) % rom->size; + PC= rom->validate_address((signed)PC+k); tick(1); } return(resGO); @@ -328,7 +324,7 @@ cl_avr::sbrc_Rr_b(t_mem code) i++; if (dt[i].mnemonic != NULL) { - PC= (PC + dt[i].length) % rom->size; + PC= rom->validate_address(PC + dt[i].length); tick(1); } else @@ -361,7 +357,7 @@ cl_avr::sbrs_Rr_b(t_mem code) i++; if (dt[i].mnemonic != NULL) { - PC= (PC + dt[i].length) % rom->size; + PC= rom->validate_address(PC + dt[i].length); tick(1); } else diff --git a/sim/ucsim/clean.mk b/sim/ucsim/clean.mk index 7643b5e1..84fff8d4 100644 --- a/sim/ucsim/clean.mk +++ b/sim/ucsim/clean.mk @@ -2,7 +2,7 @@ # -------------------------------------------------- clean: rm -f *core *[%~] *.[oa] *.so ucsim$(EXEEXT) - rm -f .[a-z]*~ + rm -f .[a-z]*~ ptt # Deleting all files created by configuring or building the program @@ -10,6 +10,7 @@ clean: distclean: clean rm -f config.cache config.log config.status rm -f ddconfig.h main.mk *.dep + rm -rf autom4te.cache # Like clean but some files may still exist diff --git a/sim/ucsim/cmd.src/Makefile.in b/sim/ucsim/cmd.src/Makefile.in index 6f7f66ca..c026f015 100644 --- a/sim/ucsim/cmd.src/Makefile.in +++ b/sim/ucsim/cmd.src/Makefile.in @@ -13,6 +13,10 @@ CXXCPP = @CXXCPP@ RANLIB = @RANLIB@ INSTALL = @INSTALL@ +LEX = @LEX@ +YACC = @YACC@ +BISON_PLUS_PLUS = @BISON_PLUS_PLUS@ + PRJDIR = .. DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@) @@ -36,7 +40,8 @@ srcdir = @srcdir@ OBJECTS = cmdset.o command.o newcmd.o cmdutil.o syntax.o \ get.o set.o timer.o bp.o info.o show.o cmdgui.o cmdconf.o \ - cmduc.o cmdstat.o + cmduc.o cmdstat.o cmdmem.o \ + cmdpars.o cmdlex.o # Compiling entire program or any subproject @@ -83,9 +88,9 @@ Makefile.dep: *.cc *.h include Makefile.dep include clean.mk -#parser.cc: parser.y +cmdpars.cc: cmdpars.y -#plex.cc: plex.l +cmdlex.cc: cmdlex.l cmdpars.h # My rules # -------- @@ -99,15 +104,19 @@ $(PRJDIR)/libcmd.a: $(OBJECTS) .cc.o: $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ +#.y.cc: +# rm -f $*.cc $*.h +# $(YACC) -d $< +# mv y.tab.c $*.cc +# mv y.tab.h $*.h + .y.cc: rm -f $*.cc $*.h - $(YACC) -d $< - mv y.tab.c $*.cc - mv y.tab.h $*.h + $(BISON_PLUS_PLUS) -d -o $*.cc $< .l.cc: rm -f $*.cc - $(LEX) -t $< >$*.cc + $(LEX) --c++ -o $*.cc $< # Remaking configuration diff --git a/sim/ucsim/cmd.src/bp.cc b/sim/ucsim/cmd.src/bp.cc index 7a130240..617f43e5 100644 --- a/sim/ucsim/cmd.src/bp.cc +++ b/sim/ucsim/cmd.src/bp.cc @@ -51,7 +51,7 @@ COMMAND_DO_WORK_UC(cl_break_cmd) t_addr addr= 0; int hit= 1; char op; - class cl_mem *mem; + class cl_address_space *mem; class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), cmdline->param(2), @@ -68,14 +68,14 @@ COMMAND_DO_WORK_UC(cl_break_cmd) do_fetch(uc, addr, hit, con); } else if (cmdline->syntax_match(uc, MEMORY STRING ADDRESS)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.address_space; op= *(params[1]->get_svalue()); addr= params[2]->value.address; hit= 1; do_event(uc, mem, op, addr, hit, con); } else if (cmdline->syntax_match(uc, MEMORY STRING ADDRESS NUMBER)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.address_space; op= *(params[1]->get_svalue()); addr= params[2]->value.address; hit= params[3]->value.number; @@ -102,7 +102,7 @@ cl_break_cmd::do_fetch(class cl_uc *uc, con->dd_printf("Breakpoint at 0x%06x is already set.\n", addr); else { - class cl_brk *b= new cl_fetch_brk(uc->mem(MEM_ROM), + class cl_brk *b= new cl_fetch_brk(uc->address_space(MEM_ROM_ID), uc->make_new_brknr(), addr, perm, hit); b->init(); @@ -115,7 +115,8 @@ cl_break_cmd::do_fetch(class cl_uc *uc, void cl_break_cmd::do_event(class cl_uc *uc, - class cl_mem *mem, char op, t_addr addr, int hit, + class cl_address_space *mem, + char op, t_addr addr, int hit, class cl_console *con) { class cl_ev_brk *b= NULL; diff --git a/sim/ucsim/cmd.src/bpcl.h b/sim/ucsim/cmd.src/bpcl.h index ecf43952..61e0b7f4 100644 --- a/sim/ucsim/cmd.src/bpcl.h +++ b/sim/ucsim/cmd.src/bpcl.h @@ -39,7 +39,8 @@ COMMAND_METHODS_ON(uc,cl_break_cmd) virtual void do_fetch(class cl_uc *uc, t_addr addr, int hit, class cl_console *con); virtual void do_event(class cl_uc *uc, - class cl_mem *mem, char op, t_addr addr, int hit, + class cl_address_space *mem, + char op, t_addr addr, int hit, class cl_console *con); COMMAND_TAIL; diff --git a/sim/ucsim/cmd.src/cmdconf.cc b/sim/ucsim/cmd.src/cmdconf.cc index 1d4d79e5..a78cc7f7 100644 --- a/sim/ucsim/cmd.src/cmdconf.cc +++ b/sim/ucsim/cmd.src/cmdconf.cc @@ -57,50 +57,44 @@ COMMAND_DO_WORK_UC(cl_conf_cmd) class cl_hw *hw= (class cl_hw *)(uc->hws->at(i)); con->dd_printf(" %s[%d]\n", hw->id_string, hw->id); } - con->dd_printf("Memories:\n"); - for (i= MEM_ROM; i < MEM_TYPES; i++) - { - class cl_mem *mem= (class cl_mem *)(uc->mems->at(i)); - if (mem) - con->dd_printf(" %s size= 0x%06x %6d width= %2d class= \"%s\"\n", - mem->id_string(), mem->size, mem->size, mem->width, - (mem->class_name)?(mem->class_name):"unknown"); - } return(0); } /* - * Command: conf addmem + * Command: conf objects *---------------------------------------------------------------------------- */ +static void +conf_objects_cmd_print_node(class cl_console *con, + int indent, class cl_base *node) +{ + if (!node) + return; + int i; + for (i= 0; i < indent; i++) + con->dd_printf(" "); + char *name= node->get_name("unknown"); + con->dd_printf("%s\n", name); + class cl_base *c= node->first_child(); + while (c) + { + conf_objects_cmd_print_node(con, indent+2, c); + c= node->next_child(c); + } +} + //int //cl_conf_addmem_cmd::do_work(class cl_sim *sim, // class cl_cmdline *cmdline, class cl_console *con) -COMMAND_DO_WORK_UC(cl_conf_addmem_cmd) +COMMAND_DO_WORK_APP(cl_conf_objects_cmd) { - class cl_mem *mem= 0; - class cl_cmd_arg *params[4]= { cmdline->param(0), + //class cl_address_space *mem= 0; + /*class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), cmdline->param(2), - cmdline->param(3) }; - char *mem_class; - - if (cmdline->syntax_match(uc, STRING)) { - mem_class= params[0]->value.string.string; - enum mem_class type; - type= (enum mem_class)get_string_id(mem_classes, mem_class, -1); - mem= uc->mk_mem(type, mem_class); - if (mem) - { - class cl_mem *m= uc->mem(type); - if (m) - delete m; - uc->mems->put_at(type, mem); - } - else - con->dd_printf("Can not make memory \"%s\"\n", mem_class); - } + cmdline->param(3) };*/ + conf_objects_cmd_print_node(con, 0, application); return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/cmdconfcl.h b/sim/ucsim/cmd.src/cmdconfcl.h index 9be11ca2..68ebc2a7 100644 --- a/sim/ucsim/cmd.src/cmdconfcl.h +++ b/sim/ucsim/cmd.src/cmdconfcl.h @@ -34,8 +34,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // CONF COMMAND_ON(uc,cl_conf_cmd); -// CONF ADDMEM -COMMAND_ON(uc,cl_conf_addmem_cmd); +// CONF OBJECTS +COMMAND_ON(app,cl_conf_objects_cmd); #endif diff --git a/sim/ucsim/cmd.src/cmdgui.cc b/sim/ucsim/cmd.src/cmdgui.cc index cd10416e..5a1fdef9 100644 --- a/sim/ucsim/cmd.src/cmdgui.cc +++ b/sim/ucsim/cmd.src/cmdgui.cc @@ -48,7 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA COMMAND_DO_WORK_UC(cl_gui_start_cmd) { class cl_hw *hw; - class cl_mem *mem; + class cl_memory *mem; t_addr start, end; class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), @@ -59,7 +59,7 @@ COMMAND_DO_WORK_UC(cl_gui_start_cmd) hw= params[0]->value.hw; } else if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.memory; start= params[1]->value.address; end= params[2]->value.address; } diff --git a/sim/ucsim/cmd.src/cmdset.cc b/sim/ucsim/cmd.src/cmdset.cc index 40ab4495..f0226ceb 100644 --- a/sim/ucsim/cmd.src/cmdset.cc +++ b/sim/ucsim/cmd.src/cmdset.cc @@ -27,6 +27,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ddconfig.h" +#include "cmdlexcl.h" +#include "cmdpars.h" + // prj #include "i_string.h" #include "utils.h" @@ -86,7 +89,7 @@ COMMAND_DO_WORK_SIM(cl_run_cmd) } else { - b= new cl_fetch_brk(sim->uc->mem(MEM_ROM), + b= new cl_fetch_brk(sim->uc->address_space(MEM_ROM_ID), sim->uc->make_new_brknr(), end, brkDYNAMIC, 1); sim->uc->fbrk->add_bp(b); @@ -172,7 +175,7 @@ COMMAND_DO_WORK_SIM(cl_next_cmd) next= sim->uc->PC + inst_len; if (!sim->uc->fbrk_at(next)) { - b= new cl_fetch_brk(sim->uc->mem(MEM_ROM), + b= new cl_fetch_brk(sim->uc->address_space(MEM_ROM_ID), sim->uc->make_new_brknr(), next, brkDYNAMIC, 1); @@ -206,29 +209,87 @@ COMMAND_DO_WORK_SIM(cl_next_cmd) COMMAND_DO_WORK_APP(cl_help_cmd) { class cl_sim *sim; - class cl_commander *cmd; + class cl_commander *commander; class cl_cmdset *cmdset= 0; - class cl_cmd *c; int i; class cl_cmd_arg *parm= cmdline->param(0); sim= app->get_sim(); - if ((cmd= app->get_commander()) != 0) - cmdset= cmd->cmdset; + if ((commander= app->get_commander()) != 0) + cmdset= commander->cmdset; if (!cmdset) return(DD_FALSE); if (!parm) { for (i= 0; i < cmdset->count; i++) { - c= (class cl_cmd *)(cmdset->at(i)); + class cl_cmd *c= (class cl_cmd *)(cmdset->at(i)); if (c->short_help) con->dd_printf("%s\n", c->short_help); else con->dd_printf("%s\n", (char*)(c->names->at(0))); } } - else if (cmdline->syntax_match(/*sim*/0, STRING)) { - int matches= 0; + else + { + matches= 0; + do_set(cmdline, 0, cmdset, con); + if (matches == 1 && + cmd_found) + { + int names; + con->dd_printf("Names of command:"); + for (names= 0; names < cmd_found->names->count; names++) + con->dd_printf(" %s", (char*)(cmd_found->names->at(names))); + con->dd_printf("\n"); + class cl_cmdset *subset= cmd_found->get_subcommands(); + if (subset) + { + con->dd_printf("\"%s\" must be followed by the name of a " + "subcommand\nList of subcommands:\n", + (char*)(cmd_found->names->at(0))); + for (i= 0; i < subset->count; i++) + { + class cl_cmd *c= + dynamic_cast(subset->object_at(i)); + con->dd_printf("%s\n", c->short_help); + } + } + if (cmd_found->long_help) + con->dd_printf("%s\n", cmd_found->long_help); + } + if (!matches || + !cmd_found) + con->dd_printf("No such command.\n"); + //return(DD_FALSE); + /* + int pari; + for (pari= 0; pari < cmdline->nuof_params(); pari++) + { + class cl_cmd_arg *act_param; + act_param= (class cl_cmd_arg *)(cmdline->param(pari)); + for (i= 0; i < cmdset->count; i++) + { + class cl_cmd *c= (class cl_cmd *)(cmdset->at(i)); + if (!c->name_match(act_param->s_value, DD_FALSE)) + continue; + if (c->short_help) + con->dd_printf("%s\n", c->short_help); + else + con->dd_printf("%s\n", (char*)(c->names->at(0))); + if (pari < cmdline->nuof_params()-1) + continue; + cmdset= c->get_subcommands(); + if (!cmdset) + return(DD_FALSE); + } + } + return(DD_FALSE); + */ + } + return(DD_FALSE); + /* + if (cmdline->syntax_match(0, STRING)) { + matches= 0; for (i= 0; i < cmdset->count; i++) { c= (class cl_cmd *)(cmdset->at(i)); @@ -273,6 +334,44 @@ COMMAND_DO_WORK_APP(cl_help_cmd) con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax"); return(0); + */ +} + +bool +cl_help_cmd::do_set(class cl_cmdline *cmdline, int pari, + class cl_cmdset *cmdset, + class cl_console *con) +{ + int i; + for (i= 0; i < cmdset->count; i++) + { + class cl_cmd *cmd= dynamic_cast(cmdset->object_at(i)); + if (!cmd) + continue; + if (pari >= cmdline->nuof_params()) + return(DD_FALSE); + class cl_cmd_arg *param= cmdline->param(pari); + if (!param) + return(DD_FALSE); + class cl_cmdset *next_set= cmd->get_subcommands(); + if (cmd->name_match(param->s_value, DD_FALSE)) + { + if (pari+1 >= cmdline->nuof_params()) + { + matches++; + cmd_found= cmd; + if (cmd->short_help) + con->dd_printf("%s\n", cmd->short_help); + else + con->dd_printf("%s\n", (char*)(cmd->names->at(0))); + //continue; + } + else + if (next_set) + do_set(cmdline, pari+1, next_set, con); + } + } + return(DD_TRUE); } @@ -334,4 +433,31 @@ COMMAND_DO_WORK_APP(cl_exec_cmd) } +/* + * expression expression + */ + +COMMAND_DO_WORK_APP(cl_expression_cmd) +{ + //con->dd_printf("\"%s\"\n", cmdline->cmd); + char *s= cmdline->cmd; + if (!s || + !*s) + return(DD_FALSE); + int i= strspn(s, " \t\v\n"); + s+= i; + //con->dd_printf("\"%s\"\n", s); + i= strspn(s, "abcdefghijklmnopqrstuvwxyz"); + s+= i; + //con->dd_printf("\"%s\"\n", s); + class YY_cl_ucsim_parser_CLASS *pars; + class cl_ucsim_lexer *lexer; + lexer= new cl_ucsim_lexer(s); + pars= new YY_cl_ucsim_parser_CLASS(lexer); + pars->yyparse(); + delete pars; + return(DD_FALSE); +} + + /* End of cmd.src/cmdset.cc */ diff --git a/sim/ucsim/cmd.src/cmdsetcl.h b/sim/ucsim/cmd.src/cmdsetcl.h index 298a476c..381c2cf7 100644 --- a/sim/ucsim/cmd.src/cmdsetcl.h +++ b/sim/ucsim/cmd.src/cmdsetcl.h @@ -32,15 +32,27 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "commandcl.h" #include "newcmdcl.h" + // STATE COMMAND_ON(sim,cl_run_cmd); COMMAND_ON(sim,cl_stop_cmd); COMMAND_ON(uc,cl_step_cmd); COMMAND_ON(sim,cl_next_cmd); -COMMAND_ON(app,cl_help_cmd); + +//COMMAND_ON(app,cl_help_cmd); +COMMAND_HEAD(cl_help_cmd) +COMMAND_METHODS_ON(app,cl_help_cmd) + private: +int matches; +class cl_cmd *cmd_found; +bool do_set(class cl_cmdline *cmdline, int pari, class cl_cmdset *cmdset, + class cl_console *con); +COMMAND_TAIL; + COMMAND(cl_quit_cmd); COMMAND_ON(app,cl_kill_cmd); COMMAND_ON(app,cl_exec_cmd); +COMMAND_ON(app,cl_expression_cmd); #endif diff --git a/sim/ucsim/cmd.src/cmdstat.cc b/sim/ucsim/cmd.src/cmdstat.cc index f430437c..fbf5dd92 100644 --- a/sim/ucsim/cmd.src/cmdstat.cc +++ b/sim/ucsim/cmd.src/cmdstat.cc @@ -49,7 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA COMMAND_DO_WORK_UC(cl_statistic_cmd) { class cl_hw *hw; - class cl_mem *mem; + class cl_address_space *mem; t_addr start= 0, end= 0; bool addresses= DD_FALSE; class cl_cmd_arg *params[4]= { cmdline->param(0), @@ -63,18 +63,18 @@ COMMAND_DO_WORK_UC(cl_statistic_cmd) else { mem= 0; if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.address_space; start= params[1]->value.address; end= params[2]->value.address; addresses= DD_TRUE; } else if (cmdline->syntax_match(uc, MEMORY ADDRESS)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.address_space; start= end= params[1]->value.address; addresses= DD_TRUE; } else if (cmdline->syntax_match(uc, MEMORY)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.address_space; addresses= DD_FALSE; } else @@ -83,15 +83,15 @@ COMMAND_DO_WORK_UC(cl_statistic_cmd) "%s\n", short_help?short_help:"no help");*/ int i; unsigned long wr, ww; - for (i= 0; i < uc->mems->count; i++) + for (i= 0; i < uc->address_spaces->count; i++) { - mem= (class cl_mem *)(uc->mems->at(i)); + mem= (class cl_address_space *)(uc->address_spaces->at(i)); wr= mem->get_nuof_reads(); ww= mem->get_nuof_writes(); con->dd_printf("%s writes= %10lu " "reads= %10lu " - "(%10lu operations)\n", mem->id_string(), ww, wr, - ww+wr); + "(%10lu operations)\n", + mem->get_name("mem"), ww, wr, ww+wr); } } if (mem) @@ -102,17 +102,17 @@ COMMAND_DO_WORK_UC(cl_statistic_cmd) ww= mem->get_nuof_writes(); if (!addresses) con->dd_printf("%s writes= %10lu " - "reads= %10lu\n", mem->id_string(), ww, wr); + "reads= %10lu\n", mem->get_name("mem"), ww, wr); else for (i= start; i <= end; i++) { - class cl_cell *c= (class cl_cell *)(mem->get_cell(i)); + class cl_memory_cell *c= mem->get_cell(i); unsigned long w= c->nuof_writes, r= c->nuof_reads; double dr= wr?((double(r)*100.0)/double(wr)):0.0; double dw= ww?((double(w)*100.0)/double(ww)):0.0; con->dd_printf("%s[0x%06x] writes= %10lu (%6.2lf%%) " - "reads= %10lu (%6.2lf%%)\n", mem->id_string(), i, - w, dw, r, dr); + "reads= %10lu (%6.2lf%%)\n", + mem->get_name("mem"), i, w, dw, r, dr); } } } diff --git a/sim/ucsim/cmd.src/cmduc.cc b/sim/ucsim/cmd.src/cmduc.cc index 3623bd7a..cb3aa557 100644 --- a/sim/ucsim/cmd.src/cmduc.cc +++ b/sim/ucsim/cmd.src/cmduc.cc @@ -135,8 +135,12 @@ COMMAND_DO_WORK_UC(cl_pc_cmd) con->dd_printf("Error: wrong parameter\n"); return(DD_FALSE); } - if (addr >= uc->get_mem_size(MEM_ROM)) - addr= 0; + class cl_address_space *rom= uc->address_space(MEM_ROM_ID); + if (rom) + { + if (addr > rom->highest_valid_address()) + addr= rom->highest_valid_address(); + } if (!uc->inst_at(addr)) con->dd_printf("Warning: maybe not instruction at 0x%06x\n", addr); uc->PC= addr; @@ -171,7 +175,7 @@ COMMAND_DO_WORK_UC(cl_reset_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_dump_cmd) { - class cl_mem *mem= 0; + class cl_memory *mem= 0; long bpl= 8; t_addr start= 0, end; class cl_cmd_arg *params[4]= { cmdline->param(0), @@ -205,32 +209,41 @@ COMMAND_DO_WORK_UC(cl_dump_cmd) if (params[0]) con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); } - else if (cmdline->syntax_match(uc, MEMORY)) + else { - mem= params[0]->value.memory; - mem->dump(con); + if (!params[0] || + !params[0]->as_memory(uc)) + { + con->dd_printf("No memory specified. Use \"info memory\" for available memories\n"); + return(DD_FALSE); + } + if (cmdline->syntax_match(uc, MEMORY)) + { + mem= params[0]->value.memory.memory; + mem->dump(con); + } + else if (cmdline->syntax_match(uc, MEMORY ADDRESS)) { + mem = params[0]->value.memory.memory; + start= params[1]->value.address; + end = start+10*8-1; + mem->dump(start, end, bpl, con); + } + else if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS)) { + mem = params[0]->value.memory.memory; + start= params[1]->value.address; + end = params[2]->value.address; + mem->dump(start, end, bpl, con); + } + else if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS NUMBER)) { + mem = params[0]->value.memory.memory; + start= params[1]->value.address; + end = params[2]->value.address; + bpl = params[3]->value.number; + mem->dump(start, end, bpl, con); + } + else + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); } - else if (cmdline->syntax_match(uc, MEMORY ADDRESS)) { - mem = params[0]->value.memory; - start= params[1]->value.address; - end = start+10*8-1; - mem->dump(start, end, bpl, con); - } - else if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS)) { - mem = params[0]->value.memory; - start= params[1]->value.address; - end = params[2]->value.address; - mem->dump(start, end, bpl, con); - } - else if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS NUMBER)) { - mem = params[0]->value.memory; - start= params[1]->value.address; - end = params[2]->value.address; - bpl = params[3]->value.number; - mem->dump(start, end, bpl, con); - } - else - con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE);; } @@ -246,7 +259,7 @@ COMMAND_DO_WORK_UC(cl_dump_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_di_cmd) { - cmdline->insert_param(0, new cl_cmd_sym_arg("i")); + cmdline->insert_param(0, new cl_cmd_sym_arg("iram")); cl_dump_cmd::do_work(uc, cmdline, con); return(0); } @@ -262,7 +275,7 @@ COMMAND_DO_WORK_UC(cl_di_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_dx_cmd) { - cmdline->insert_param(0, new cl_cmd_sym_arg("x")); + cmdline->insert_param(0, new cl_cmd_sym_arg("xram")); cl_dump_cmd::do_work(uc, cmdline, con); return(0); } @@ -278,7 +291,7 @@ COMMAND_DO_WORK_UC(cl_dx_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_dch_cmd) { - cmdline->insert_param(0, new cl_cmd_sym_arg("r")); + cmdline->insert_param(0, new cl_cmd_sym_arg("rom")); cl_dump_cmd::do_work(uc, cmdline, con); return(0); } @@ -294,7 +307,7 @@ COMMAND_DO_WORK_UC(cl_dch_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_ds_cmd) { - cmdline->insert_param(0, new cl_cmd_sym_arg("s")); + cmdline->insert_param(0, new cl_cmd_sym_arg("sfr")); cl_dump_cmd::do_work(uc, cmdline, con); return(0); } @@ -313,7 +326,7 @@ COMMAND_DO_WORK_UC(cl_dc_cmd) t_addr start= last, end= last+20; class cl_cmd_arg *params[2]= { cmdline->param(0), cmdline->param(1) }; - class cl_mem *rom= uc->mem(MEM_ROM); + class cl_address_space *rom= uc->address_space(MEM_ROM_ID); if (!rom) return(DD_FALSE); @@ -327,14 +340,14 @@ COMMAND_DO_WORK_UC(cl_dc_cmd) start= params[0]->value.address; end= params[1]->value.address; } - if (start >= rom->size) + if (start > rom->highest_valid_address()) { - con->dd_printf("Error: start address is wrong\n"); + con->dd_printf("Error: start address is too high\n"); return(DD_FALSE); } - if (end >= rom->size) + if (end > rom->highest_valid_address()) { - con->dd_printf("Error: end address is wrong\n"); + con->dd_printf("Error: end address is too high\n"); return(DD_FALSE); } @@ -394,10 +407,10 @@ COMMAND_DO_WORK_UC(cl_disassemble_cmd) if (!uc->there_is_inst()) return(DD_FALSE); realstart= start; - class cl_mem *rom= uc->mem(MEM_ROM); + class cl_address_space *rom= uc->address_space(MEM_ROM_ID); if (!rom) return(DD_FALSE); - while (realstart < rom->size && + while (realstart <= rom->highest_valid_address() && !uc->inst_at(realstart)) realstart= realstart+1; if (offset) @@ -405,9 +418,9 @@ COMMAND_DO_WORK_UC(cl_disassemble_cmd) dir= (offset < 0)?-1:+1; while (offset) { - realstart= (realstart+dir) % rom->size; + realstart= rom->inc_address(realstart, dir); while (!uc->inst_at(realstart)) - realstart= (realstart+dir) % rom->size; + realstart= rom->inc_address(realstart, dir); offset+= -dir; } } @@ -415,9 +428,9 @@ COMMAND_DO_WORK_UC(cl_disassemble_cmd) while (lines) { uc->print_disass(realstart, con); - realstart= (realstart+1) % rom->size; + realstart= rom->inc_address(realstart, +1) + rom->start_address; while (!uc->inst_at(realstart)) - realstart= (realstart+1) % rom->size; + realstart= rom->inc_address(realstart, +1) + rom->start_address; lines--; } @@ -437,7 +450,7 @@ COMMAND_DO_WORK_UC(cl_disassemble_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_fill_cmd) { - class cl_mem *mem= 0; + class cl_memory *mem= 0; t_mem what= 0; t_addr start= 0, end; class cl_cmd_arg *params[4]= { cmdline->param(0), @@ -446,7 +459,7 @@ COMMAND_DO_WORK_UC(cl_fill_cmd) cmdline->param(3) }; if (cmdline->syntax_match(uc, MEMORY ADDRESS ADDRESS NUMBER)) { - mem = params[0]->value.memory; + mem = params[0]->value.memory.memory; start= params[1]->value.address; end = params[2]->value.address; what = params[3]->value.number; @@ -475,12 +488,12 @@ cl_where_cmd::do_real_work(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con, bool case_sensitive) { - class cl_mem *mem= 0; + class cl_memory *mem= 0; class cl_cmd_arg *params[2]= { cmdline->param(0), cmdline->param(1) }; if (cmdline->syntax_match(uc, MEMORY DATALIST)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.memory; t_mem *array= params[1]->value.data_list.array; int len= params[1]->value.data_list.len; if (!len) diff --git a/sim/ucsim/cmd.src/cmdutil.cc b/sim/ucsim/cmd.src/cmdutil.cc index 50a90e3e..aa831bf8 100644 --- a/sim/ucsim/cmd.src/cmdutil.cc +++ b/sim/ucsim/cmd.src/cmdutil.cc @@ -118,7 +118,10 @@ get_name_entry(struct name_entry tabl[], char *name, class cl_uc *uc) while (tabl[i].name && (!(tabl[i].cpu_type & uc->type) || (strcmp(tabl[i].name, name) != 0))) - i++; + { + //printf("tabl[%d].name=%s <-> %s\n",i,tabl[i].name,name); + i++; + } if (tabl[i].name != NULL) return(&tabl[i]); else diff --git a/sim/ucsim/cmd.src/command.cc b/sim/ucsim/cmd.src/command.cc index e58a2251..6d96129e 100644 --- a/sim/ucsim/cmd.src/command.cc +++ b/sim/ucsim/cmd.src/command.cc @@ -47,8 +47,8 @@ cl_cmdline::cl_cmdline(class cl_app *the_app, { app= the_app; cmd= strdup(acmd); - params= new cl_list(2, 2); - tokens= new cl_ustrings(2, 2); + params= new cl_list(2, 2, "command line params"); + tokens= new cl_ustrings(2, 2, "command line tokens"); set_name(0); matched_syntax= 0; con= acon; @@ -87,7 +87,7 @@ cl_cmdline::split(void) class cl_cmd_arg *arg; //sim= app->get_sim(); - set_name(0); + set_name("\n"); if (!cmd || !*cmd) return(0); @@ -115,170 +115,25 @@ cl_cmdline::split(void) // skip delimiters while (*start) { - char *end, *param_str; + char *end= start, *param_str; if (*start == '"') - { - // string - start++; - end= start; - while (*end && - *end != '"') - { - if (*end == '\\') - { - end++; - if (*end) - end++; - } - else - end++; - } - if (*end == '"') - end--; - else - con->dd_printf("Unterminated string\n"); - param_str= (char *)malloc(end-start+2); - strncpy(param_str, start, 1+end-start); - param_str[1+end-start]= '\0'; - tokens->add(strdup(param_str)); - params->add(arg= new cl_cmd_str_arg(param_str)); - arg->init(); - free(param_str); - if (*end) - end++; - if (*end == '"') - end++; - } + split_out_string(&start, &end); + else if (*start == '>') + split_out_output_redirection(&start, &end); else { char *dot; - i= strcspn(start, " \t\v\r,"); - end= start+i; - param_str= (char *)malloc(i+1); - strncpy(param_str, start, i); + i= strcspn(start, " \t\v\r,"); + end= start+i; + param_str= (char *)malloc(i+1); + strncpy(param_str, start, i); param_str[i]= '\0'; - if (strchr(">", *start)) - { - char *fn, mode[3]= "w\0"; - switch (*start) - { - case '>': - if (i == 1 || - (i == 2 && - start[1] == '>')) { - con->dd_printf("Unspecified redirection\n"); - break; - } - fn= start+1; - if (*fn == '>') { - fn++; - mode[0]= 'a'; - } - con->redirect(fn, mode); - break; - default: - break; - } - free(param_str); - start= end; - start= skip_delims(start); - continue; - } tokens->add(strdup(param_str)); if ((dot= strchr(param_str, '.')) != NULL) - { - // bit - class cl_cmd_arg *sfr, *bit; - *dot= '\0'; - dot++; - if (strchr("0123456789", *param_str) != NULL) - { - sfr= new cl_cmd_int_arg((long)strtol(param_str, 0, 0)); - sfr->init(); - } - else - { - sfr= new cl_cmd_sym_arg(param_str); - sfr->init(); - } - if (*dot == '\0') - { - bit= 0; - con->dd_printf("Uncomplete bit address\n"); - delete sfr; - } - else - { - if (strchr("0123456789", *dot) != NULL) - { - bit= new cl_cmd_int_arg((long)strtol(dot, 0, 0)); - bit->init(); - } - else - { - bit= new cl_cmd_sym_arg(dot); - bit->init(); - } - params->add(arg= new cl_cmd_bit_arg(sfr, bit)); - arg->init(); - } - } + split_out_bit(dot, param_str); else if ((dot= strchr(param_str, '[')) != NULL) - { - // array - class cl_cmd_arg *aname, *aindex; - *dot= '\0'; - dot++; - if (strchr("0123456789", *param_str) != NULL) - { - aname= new cl_cmd_int_arg((long)strtol(param_str, 0, 0)); - aname->init(); - } - else - { - aname= new cl_cmd_sym_arg(param_str); - aname->init(); - } - if (*dot == '\0') - { - aname= 0; - con->dd_printf("Uncomplete array\n"); - } - else - { - char *p; - p= dot + strlen(dot) - 1; - while (p > dot && - *p != ']') - { - *p= '\0'; - p--; - } - if (*p == ']') - *p= '\0'; - if (strlen(dot) == 0) - { - con->dd_printf("Uncomplete array index\n"); - delete aname; - } - else - { - if (strchr("0123456789", *dot) != NULL) - { - aindex= new cl_cmd_int_arg((long)strtol(dot, 0, 0)); - aindex->init(); - } - else - { - aindex= new cl_cmd_sym_arg(dot); - aindex->init(); - } - params->add(arg= new cl_cmd_array_arg(aname, aindex)); - arg->init(); - } - } - } - else if (strchr("0123456789", *param_str) != NULL) + split_out_array(dot, param_str); + else if (strchr("0123456789-+", *param_str) != NULL) { // number params->add(arg= new cl_cmd_int_arg((long) @@ -299,6 +154,172 @@ cl_cmdline::split(void) return(0); } +void +cl_cmdline::split_out_string(char **_start, char **_end) +{ + char *start= *_start, *end; + start++; + end= start; + while (*end && + *end != '"') + { + if (*end == '\\') + { + end++; + if (*end) + end++; + } + else + end++; + } + if (*end == '"') + end--; + else + con->dd_printf("Unterminated string\n"); + char *param_str= (char *)malloc(end-start+2); + strncpy(param_str, start, 1+end-start); + param_str[1+end-start]= '\0'; + tokens->add(strdup(param_str)); + class cl_cmd_arg *arg; + params->add(arg= new cl_cmd_str_arg(param_str)); + arg->init(); + free(param_str); + if (*end) + end++; + if (*end == '"') + end++; + *_start= start; + *_end= end; +} + +void +cl_cmdline::split_out_output_redirection(char **_start, char **_end) +{ + char *start= *_start, *end/*= *_end*/; + int i; + char mode[2]; + + mode[0]= 'w'; + mode[1]= '\0'; + start++; + i= strcspn(start, " \t\v\r,"); + end= start+i; + char *param_str= (char *)malloc(i+1); + char *n= param_str; + strncpy(param_str, start, i); + param_str[i]= '\0'; + if (param_str && + param_str[0] == '>') + { + n++; + mode[0]= 'a'; + } + tokens->add(strdup(n)); + con->redirect(n, mode); + free(param_str); + *_start= start; + *_end= end; +} + +void +cl_cmdline::split_out_bit(char *dot, char *param_str) +{ + class cl_cmd_arg *sfr, *bit; + + *dot= '\0'; + dot++; + if (strchr("0123456789", *param_str) != NULL) + { + sfr= new cl_cmd_int_arg((long)strtol(param_str, 0, 0)); + sfr->init(); + } + else + { + sfr= new cl_cmd_sym_arg(param_str); + sfr->init(); + } + if (*dot == '\0') + { + bit= 0; + con->dd_printf("Uncomplete bit address\n"); + delete sfr; + } + else + { + if (strchr("0123456789", *dot) != NULL) + { + bit= new cl_cmd_int_arg((long)strtol(dot, 0, 0)); + bit->init(); + } + else + { + bit= new cl_cmd_sym_arg(dot); + bit->init(); + } + class cl_cmd_arg *arg; + params->add(arg= new cl_cmd_bit_arg(sfr, bit)); + arg->init(); + } +} + +void +cl_cmdline::split_out_array(char *dot, char *param_str) +{ + class cl_cmd_arg *aname, *aindex; + + *dot= '\0'; + dot++; + if (strchr("0123456789", *param_str) != NULL) + { + aname= new cl_cmd_int_arg((long)strtol(param_str, 0, 0)); + aname->init(); + } + else + { + aname= new cl_cmd_sym_arg(param_str); + aname->init(); + } + if (*dot == '\0') + { + aname= 0; + con->dd_printf("Uncomplete array\n"); + } + else + { + char *p; + p= dot + strlen(dot) - 1; + while (p > dot && + *p != ']') + { + *p= '\0'; + p--; + } + if (*p == ']') + *p= '\0'; + if (strlen(dot) == 0) + { + con->dd_printf("Uncomplete array index\n"); + delete aname; + } + else + { + if (strchr("0123456789", *dot) != NULL) + { + aindex= new cl_cmd_int_arg((long)strtol(dot, 0, 0)); + aindex->init(); + } + else + { + aindex= new cl_cmd_sym_arg(dot); + aindex->init(); + } + class cl_cmd_arg *arg; + params->add(arg= new cl_cmd_array_arg(aname, aindex)); + arg->init(); + } + } +} + int cl_cmdline::shift(void) { @@ -315,8 +336,10 @@ cl_cmdline::shift(void) free(cmd); cmd= p; delete params; - params= new cl_list(2, 2); + params= new cl_list(2, 2, "params"); split(); + if (strcmp(get_name(), "\n") == 0) + set_name(0); } return(have_real_name()); } @@ -363,23 +386,20 @@ cl_cmdline::syntax_match(class cl_uc *uc, char *syntax) char *p= syntax; int iparam= 0; class cl_cmd_arg *parm= (class cl_cmd_arg *)(params->at(iparam)); - bool match; while (*p && parm) { - //printf("Checking %s as %c\n",parm->get_svalue(),*p); + //printf("***Checking %s as %c\n",parm->get_svalue(),*p); if (uc) switch (*p) { case SY_ADDR: - match= parm->as_address(uc); - if (!match) - return(match); + if (!parm->as_address(uc)) + return(DD_FALSE); //printf("ADDRESS match %lx\n",parm->value.address); break; case SY_MEMORY: - match= parm->as_memory(uc); - if (!match) + if (!parm->as_memory(uc)) return(DD_FALSE); //printf("MEMORY match %s\n",parm->value.memory->class_name); break; @@ -498,7 +518,7 @@ cl_cmd::cl_cmd(enum cmd_operate_on op_on, cl_base() { operate_on= op_on; - names= new cl_strings(1, 1); + names= new cl_strings(1, 1, "names of a command"); names->add(aname?strdup(aname):strdup("unknown")); can_repeat= can_rep; short_help= short_hlp?strdup(short_hlp):NULL; @@ -652,10 +672,10 @@ cl_cmd::do_work(class cl_uc *uc, */ cl_cmdset::cl_cmdset(void): - cl_list(5, 5) + cl_list(5, 5, "cmdset") { //sim= 0; - last_command= 0; + //last_command= 0; } /*cl_cmdset::cl_cmdset(class cl_sim *asim): @@ -666,17 +686,10 @@ cl_cmdset::cl_cmdset(void): }*/ class cl_cmd * -cl_cmdset::get_cmd(class cl_cmdline *cmdline) +cl_cmdset::get_cmd(class cl_cmdline *cmdline, bool accept_last) { int i; - if (cmdline->repeat()) - { - if (last_command) - return(last_command); - else - return(0); - } // exact match for (i= 0; i < count; i++) { @@ -793,7 +806,7 @@ cl_super_cmd::work(class cl_app *app, } return(0); } - if ((cmd= commands->get_cmd(cmdline)) == NULL) + if ((cmd= commands->get_cmd(cmdline, con->accept_last())) == NULL) { con->dd_printf("Undefined subcommand: \"%s\". Try \"help %s\".\n", cmdline->get_name(), (char*)(names->at(0))); diff --git a/sim/ucsim/cmd.src/commandcl.h b/sim/ucsim/cmd.src/commandcl.h index 3bec252d..36dc7767 100644 --- a/sim/ucsim/cmd.src/commandcl.h +++ b/sim/ucsim/cmd.src/commandcl.h @@ -65,6 +65,12 @@ public: virtual ~cl_cmdline(void); virtual int init(void); +private: + virtual void split_out_string(char **_start, char **_end); + virtual void split_out_output_redirection(char **_start, char **_end); + virtual void split_out_bit(char *dot, char *param_str); + virtual void split_out_array(char *dot, char *param_str); +public: virtual int split(void); virtual int shift(void); virtual int repeat(void); @@ -72,6 +78,7 @@ public: virtual void insert_param(int pos, class cl_cmd_arg *param); virtual bool syntax_match(class cl_uc *uc, char *syntax); virtual bool set_data_list(class cl_cmd_arg *parm, int *iparm); + virtual int nuof_params(void) { return(params->get_count()); } private: char *skip_delims(char *start); }; @@ -81,6 +88,8 @@ private: * Command and container */ +class cl_cmdset; + // simple command class cl_cmd: public cl_base { @@ -99,6 +108,7 @@ public: char *long_hlp); virtual ~cl_cmd(void); + virtual class cl_cmdset *get_subcommands(void) { return(0); } virtual void add_name(char *nam); virtual int name_match(char *aname, int strict); virtual int name_match(class cl_cmdline *cmdline, int strict); @@ -222,13 +232,13 @@ class cl_cmdset: public cl_list { public: //class cl_sim *sim; - class cl_cmd *last_command; + //class cl_cmd *last_command; public: cl_cmdset(void); //cl_cmdset(class cl_sim *asim); - virtual class cl_cmd *get_cmd(class cl_cmdline *cmdline); + virtual class cl_cmd *get_cmd(class cl_cmdline *cmdline, bool accept_last); virtual class cl_cmd *get_cmd(char *cmd_name); virtual void del(char *nam); virtual void replace(char *nam, class cl_cmd *cmd); @@ -248,6 +258,7 @@ public: class cl_cmdset *acommands); virtual ~cl_super_cmd(void); + virtual class cl_cmdset *get_subcommands(void) { return(commands); } virtual int work(class cl_app *app, class cl_cmdline *cmdline, class cl_console *con); }; diff --git a/sim/ucsim/cmd.src/get.cc b/sim/ucsim/cmd.src/get.cc index f070f02f..d16f892d 100644 --- a/sim/ucsim/cmd.src/get.cc +++ b/sim/ucsim/cmd.src/get.cc @@ -53,7 +53,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_get_sfr_cmd) { - class cl_mem *mem= uc->mem(MEM_SFR); + class cl_address_space *mem= uc->address_space(MEM_SFR_ID); class cl_cmd_arg *parm; int i; @@ -66,7 +66,8 @@ COMMAND_DO_WORK_UC(cl_get_sfr_cmd) parm; i++, parm= cmdline->param(i)) { - if (!parm->as_address(uc)) + if (!parm->as_address(uc) || + !mem->valid_address(parm->value.address)) con->dd_printf("Warning: Invalid address %s\n", (char*)cmdline->tokens->at(i+1)); else @@ -103,13 +104,22 @@ COMMAND_DO_WORK_APP(cl_get_option_cmd) { class cl_option *o= (class cl_option *)(/*uc*/app->options->at(i)); if ((!s || - !strcmp(s, o->get_name())) && - !o->hidden) + !strcmp(s, o->get_name()))) { - con->dd_printf("%2d. %s(by %s): ", i, object_name(o), - object_name(o->get_creator())); - o->print(con); - con->dd_printf(" - %s\n", o->help); + if (!o->hidden) + { + con->dd_printf("%2d. %s(by %s): ", i, object_name(o), + object_name(o->get_creator())); + o->print(con); + con->dd_printf(" - %s\n", o->help); + } + else + { + /* + con->dd_printf("%2d. %s(by %s) is hidden!\n", i, object_name(o), + object_name(o->get_creator())); + */ + } } } diff --git a/sim/ucsim/cmd.src/info.cc b/sim/ucsim/cmd.src/info.cc index 9e04cc79..ff6881c5 100644 --- a/sim/ucsim/cmd.src/info.cc +++ b/sim/ucsim/cmd.src/info.cc @@ -117,4 +117,94 @@ COMMAND_DO_WORK_UC(cl_info_hw_cmd) } +/* + * INFO STACK command + */ + +//int +//cl_info_stack_cmd::do_work(class cl_sim *sim, +// class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_info_stack_cmd) +{ + int i; + + cl_stack_op::info_head(con); + for (i= uc->stack_ops->count-1; i >= 0; i--) + { + class cl_stack_op *so= (class cl_stack_op *)(uc->stack_ops->at(i)); + so->info(con, uc); + } + return(DD_FALSE); +} + + +/* + * INFO MMEORY command + *---------------------------------------------------------------------------- + */ + +COMMAND_DO_WORK_UC(cl_info_memory_cmd) +{ + int i; + + con->dd_printf("Memory chips:\n"); + for (i= 0; i < uc->memchips->count; i++) + { + class cl_memory_chip *m= (class cl_memory_chip *)(uc->memchips->at(i)); + if (m) + con->dd_printf(" 0x%06x-0x%06x %8d %s (%d,%s,%s)\n", + m->get_start_address(), + m->highest_valid_address(), + m->get_size(), + m->get_name(), + m->width, m->data_format, m->addr_format); + } + con->dd_printf("Address spaces:\n"); + for (i= 0; i < uc->address_spaces->count; i++) + { + class cl_address_space *m= + (class cl_address_space *)(uc->address_spaces->at(i)); + if (m) + con->dd_printf(" 0x%06x-0x%06x %8d %s (%d,%s,%s)\n", + m->get_start_address(), + m->highest_valid_address(), + m->get_size(), + m->get_name(), + m->width, m->data_format, m->addr_format); + } + con->dd_printf("Address decoders:\n"); + for (i= 0; i < uc->address_spaces->count; i++) + { + class cl_address_space *m= + (class cl_address_space *)(uc->address_spaces->at(i)); + int j; + for (j= 0; j < m->decoders->count; j++) + { + class cl_address_decoder *d= + (class cl_address_decoder *)(m->decoders->at(j)); + con->dd_printf("%2d ", j); + if (d->address_space) + { + con->dd_printf("%s ", d->address_space->get_name("unknown")); + con->dd_printf(d->address_space->addr_format, d->as_begin); + con->dd_printf(" "); + con->dd_printf(d->address_space->addr_format, d->as_end); + } + else + con->dd_printf("x"); + con->dd_printf(" -> "); + if (d->memchip) + { + con->dd_printf("%s ", d->memchip->get_name("unknown")); + con->dd_printf(d->memchip->addr_format, d->chip_begin); + } + else + con->dd_printf("x"); + con->dd_printf(" %s\n", (d->activated)?"activated":"inactive"); + } + } + return(0); +} + + /* End of cmd.src/info.cc */ diff --git a/sim/ucsim/cmd.src/infocl.h b/sim/ucsim/cmd.src/infocl.h index ea460a0d..870d96ab 100644 --- a/sim/ucsim/cmd.src/infocl.h +++ b/sim/ucsim/cmd.src/infocl.h @@ -40,6 +40,12 @@ COMMAND_ON(uc,cl_info_reg_cmd); // INFO HW COMMAND_ON(uc,cl_info_hw_cmd); +// INFO STACK +COMMAND_ON(uc,cl_info_stack_cmd); + +// INFO MEMORY +COMMAND_ON(uc,cl_info_memory_cmd); + #endif diff --git a/sim/ucsim/cmd.src/newcmd.cc b/sim/ucsim/cmd.src/newcmd.cc index 762d6447..cf32c05c 100644 --- a/sim/ucsim/cmd.src/newcmd.cc +++ b/sim/ucsim/cmd.src/newcmd.cc @@ -45,6 +45,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "i_string.h" +#include "cmdlexcl.h" +#include "cmdpars.h" + // prj #include "globals.h" #include "utils.h" @@ -62,39 +65,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA extern "C" int vasprintf(char **strp, const char *format, va_list ap); extern "C" int vsnprintf(char *str, size_t size,const char *format,va_list ap); -static int -cmd_do_print(FILE *f, char *format, va_list ap) -{ - int ret; -#ifdef HAVE_VASPRINTF - char *msg= NULL; - vasprintf(&msg, format, ap); - ret= fprintf(f, "%s", msg); - free(msg); -#else -# ifdef HAVE_VSNPRINTF - char msg[80*25]; - vsnprintf(msg, 80*25, format, ap); - ret= fprintf(f, "%s", msg); -# else -# ifdef HAVE_VPRINTF - char msg[80*25]; - vsprintf(msg, format, ap); /* Dangerous */ - ret= fprintf(f, "%s", msg); -# else -# ifdef HAVE_DOPRNT - /* ??? */ - /*strcpy(msg, "Unimplemented printf has called.\n");*/ -# else - /*strcpy(msg, "printf can not be implemented, upgrade your libc.\n");*/ -# endif -# endif -# endif -#endif - fflush(f); - return(ret); -} - /* * Options of console @@ -169,7 +139,6 @@ cl_console::cl_console(char *fin, char *fout, class cl_app *the_app): { FILE *f; - last_command= NULL; app= the_app; in= 0; if (fin) @@ -186,17 +155,17 @@ cl_console::cl_console(char *fin, char *fout, class cl_app *the_app): flags|= CONS_INTERACTIVE; else ;//fprintf(stderr, "Warning: non-interactive console\n"); + rout= 0; id= 0; + lines_printed= new cl_ustrings(100, 100, "console_cache"); } cl_console::cl_console(FILE *fin, FILE *fout, class cl_app *the_app): cl_base() { - last_command= NULL; app= the_app; in = fin; out= fout; - rout=(FILE *)0; prompt= 0; flags= CONS_NONE; if (in && @@ -204,7 +173,9 @@ cl_console::cl_console(FILE *fin, FILE *fout, class cl_app *the_app): flags|= CONS_INTERACTIVE; else ;//fprintf(stderr, "Warning: non-interactive console\n"); + rout= 0; id= 0; + lines_printed= new cl_ustrings(100, 100, "console_cache"); } /* @@ -234,7 +205,6 @@ cl_console::cl_console(int portnumber, class cl_app *the_app) { int sock= connect_to_port(portnumber); - last_command= NULL; app= the_app; if (!(in= fdopen(sock, "r"))) fprintf(stderr, "cannot open port for input\n"); @@ -242,6 +212,7 @@ cl_console::cl_console(int portnumber, class cl_app *the_app) fprintf(stderr, "cannot open port for output\n"); //fprintf(stderr, "init socket done\n"); id= 0; + lines_printed= new cl_ustrings(1, 1, "console_cache"); } #endif @@ -250,12 +221,13 @@ cl_console::clone_for_exec(char *fin) { FILE *fi= 0, *fo= 0; - if (fin) - if (fi= fopen(fin, "r"), !fi) - { - fprintf(stderr, "Can't open `%s': %s\n", fin, strerror(errno)); - return(0); - } + if (!fin) + return(0); + if (fi= fopen(fin, "r"), !fi) + { + fprintf(stderr, "Can't open `%s': %s\n", fin, strerror(errno)); + return(0); + } if ((fo= fdopen(dup(fileno(out)), "a")) == 0) { fclose(fi); @@ -280,6 +252,8 @@ cl_console::init(void) welcome(); flags&= ~CONS_PROMPT; //print_prompt(); + last_command= 0; + last_cmdline= 0; return(0); } @@ -308,6 +282,17 @@ cl_console::~cl_console(void) } +bool +cl_console::accept_last(void) +{ + if (!in) + return(DD_FALSE); + if (isatty(fileno(in))) + return(DD_TRUE); + return(DD_FALSE); +} + + /* * Output functions */ @@ -345,7 +330,41 @@ cl_console::un_redirect(void) fclose(rout); rout= NULL; } - + + +int +cl_console::cmd_do_print(FILE *f, char *format, va_list ap) +{ + int ret; +#ifdef HAVE_VASPRINTF + char *msg= NULL; + vasprintf(&msg, format, ap); + ret= fprintf(f, "%s", msg); + free(msg); +#else +# ifdef HAVE_VSNPRINTF + char msg[80*25]; + vsnprintf(msg, 80*25, format, ap); + ret= fprintf(f, "%s", msg); +# else +# ifdef HAVE_VPRINTF + char msg[80*25]; + vsprintf(msg, format, ap); /* Dangerous */ + ret= fprintf(f, "%s", msg); +# else +# ifdef HAVE_DOPRNT + /* ??? */ + /*strcpy(msg, "Unimplemented printf has called.\n");*/ +# else + /*strcpy(msg, "printf can not be implemented, upgrade your libc.\n");*/ +# endif +# endif +# endif +#endif + fflush(f); + return(ret); +} + void cl_console::print_prompt(void) { @@ -384,6 +403,25 @@ cl_console::dd_printf(char *format, ...) return(ret); } +int +cl_console::debug(char *format, ...) +{ + if ((flags & CONS_DEBUG) == 0) + return(0); + + va_list ap; + int ret= 0; + FILE *Out= rout?rout:out; + + if (Out) + { + va_start(ap, format); + ret= cmd_do_print(Out, format, ap); + va_end(ap); + } + return(ret); +} + void cl_console::print_bin(long data, int bits) { @@ -511,18 +549,53 @@ cl_console::proc_input(class cl_cmdset *cmdset) retval= 1; else { - class cl_cmdline *cmdline; - class cl_cmd *cm; + class cl_cmdline *cmdline= 0; + class cl_cmd *cm= 0; if (flags & CONS_ECHO) dd_printf("%s\n", cmdstr); cmdline= new cl_cmdline(app, cmdstr, this); cmdline->init(); - cm= cmdset->get_cmd(cmdline); + if (cmdline->repeat() && + accept_last() && + last_command) + { + cm= last_command; + delete cmdline; + cmdline= last_cmdline; + } + else + { + cm= cmdset->get_cmd(cmdline, accept_last()); + if (last_cmdline) + { + delete last_cmdline; + last_cmdline= 0; + } + last_command= 0; + } if (cm) - retval= cm->work(app, cmdline, this); - delete cmdline; - if (!cm) - retval= interpret(cmdstr); + { + retval= cm->work(app, cmdline, this); + if (cm->can_repeat) + { + last_command= cm; + last_cmdline= cmdline; + } + else + delete cmdline; + } + else + { + class YY_cl_ucsim_parser_CLASS *pars; + class cl_ucsim_lexer *lexer; + lexer= new cl_ucsim_lexer(cmdstr); + pars= new YY_cl_ucsim_parser_CLASS(lexer); + pars->yyparse(); + delete cmdline; + delete pars; + } + /*if (!cm) + retval= interpret(cmdstr);*/ } } //retval= sim->do_cmd(cmd, this); @@ -577,7 +650,6 @@ cl_console::set_prompt(char *p) cl_listen_console::cl_listen_console(int serverport, class cl_app *the_app) { - last_command= NULL; app= the_app; if ((sock= make_server_socket(serverport)) >= 0) { @@ -676,7 +748,7 @@ cl_commander::cl_commander(class cl_app *the_app, class cl_cmdset *acmdset cl_base() { app= the_app; - cons= new cl_list(1, 1); + cons= new cl_list(1, 1, "consoles"); actual_console= frozen_console= 0; cmdset= acmdset; } @@ -685,34 +757,53 @@ int cl_commander::init(void) { class cl_optref console_on_option(this); + class cl_optref config_file_option(this); + class cl_optref port_number_option(this); + class cl_console *con; console_on_option.init(); console_on_option.use("console_on"); + config_file_option.init(); + config_file_option.use("config_file"); + port_number_option.init(); cl_base::init(); set_name("Commander"); - char *Config= app->args->get_sarg(0, "Config"); - if (Config) - { - class cl_console *con= mk_console(0/*"/dev/tty"*/); - add_console(con); - } + bool need_config= DD_TRUE; - //if (app->args->arg_avail('c')) - { - char *cn= console_on_option.get_value(cn); - if (cn) - add_console(mk_console(cn, cn)); - } #ifdef SOCKET_AVAIL - if (app->args->arg_avail('Z')) - add_console(mk_console(app->args->get_iarg(0, "Zport"))); - if (app->args->arg_avail('r')) - add_console(mk_console(app->args->get_iarg('r', 0))); + if (port_number_option.use("port_number")) + add_console(mk_console(port_number_option.get_value((long)0))); #endif + + char *Config= config_file_option.get_value(Config); + char *cn= console_on_option.get_value(cn); + + if (cn) + { + add_console(con= mk_console(cn, cn)); + exec_on(con, Config); + need_config= DD_FALSE; + } if (cons->get_count() == 0) - add_console(mk_console(stdin, stdout)); + { + add_console(con= mk_console(stdin, stdout)); + exec_on(con, Config); + need_config= DD_FALSE; + } + if (need_config) + { + FILE *fc= fopen(Config, "r"); + if (!fc) + fprintf(stderr, "Can't open `%s': %s\n", Config, strerror(errno)); + else + { + con= mk_console(fc, stderr); + con->flags|= CONS_NOWELCOME|CONS_ECHO; + add_console(con); + } + } return(0); } @@ -821,7 +912,7 @@ cl_commander::all_printf(char *format, ...) if (Out) { va_start(ap, format); - ret= cmd_do_print(Out, format, ap); + ret= c->cmd_do_print(Out, format, ap); va_end(ap); } } @@ -868,23 +959,65 @@ cl_commander::dd_printf(char *format, ...) va_list ap; int ret= 0; FILE *f; + class cl_console *con; if (actual_console) - f= actual_console->get_out(); + { + f= actual_console->get_out(); + con= actual_console; + } else if (frozen_console) - f= frozen_console->get_out(); + { + f= frozen_console->get_out(); + con= frozen_console; + } else - f= 0; + { + f= 0; + con= 0; + } if (/*actual_console && - actual_console->out*/f) + actual_console->out*/f && + con) { va_start(ap, format); - ret= cmd_do_print(f/*actual_console->out*/, format, ap); + ret= con->cmd_do_print(f/*actual_console->out*/, format, ap); va_end(ap); } return(ret); } +int +cl_commander::dd_printf(char *format, va_list ap) +{ + int ret= 0; + FILE *f; + class cl_console *con; + + if (actual_console) + { + f= actual_console->get_out(); + con= actual_console; + } + else if (frozen_console) + { + f= frozen_console->get_out(); + con= frozen_console; + } + else + { + f= 0; + con= 0; + } + if (/*actual_console && + actual_console->out*/f && + con) + { + ret= con->cmd_do_print(f/*actual_console->out*/, format, ap); + } + return(ret); +} + /* * Printing to consoles which have CONS_DEBUG flag set */ @@ -903,13 +1036,31 @@ cl_commander::debug(char *format, ...) c->flags & CONS_DEBUG) { va_start(ap, format); - ret= cmd_do_print(Out, format, ap); + ret= c->cmd_do_print(Out, format, ap); va_end(ap); } } return(ret); } +int +cl_commander::debug(char *format, va_list ap) +{ + int i, ret= 0; + + for (i= 0; i < cons->count; i++) + { + class cl_console *c= (class cl_console*)(cons->at(i)); + FILE *Out= c->get_out(); + if (Out && + c->flags & CONS_DEBUG) + { + ret= c->cmd_do_print(Out, format, ap); + } + } + return(ret); +} + int cl_commander::flag_printf(int iflags, char *format, ...) { @@ -924,7 +1075,7 @@ cl_commander::flag_printf(int iflags, char *format, ...) (c->flags & iflags) == iflags) { va_start(ap, format); - ret= cmd_do_print(Out, format, ap); + ret= c->cmd_do_print(Out, format, ap); va_end(ap); } } @@ -997,5 +1148,18 @@ cl_commander::proc_input(void) return(0); } +void +cl_commander::exec_on(class cl_console *cons, char *file_name) +{ + FILE *fi= fopen(file_name, "r"); + + if (!cons || + !fi) + return; + class cl_console *subcon= cons->clone_for_exec(file_name); + subcon->flags|= CONS_NOWELCOME; + add_console(subcon); +} + /* End of cmd.src/newcmd.cc */ diff --git a/sim/ucsim/cmd.src/newcmdcl.h b/sim/ucsim/cmd.src/newcmdcl.h index c0a604ab..6e3af3e4 100644 --- a/sim/ucsim/cmd.src/newcmdcl.h +++ b/sim/ucsim/cmd.src/newcmdcl.h @@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ddconfig.h" #include +#include #include #if FD_HEADER_OK # include HEADER_FD @@ -106,12 +107,14 @@ protected: class cl_prompt_option *prompt_option; class cl_optref *null_prompt_option; class cl_debug_option *debug_option; + class cl_ustrings *lines_printed; + class cl_cmd *last_command; + class cl_cmdline *last_cmdline; public: class cl_app *app; - char *last_command; int flags; // See CONS_XXXX char *prompt; - + public: cl_console(void): cl_base() { app= 0; in= out= 0; flags= 0; } cl_console(char *fin, char *fout, class cl_app *the_app); @@ -124,12 +127,16 @@ public: virtual class cl_console *cl_console::clone_for_exec(char *fin); virtual int init(void); + virtual bool accept_last(void); + virtual void welcome(void); virtual void redirect(char *fname, char *mode); virtual void un_redirect(void); virtual FILE *get_out(void) { return(rout?rout:out); } + int cmd_do_print(FILE *f, char *format, va_list ap); virtual void print_prompt(void); virtual int dd_printf(char *format, ...); + virtual int debug(char *format, ...); virtual void print_bin(long data, int bits); virtual void print_char_octal(char c); virtual int match(int fdnum); @@ -208,12 +215,15 @@ public: int all_printf(char *format, ...); // print to all consoles int all_print(char *string, int length); int dd_printf(char *format, ...); // print to actual_console + int dd_printf(char *format, va_list ap);// print to actual_console int debug(char *format, ...); // print consoles with debug flag set + int debug(char *format, va_list ap); // print consoles with debug flag set int flag_printf(int iflags, char *format, ...); int input_avail(void); int input_avail_on_frozen(void); int wait_input(void); int proc_input(void); + void exec_on(class cl_console *cons, char *file_name); }; diff --git a/sim/ucsim/cmd.src/set.cc b/sim/ucsim/cmd.src/set.cc index 2c1387eb..07d0134c 100644 --- a/sim/ucsim/cmd.src/set.cc +++ b/sim/ucsim/cmd.src/set.cc @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #include "ddconfig.h" @@ -30,6 +32,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "i_string.h" +// prj +#include "errorcl.h" + // sim #include "simcl.h" #include "optioncl.h" @@ -49,28 +54,31 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_set_mem_cmd) { - class cl_mem *mem= 0; + class cl_memory *mem= 0; class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), cmdline->param(2), cmdline->param(3) }; if (cmdline->syntax_match(uc, MEMORY ADDRESS DATALIST)) { - mem= params[0]->value.memory; + mem= params[0]->value.memory.memory; t_addr start= params[1]->value.address; t_mem *array= params[2]->value.data_list.array; int len= params[2]->value.data_list.len; if (len == 0) con->dd_printf("Error: no data\n"); + else if (start < mem->get_start_address()) + con->dd_printf("Start address less then 0x%"_A_"x\n", + mem->get_start_address()); else { int i; t_addr addr; for (i= 0, addr= start; - i < len && addr <= mem->size; + i < len && mem->valid_address(addr); i++, addr++) - mem->set(addr, array[i]); + mem->write(addr, array[i]); uc->check_errors(); mem->dump(start, start+len-1, 8, con); } @@ -92,7 +100,7 @@ COMMAND_DO_WORK_UC(cl_set_mem_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_set_bit_cmd) { - class cl_mem *mem; + class cl_memory *mem; t_addr mem_addr= 0; t_mem bit_mask= 0; class cl_cmd_arg *params[4]= { cmdline->param(0), @@ -130,7 +138,7 @@ COMMAND_DO_WORK_UC(cl_set_hw_cmd) cmdline->param(2), cmdline->param(3)*/ }; - if (/*cmdline->syntax_match(uc, HW)*/params[0]->as_hw(uc)) { + if (params[0] && /*cmdline->syntax_match(uc, HW)*/params[0]->as_hw(uc)) { hw= params[0]->value.hw; //pn= hw->id; //l= params[1]->value.number; @@ -177,7 +185,12 @@ COMMAND_DO_WORK_APP(cl_set_option_cmd) cmdline->param(3) }; class cl_option *option= 0; - if (cmdline->syntax_match(0, STRING STRING STRING)) { + if (cmdline->syntax_match(0/*app->get_uc()*/, NUMBER STRING)) { + idx= params[0]->value.number; + s= params[1]->value.string.string; + option= app->options->get_option(idx); + } + else if (cmdline->syntax_match(0, STRING STRING STRING)) { id= params[0]->value.string.string; char *cr= params[1]->value.string.string; s= params[2]->value.string.string; @@ -195,11 +208,6 @@ COMMAND_DO_WORK_APP(cl_set_option_cmd) option= app->options->get_option(cr, id); } } - else if (cmdline->syntax_match(0/*app->get_uc()*/, NUMBER STRING)) { - idx= params[0]->value.number; - s= params[1]->value.string.string; - option= app->options->get_option(idx); - } else if (cmdline->syntax_match(0/*app->get_uc()*/, STRING STRING)) { id= params[0]->value.string.string; s= params[1]->value.string.string; @@ -224,7 +232,63 @@ COMMAND_DO_WORK_APP(cl_set_option_cmd) option->set_value(s); - return(DD_FALSE);; + return(DD_FALSE); +} + + +/* + * Command: set error + *---------------------------------------------------------------------------- + */ + +//int +//cl_set_option_cmd::do_work(class cl_sim *sim, +// class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_APP(cl_set_error_cmd) +{ + class cl_cmd_arg *params[4]= { cmdline->param(0), + cmdline->param(1), + cmdline->param(2), + cmdline->param(3) }; + char *error_name= NIL, *value= NIL; + + if (cmdline->syntax_match(0/*app->get_uc()*/, STRING STRING)) { + error_name= params[0]->value.string.string; + value= params[1]->value.string.string; + } + else + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + + if (error_name && + value && + registered_errors) + { + int i; + for (i= 0; i < registered_errors->count; i++) + { + class cl_error_class *e= + dynamic_cast(registered_errors->object_at(i)); + if (e->is_inamed(error_name)) + { + if (strchr("uU-?", *value) != NULL) + e->set_on(ERROR_PARENT); + else if (strchr("1tTyY", *value) != NULL || + (strlen(value) > 1 && + strchr("nN", value[2]) != NULL)) + e->set_on(ERROR_ON); + else if (strchr("0fFnN", *value) != NULL || + (strlen(value) > 1 && + strchr("fF", value[2]) != NULL)) + e->set_on(ERROR_OFF); + else + con->dd_printf("Bad value (%s)\n", value); + return(DD_FALSE); + } + } + } + con->dd_printf("Error %s not found\n", error_name); + + return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/setcl.h b/sim/ucsim/cmd.src/setcl.h index 066b3d30..8f9481c2 100644 --- a/sim/ucsim/cmd.src/setcl.h +++ b/sim/ucsim/cmd.src/setcl.h @@ -43,6 +43,9 @@ COMMAND_ON(uc,cl_set_hw_cmd); // SET OPTION COMMAND_ON(app,cl_set_option_cmd); +// SET ERROR +COMMAND_ON(app,cl_set_error_cmd); + #endif diff --git a/sim/ucsim/cmd.src/show.cc b/sim/ucsim/cmd.src/show.cc index 9833d2b8..8f6fee13 100644 --- a/sim/ucsim/cmd.src/show.cc +++ b/sim/ucsim/cmd.src/show.cc @@ -26,11 +26,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /*@1@*/ #include "ddconfig.h" + +#include #include "i_string.h" // prj #include "globals.h" #include "utils.h" +#include "errorcl.h" // sim #include "simcl.h" @@ -93,20 +96,22 @@ COMMAND_DO_WORK_APP(cl_show_option_cmd) if (!s || !strcmp(s, o->get_name())) { + int j; con->dd_printf("%d. %s: ", i, object_name(o)); o->print(con); con->dd_printf(" - %s\n", o->help); - union option_value *val= o->get_value(); + con->dd_printf(" Type: %s\n", o->get_type_name()); + /*union option_value *val= o->get_value(); con->dd_printf(" Value: \""); unsigned int uj; - int j; TYPE_UBYTE *d= (TYPE_UBYTE*)val; for (uj= 0; uj < sizeof(*val); uj++) - con->print_char_octal(d[uj]); - con->dd_printf("\"\n Creator: \"%s\"\n %d Users:\n", + con->print_char_octal(d[uj]); + con->dd_printf("\"\n");*/ + con->dd_printf(" Hidden: %s\n", (o->hidden)?"True":"False"); + con->dd_printf(" Creator: \"%s\"\n %d Users:\n", object_name(o->get_creator()), o->users->count); - con->dd_printf(" Hidden: %s\n", (o->hidden)?"True":"False"); for (j= 0; j < o->users->count; j++) { class cl_optref *r= (class cl_optref *)(o->users->at(j)); @@ -119,7 +124,65 @@ COMMAND_DO_WORK_APP(cl_show_option_cmd) } } - return(DD_FALSE);; + return(DD_FALSE); +} + + +// prj +#include "errorcl.h" + +static void +show_error_cmd_print_node(class cl_console *con, + int indent, class cl_base *node) +{ + if (!node) + return; + int i; + for (i= 0; i < indent; i++) + con->dd_printf(" "); + char *name= node->get_name("unknown"); + class cl_error_class *ec= dynamic_cast(node); + char *str; + con->dd_printf("%s: %s [%s/%s]\n", + str= case_string(case_case, ec->get_type_name()), + name, get_id_string(error_on_off_names, + ec->get_on()), + (ec->is_on())?"ON":"OFF"); + free(str); + class cl_base *c= node->first_child(); + while (c) + { + show_error_cmd_print_node(con, indent+2, c); + c= node->next_child(c); + } +} + +/* + * Command: show error + *---------------------------------------------------------------------------- + */ +COMMAND_DO_WORK_APP(cl_show_error_cmd) +{ + /*class cl_cmd_arg *parm= cmdline->param(0); + char *s= 0; + + if (!parm) + ; + else if (cmdline->syntax_match(0, STRING)) { + s= parm->value.string.string; + } + else + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + */ + int i; + for (i= 0; i < registered_errors->count; i++) + { + class cl_error_class *ec; + ec= dynamic_cast(registered_errors->object_at(i)); + if (!ec->get_parent()) + show_error_cmd_print_node(con, 0, ec); + } + return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/showcl.h b/sim/ucsim/cmd.src/showcl.h index 72498b78..f7eab7dd 100644 --- a/sim/ucsim/cmd.src/showcl.h +++ b/sim/ucsim/cmd.src/showcl.h @@ -40,6 +40,9 @@ COMMAND(cl_show_warranty_cmd); // SHOW OPTION COMMAND_ON(app,cl_show_option_cmd); +// SHOW ERROR +COMMAND_ON(app,cl_show_error_cmd); + #endif diff --git a/sim/ucsim/cmd.src/timer.cc b/sim/ucsim/cmd.src/timer.cc index e7293191..e029c49b 100644 --- a/sim/ucsim/cmd.src/timer.cc +++ b/sim/ucsim/cmd.src/timer.cc @@ -47,224 +47,224 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_timer_cmd) { - char *s; - - if (cmdline->param(0) == 0) + class cl_cmd_arg *params[4]= { cmdline->param(0), + cmdline->param(1), + cmdline->param(2), + cmdline->param(3) }; + + if (!params[0]) { - if (long_help) - con->dd_printf("%s\n", long_help); - else - con->dd_printf("What to do?\n"); - return(0); + con->dd_printf("Timer id is missing."); + return(DD_FALSE); } - if ((s= cmdline->param(0)->get_svalue())) + if (params[0]->as_number()) { - if (cmdline->param(1) == 0) + as_nr= DD_TRUE; + id_nr= params[0]->value.number; + if (id_nr <= 0) { - con->dd_printf("Timer number is missing\n"); - return(0); + con->dd_printf("Error: " + "Timer id must be greater than zero or a string\n"); + return(DD_TRUE); } - set_ticker(uc, cmdline->param(1)); - if (strstr(s, "c") == s || - strstr(s, "m") == s || - strstr(s, "a") == s) - return(add(uc, cmdline, con)); - else if (strstr(s, "d") == s) - return(del(uc, cmdline, con)); - else if (strstr(s, "g") == s) - return(get(uc, cmdline, con)); - else if (strstr(s, "r") == s) - return(run(uc, cmdline, con)); - else if (strstr(s, "s") == s) - return(stop(uc, cmdline, con)); - else if (strstr(s, "v") == s) - return(val(uc, cmdline, con)); - else - con->dd_printf("Undefined timer command: \"%s\". Try \"help timer\"\n", - s); + ticker= uc->get_counter(id_nr); } - return(0); -} - -void -cl_timer_cmd::set_ticker(class cl_uc *uc, - class cl_cmd_arg *param) -{ - if (set_name(param->get_svalue())) - ticker= uc->get_counter(get_name()); else - if (param->get_ivalue(&what)) - ticker= uc->get_counter(what); + { + as_nr= DD_FALSE; + id_str= params[0]->s_value; + ticker= uc->get_counter(id_str); + } + cmdline->shift(); + return(DD_FALSE); } + /* + * Command: timer add + *----------------------------------------------------------------------------- * Add a new timer to the list */ -int -cl_timer_cmd::add(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_add_cmd) + //add(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), cmdline->param(2), cmdline->param(3) }; long dir= +1, in_isr= 0; - - if (!get_name() && - what < 1) + + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); + if (ticker) { - con->dd_printf("Error: Timer id must be greater then zero or a string\n"); + if (!as_nr) + con->dd_printf("Error: Timer \"%s\" already exists\n", id_str); + else + con->dd_printf("Error: Timer %d already exists\n", id_nr); return(DD_FALSE); } - if (ticker) + + if (cmdline->nuof_params() > 0) { - if (get_name()) - con->dd_printf("Error: Timer \"%s\" already exists\n", get_name()); - else - con->dd_printf("Error: Timer %d already exists\n", what); - return(0); + if (cmdline->syntax_match(uc, NUMBER)) + dir= params[0]->value.number; + else if (cmdline->syntax_match(uc, NUMBER NUMBER)) + { + dir= params[0]->value.number; + in_isr= params[1]->value.number; + } } - if (params[2]) - if (!params[2]->get_ivalue(&dir)) - { - con->dd_printf("Error: Wrong direction\n"); - return(DD_FALSE); - } - if (params[3]) - if (!params[3]->get_ivalue(&in_isr)) - { - con->dd_printf("Error: Wrong parameter\n"); - return(DD_FALSE); - } - if (get_name()) + if (!as_nr) { - ticker= new cl_ticker(dir, in_isr, get_name()); - uc->add_counter(ticker, get_name()); + ticker= new cl_ticker(dir, in_isr, id_str); + uc->add_counter(ticker, id_str); } else { ticker= new cl_ticker(dir, in_isr, 0); - uc->add_counter(ticker, what); + uc->add_counter(ticker, id_nr); } return(DD_FALSE); } /* + * Command: timer delete + *----------------------------------------------------------------------------- * Delete a timer from the list */ -int -cl_timer_cmd::del(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_delete_cmd) + //del(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); if (!ticker) { - if (get_name()) - con->dd_printf("Timer \"%s\" does not exist\n", get_name()); + if (!as_nr) + con->dd_printf("Timer \"%s\" does not exist\n", id_str); else - con->dd_printf("Timer %d does not exist\n", what); - return(0); + con->dd_printf("Timer %d does not exist\n", id_nr); + return(DD_FALSE); } - if (get_name()) - uc->del_counter(get_name()); + if (!as_nr) + uc->del_counter(id_str); else - uc->del_counter(what); + uc->del_counter(id_nr); - return(0); + return(DD_FALSE); } /* + * Command: timer get + *----------------------------------------------------------------------------- * Get the value of just one timer or all of them */ -int -cl_timer_cmd::get(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_get_cmd) + //get(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { + if (cmdline->nuof_params()) + { + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); + } + else + ticker= 0; if (ticker) - ticker->dump(what, uc->xtal, con); + ticker->dump(id_nr, uc->xtal, con); else { uc->ticks->dump(0, uc->xtal, con); uc->isr_ticks->dump(0, uc->xtal, con); uc->idle_ticks->dump(0, uc->xtal, con); - for (what= 0; what < uc->counters->count; what++) + for (id_nr= 0; id_nr < uc->counters->count; id_nr++) { - ticker= uc->get_counter(what); + ticker= uc->get_counter(id_nr); if (ticker) - ticker->dump(what, uc->xtal, con); + ticker->dump(id_nr, uc->xtal, con); } } - return(0); + return(DD_FALSE); } /* + * Command: timer run + *----------------------------------------------------------------------------- * Allow a timer to run */ -int -cl_timer_cmd::run(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_run_cmd) + //run(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); if (!ticker) { - if (get_name()) - con->dd_printf("Timer %d does not exist\n", get_name()); + if (!as_nr) + con->dd_printf("Timer %d does not exist\n", id_str); else - con->dd_printf("Timer %d does not exist\n", what); + con->dd_printf("Timer %d does not exist\n", id_nr); return(0); } ticker->options|= TICK_RUN; - return(0); + return(DD_FALSE); } /* + * Command: timer stop + *----------------------------------------------------------------------------- * Stop a timer */ -int -cl_timer_cmd::stop(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_stop_cmd) + //stop(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); + if (!ticker) { - if (get_name()) - con->dd_printf("Timer %d does not exist\n", get_name()); + if (!as_nr) + con->dd_printf("Timer %d does not exist\n", id_str); else - con->dd_printf("Timer %d does not exist\n", what); - return(0); + con->dd_printf("Timer %d does not exist\n", id_nr); + return(DD_FALSE); } ticker->options&= ~TICK_RUN; - return(0); + return(DD_FALSE); } /* + * Command: timer value + *----------------------------------------------------------------------------- * Set a timer to a specified value */ -int -cl_timer_cmd::val(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con) +COMMAND_DO_WORK_UC(cl_timer_value_cmd) + //val(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { class cl_cmd_arg *params[4]= { cmdline->param(0), cmdline->param(1), cmdline->param(2), cmdline->param(3) }; + if (cl_timer_cmd::do_work(uc, cmdline, con)) + return(DD_FALSE); if (!ticker) { - if (get_name()) - con->dd_printf("Error: Timer %d does not exist\n", get_name()); + if (!as_nr) + con->dd_printf("Error: Timer %d does not exist\n", id_str); else - con->dd_printf("Error: Timer %d does not exist\n", what); - return(0); + con->dd_printf("Error: Timer %d does not exist\n", id_nr); + return(DD_FALSE); } if (params[2]) { diff --git a/sim/ucsim/cmd.src/timercl.h b/sim/ucsim/cmd.src/timercl.h index 128b66ed..75479085 100644 --- a/sim/ucsim/cmd.src/timercl.h +++ b/sim/ucsim/cmd.src/timercl.h @@ -31,29 +31,27 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "newcmdcl.h" + COMMAND_HEAD(cl_timer_cmd) public: class cl_ticker *ticker; - long what; -//char *name; + bool as_nr; + int id_nr; + char *id_str; COMMAND_METHODS_ON(uc,cl_timer_cmd) void set_ticker(class cl_uc *uc, class cl_cmd_arg *param); - virtual int add(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); - virtual int del(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); - virtual int get(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); - virtual int run(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); - virtual int stop(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); - virtual int val(class cl_uc *uc, - class cl_cmdline *cmdline, class cl_console *con); COMMAND_TAIL; +COMMAND_ANCESTOR_ON(uc,cl_timer_add_cmd,cl_timer_cmd); +COMMAND_ANCESTOR_ON(uc,cl_timer_delete_cmd,cl_timer_cmd); +COMMAND_ANCESTOR_ON(uc,cl_timer_get_cmd,cl_timer_cmd); +COMMAND_ANCESTOR_ON(uc,cl_timer_run_cmd,cl_timer_cmd); +COMMAND_ANCESTOR_ON(uc,cl_timer_stop_cmd,cl_timer_cmd); +COMMAND_ANCESTOR_ON(uc,cl_timer_value_cmd,cl_timer_cmd); + + #endif /* End of cmd.src/timercl.h */ diff --git a/sim/ucsim/conf b/sim/ucsim/conf index c3e4fcf4..c5a4eb13 100755 --- a/sim/ucsim/conf +++ b/sim/ucsim/conf @@ -35,6 +35,9 @@ case $TARGET in --enable-xa \ "$@" ;; + *) + echo >&2 "Do not know how to configure!" + ;; esac # End of conf diff --git a/sim/ucsim/configure b/sim/ucsim/configure index 865f6db9..721ac730 100755 --- a/sim/ucsim/configure +++ b/sim/ucsim/configure @@ -1,9 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. +# Generated by GNU Autoconf 2.59. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -20,9 +19,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -41,7 +41,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -218,16 +218,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -467,7 +468,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK VERSION VERSIONHI VERSIONLO VERSIONP enable_ucsim enable_dlso enable_51 enable_avr enable_z80 enable_hc08 enable_xa enable_serio CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CXXCPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB STRIP build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS ac_ct_CC LN_S ECHO ac_ct_STRIP CPP EGREP LIBTOOL LIBTOOL_DEPS dl_ok DL panel_ok curses_ok CURSES_LIBS M_OR_MM SHAREDLIB PICOPT dlso_ok docdir LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS AWK VERSION VERSIONHI VERSIONLO VERSIONP docdir enable_ucsim enable_dlso enable_51 enable_avr enable_z80 enable_hc08 enable_xa enable_serio CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CXXCPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB STRIP build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS ac_ct_CC LN_S ECHO ac_ct_STRIP CPP EGREP LIBTOOL LIBTOOL_DEPS LEX LEXLIB LEX_OUTPUT_ROOT YACC BISON_PLUS_PLUS dl_ok DL panel_ok curses_ok CURSES_LIBS M_OR_MM SHAREDLIB PICOPT dlso_ok LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -826,7 +827,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -866,10 +867,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -908,6 +909,10 @@ ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias +ac_env_docdir_set=${docdir+set} +ac_env_docdir_value=$docdir +ac_cv_env_docdir_set=${docdir+set} +ac_cv_env_docdir_value=$docdir ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} @@ -940,10 +945,6 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP -ac_env_docdir_set=${docdir+set} -ac_env_docdir_value=$docdir -ac_cv_env_docdir_set=${docdir+set} -ac_cv_env_docdir_value=$docdir # # Report the --help message. @@ -977,9 +978,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1023,7 +1024,7 @@ Optional Features: --disable-51 do not compile simulator for MCS51 --disable-avr do not compile simulator for AVR --enable-z80 compile simulator for Z80 - --enable-hc08 compile simulator for hc08 + --enable-hc08 compile simulator for hc08 --enable-xa compile simulator for XA --enable-serio compile serio GUI tool (needs curses) --enable-statistic compile statistical features (slower simulation) @@ -1039,6 +1040,7 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects default=use both Some influential environment variables: + docdir documentation installation directory CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -1049,7 +1051,6 @@ Some influential environment variables: CC C compiler command CFLAGS C compiler flags CPP C preprocessor - docdir documentation installation directory Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1087,12 +1088,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -1103,13 +1137,13 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd $ac_popdir + cd "$ac_popdir" done fi @@ -1117,8 +1151,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1130,7 +1163,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1207,19 +1240,19 @@ do 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1253,12 +1286,12 @@ _ASBOX case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1287,7 +1320,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1306,7 +1339,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1386,7 +1419,7 @@ fi # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1403,13 +1436,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1538,6 +1571,13 @@ _ACEOF # Some options #============== +# *nix default: "${datadir}/sdcc/doc" + +if test "${docdir}" = ""; then + docdir="\${datadir}"/sdcc/doc +fi + + # Check whether --enable-ucsim or --disable-ucsim was given. if test "${enable_ucsim+set}" = set; then enableval="$enable_ucsim" @@ -1751,7 +1791,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1771,8 +1810,8 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C++ compiler default output" >&5 -echo $ECHO_N "checking for C++ compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 +echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1792,23 +1831,23 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1882,8 +1921,8 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1908,7 +1947,6 @@ if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1959,7 +1997,6 @@ if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1979,11 +2016,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1996,7 +2042,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi @@ -2012,7 +2058,6 @@ if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2029,11 +2074,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2046,7 +2100,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 @@ -2066,8 +2120,7 @@ else fi fi for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2075,14 +2128,13 @@ for ac_declaration in \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2093,11 +2145,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2110,9 +2171,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2129,11 +2189,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2145,7 +2214,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2184,7 +2253,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2195,7 +2263,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2207,6 +2275,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -2227,7 +2296,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2245,6 +2313,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -2291,7 +2360,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2302,7 +2370,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2314,6 +2382,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -2334,7 +2403,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2352,6 +2420,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -2426,6 +2495,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -2442,6 +2512,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2449,20 +2520,20 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done done ;; @@ -3072,7 +3143,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3092,11 +3162,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3109,7 +3188,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -3125,7 +3204,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3142,11 +3220,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3159,7 +3246,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -3186,7 +3273,6 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3214,6 +3300,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -3240,11 +3336,20 @@ do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3257,7 +3362,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -3285,19 +3390,27 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -3305,14 +3418,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -3323,11 +3435,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3340,9 +3461,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3359,11 +3479,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3375,7 +3504,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -3389,7 +3518,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3982,7 +4111,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3993,7 +4121,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -4005,6 +4133,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4025,7 +4154,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4043,6 +4171,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4089,7 +4218,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4100,7 +4228,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -4112,6 +4240,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4132,7 +4261,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4150,6 +4278,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4210,7 +4339,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4231,11 +4359,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4248,12 +4385,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4275,7 +4411,6 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4300,7 +4435,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4312,9 +4446,9 @@ cat >>conftest.$ac_ext <<_ACEOF # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -4325,7 +4459,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -4350,7 +4484,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -4375,7 +4509,7 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -4384,7 +4518,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4396,11 +4529,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4413,7 +4555,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -4444,7 +4586,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4455,11 +4596,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4472,7 +4622,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -4480,7 +4630,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4498,6 +4647,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4517,33 +4667,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -4554,7 +4703,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -4888,7 +5037,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4891 "configure"' > conftest.$ac_ext + echo '#line 5040 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4927,7 +5076,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4944,11 +5092,20 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4961,7 +5118,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5266,7 +5424,6 @@ else save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5283,11 +5440,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5316,7 +5482,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_prog_cc_pic_works=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" fi @@ -5358,7 +5524,6 @@ else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5375,11 +5540,20 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5391,7 +5565,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi @@ -5435,7 +5610,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:5438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:5613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -5476,7 +5651,6 @@ else save_objext="$ac_objext" ac_objext=lo cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5493,11 +5667,20 @@ int some_variable = 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5516,7 +5699,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_objext="$save_objext" CFLAGS="$save_CFLAGS" @@ -5569,7 +5752,6 @@ echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" compiler_rtti_exceptions=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5586,11 +5768,20 @@ int some_variable = 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5609,7 +5800,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 echo "${ECHO_T}$compiler_rtti_exceptions" >&6 @@ -6861,21 +7052,28 @@ if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef shl_load + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -6906,11 +7104,20 @@ return f != shl_load; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6923,7 +7130,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 @@ -6938,7 +7146,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -6962,11 +7169,20 @@ shl_load (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6979,7 +7195,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 @@ -6993,21 +7210,28 @@ if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef dlopen + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -7038,11 +7262,20 @@ return f != dlopen; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7055,7 +7288,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 @@ -7070,7 +7304,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7094,11 +7327,20 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7111,7 +7353,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -7127,7 +7370,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7151,11 +7393,20 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7168,7 +7419,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 @@ -7184,7 +7436,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7208,11 +7459,20 @@ dld_link (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7225,7 +7485,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 @@ -7280,7 +7541,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + echo "$as_me:$LINENO: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test -z "$LEXLIB" +then + echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 +echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 +if test "${ac_cv_lib_fl_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fl_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fl_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 +if test $ac_cv_lib_fl_yywrap = yes; then + LEXLIB="-lfl" +else + echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 +echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 +if test "${ac_cv_lib_l_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_l_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_l_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 +if test $ac_cv_lib_l_yywrap = yes; then + LEXLIB="-ll" +fi + +fi + +fi + +if test "x$LEX" != "x:"; then + echo "$as_me:$LINENO: checking lex output file root" >&5 +echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_root+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +cat >conftest.l <<_ACEOF +%% +%% +_ACEOF +{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 + (eval $LEX conftest.l) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 +rm -f conftest.l +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS=$LIBS +LIBS="$LIBS $LEXLIB" +cat >conftest.$ac_ext <<_ACEOF +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_lex_yytext_pointer=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYTEXT_POINTER 1 +_ACEOF + +fi + +fi +if test ${LEX} = "flex"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_FLEX 1 +_ACEOF + +fi +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + echo "$as_me:$LINENO: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +# Extract the first word of "bison++", so it can be a program name with args. +set dummy bison++; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_BISON_PLUS_PLUS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$BISON_PLUS_PLUS"; then + ac_cv_prog_BISON_PLUS_PLUS="$BISON_PLUS_PLUS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_BISON_PLUS_PLUS="bison++" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_BISON_PLUS_PLUS" && ac_cv_prog_BISON_PLUS_PLUS=":" +fi +fi +BISON_PLUS_PLUS=$ac_cv_prog_BISON_PLUS_PLUS +if test -n "$BISON_PLUS_PLUS"; then + echo "$as_me:$LINENO: result: $BISON_PLUS_PLUS" >&5 +echo "${ECHO_T}$BISON_PLUS_PLUS" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu @@ -8134,7 +8751,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8155,11 +8771,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8172,12 +8797,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8199,7 +8823,6 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8224,7 +8847,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8236,9 +8858,9 @@ cat >>conftest.$ac_ext <<_ACEOF # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -8249,7 +8871,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -8274,7 +8896,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -8305,7 +8927,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8316,11 +8937,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8333,7 +8963,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8341,7 +8971,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8359,6 +8988,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -8378,33 +9008,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8415,7 +9044,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8447,7 +9076,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8458,11 +9086,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8475,7 +9112,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8483,7 +9120,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8501,6 +9137,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -8520,33 +9157,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8557,7 +9193,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8585,7 +9221,6 @@ else echo "$as_me:$LINENO: checking sys/socket.h usability" >&5 echo $ECHO_N "checking sys/socket.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8596,11 +9231,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8613,7 +9257,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8621,7 +9265,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking sys/socket.h presence" >&5 echo $ECHO_N "checking sys/socket.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8639,6 +9282,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -8658,33 +9302,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: sys/socket.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: sys/socket.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socket.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/socket.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: sys/socket.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/socket.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: sys/socket.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: sys/socket.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/socket.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/socket.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/socket.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/socket.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/socket.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/socket.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/socket.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/socket.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: sys/socket.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: sys/socket.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/socket.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/socket.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8711,7 +9354,6 @@ _ACEOF _ACEOF cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8751,7 +9393,6 @@ else echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8762,11 +9403,20 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8779,7 +9429,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8787,7 +9437,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8805,6 +9454,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -8824,33 +9474,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8883,7 +9532,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8903,11 +9551,20 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8920,7 +9577,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8943,7 +9600,6 @@ else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8967,11 +9623,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8983,12 +9648,12 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in dir; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9012,11 +9677,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9029,7 +9703,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS @@ -9050,7 +9725,6 @@ else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9074,11 +9748,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9090,12 +9773,12 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in x; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9119,11 +9802,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9136,7 +9828,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS @@ -9160,7 +9853,6 @@ if test "${ucsim_cv_fd+set}" = set; then else ucsim_cv_fd="unknown" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9179,7 +9871,6 @@ fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9198,7 +9889,6 @@ fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9287,7 +9977,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9311,11 +10000,20 @@ socket (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9328,7 +10026,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 @@ -9351,7 +10050,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9375,11 +10073,20 @@ xdr_short (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9392,7 +10099,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_xdr_short=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_xdr_short" >&5 @@ -9414,7 +10122,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9438,11 +10145,20 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9455,7 +10171,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -9478,7 +10195,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lpanel -lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9502,11 +10218,20 @@ panel_above (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9519,7 +10244,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_panel_panel_above=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_panel_panel_above" >&5 @@ -9539,7 +10265,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9563,11 +10288,20 @@ nl (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9580,7 +10314,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_nl=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_curses_nl" >&5 @@ -9610,21 +10345,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9655,11 +10397,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9672,7 +10423,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -9687,21 +10439,28 @@ if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef _doprnt + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9732,11 +10491,20 @@ return f != _doprnt; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9749,7 +10517,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 @@ -9766,8 +10535,108 @@ done +for ac_func in vsnprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + -for ac_func in vsnprintf vasprintf +for ac_func in vasprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -9776,21 +10645,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9821,11 +10697,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9838,7 +10723,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -9867,21 +10753,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9912,11 +10805,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9929,7 +10831,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -9952,21 +10855,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9997,11 +10907,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10014,7 +10933,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10036,21 +10956,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -10081,11 +11008,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10098,7 +11034,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10120,21 +11057,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -10165,11 +11109,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10182,7 +11135,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10205,7 +11159,6 @@ if test "$cross_compiling" = yes; then ucsim_cv_scanf_a="unknown" else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10249,7 +11202,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ucsim_cv_scanf_a="no" fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -10271,7 +11224,6 @@ else ucsim_cv_getcwd="unknown" else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10306,7 +11258,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ucsim_cv_getcwd="no" fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi @@ -10332,7 +11284,6 @@ else for ac_val in int size_t socklen_t; do CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10350,11 +11301,20 @@ struct sockaddr a; $ac_val len; accept (0, &a, &len); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10366,7 +11326,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS="$ac_save_CPPFLAGS" fi @@ -10415,7 +11375,6 @@ if test "${ac_cv_c_bigendian+set}" = set; then else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10437,11 +11396,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10449,7 +11417,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10471,11 +11438,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10488,7 +11464,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -10498,7 +11474,6 @@ if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10520,11 +11495,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10546,10 +11530,9 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10588,10 +11571,10 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 @@ -10666,11 +11649,14 @@ echo "$as_me:$LINENO: result: $ucsim_cv_CXXggdb" >&5 echo "${ECHO_T}$ucsim_cv_CXXggdb" >&6 if test "$ucsim_cv_CXXggdb" = "yes"; then - if test "$CXXFLAGS"x = x ;then - CXXFLAGS="-ggdb" - else - CXXFLAGS="$CXXFLAGS -ggdb" - fi + gopt="-ggdb" +else + gopt="-g" +fi +if test "$CXXFLAGS"x = x ;then + CXXFLAGS="$gopt" +else + CXXFLAGS="$CXXFLAGS $gopt" fi @@ -10778,7 +11764,6 @@ if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10805,11 +11790,20 @@ int i; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10822,7 +11816,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 @@ -10839,7 +11833,6 @@ if test "${ac_cv_type_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10859,11 +11852,20 @@ if (sizeof (char)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10876,7 +11878,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_char=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 echo "${ECHO_T}$ac_cv_type_char" >&6 @@ -10894,7 +11896,6 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10913,11 +11914,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10926,7 +11936,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10945,11 +11954,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10961,20 +11979,19 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10993,11 +12010,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11006,7 +12032,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11025,11 +12050,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11041,13 +12075,13 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 @@ -11055,14 +12089,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11081,11 +12114,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11098,7 +12140,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_char=$ac_lo;; @@ -11110,14 +12152,11 @@ See \`config.log' for more details." >&2;} esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 +echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11179,7 +12218,7 @@ echo "$as_me: error: cannot compute sizeof (char), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -11200,7 +12239,6 @@ if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11220,11 +12258,20 @@ if (sizeof (short)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11237,7 +12284,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6 @@ -11255,7 +12302,6 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11274,11 +12320,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11287,7 +12342,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11306,11 +12360,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11322,20 +12385,19 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11354,11 +12416,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11367,7 +12438,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11386,11 +12456,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11402,13 +12481,13 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 @@ -11416,14 +12495,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11442,11 +12520,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11459,7 +12546,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; @@ -11471,14 +12558,11 @@ See \`config.log' for more details." >&2;} esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 +echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11540,7 +12624,7 @@ echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -11561,7 +12645,6 @@ if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11581,11 +12664,20 @@ if (sizeof (int)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11598,7 +12690,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 @@ -11616,7 +12708,6 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11635,11 +12726,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11648,7 +12748,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11667,11 +12766,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11683,20 +12791,19 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11715,11 +12822,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11728,7 +12844,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11747,11 +12862,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11763,13 +12887,13 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 @@ -11777,14 +12901,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11803,11 +12926,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11820,7 +12952,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; @@ -11832,14 +12964,11 @@ See \`config.log' for more details." >&2;} esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 +echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11901,7 +13030,7 @@ echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -11922,7 +13051,6 @@ if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11942,11 +13070,20 @@ if (sizeof (long)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11959,7 +13096,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 @@ -11977,7 +13114,6 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11996,11 +13132,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12009,7 +13154,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12028,11 +13172,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12044,20 +13197,19 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12076,11 +13228,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12089,7 +13250,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12108,11 +13268,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12124,13 +13293,13 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 @@ -12138,14 +13307,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12164,11 +13332,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12181,7 +13358,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; @@ -12193,14 +13370,11 @@ See \`config.log' for more details." >&2;} esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 +echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12262,7 +13436,7 @@ echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -12283,7 +13457,6 @@ if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12303,11 +13476,20 @@ if (sizeof (long long)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12320,7 +13502,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 @@ -12338,7 +13520,6 @@ else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12357,11 +13538,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12370,7 +13560,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12389,11 +13578,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12405,20 +13603,19 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12437,11 +13634,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12450,7 +13656,6 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12469,11 +13674,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12485,13 +13699,13 @@ else sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 @@ -12499,14 +13713,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12525,11 +13738,20 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12542,7 +13764,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; @@ -12554,14 +13776,11 @@ See \`config.log' for more details." >&2;} esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 +echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12623,7 +13842,7 @@ echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val @@ -12726,13 +13945,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -# *nix default: "${datadir}/sdcc/doc" - -if test "${docdir}" = ""; then - docdir="\${datadir}"/sdcc/doc -fi - - # Generating output files # =========================================================================== @@ -12765,13 +13977,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -12801,13 +14013,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -12818,7 +14030,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -12862,9 +14074,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -12883,7 +14096,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -13062,16 +14275,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -13098,7 +14312,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -13142,9 +14356,9 @@ Usage: $0 [OPTIONS] [FILE]... -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -13158,11 +14372,10 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -13363,6 +14576,7 @@ s,@VERSION@,$VERSION,;t t s,@VERSIONHI@,$VERSIONHI,;t t s,@VERSIONLO@,$VERSIONLO,;t t s,@VERSIONP@,$VERSIONP,;t t +s,@docdir@,$docdir,;t t s,@enable_ucsim@,$enable_ucsim,;t t s,@enable_dlso@,$enable_dlso,;t t s,@enable_51@,$enable_51,;t t @@ -13403,6 +14617,11 @@ s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t +s,@LEX@,$LEX,;t t +s,@LEXLIB@,$LEXLIB,;t t +s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@YACC@,$YACC,;t t +s,@BISON_PLUS_PLUS@,$BISON_PLUS_PLUS,;t t s,@dl_ok@,$dl_ok,;t t s,@DL@,$DL,;t t s,@panel_ok@,$panel_ok,;t t @@ -13412,7 +14631,6 @@ s,@M_OR_MM@,$M_OR_MM,;t t s,@SHAREDLIB@,$SHAREDLIB,;t t s,@PICOPT@,$PICOPT,;t t s,@dlso_ok@,$dlso_ok,;t t -s,@docdir@,$docdir,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -13444,9 +14662,9 @@ _ACEOF (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -13464,21 +14682,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -13494,10 +14712,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -13535,12 +14753,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -13548,11 +14799,6 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -13562,7 +14808,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -13571,26 +14817,32 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub @@ -13630,12 +14882,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -13644,11 +14896,11 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -13662,28 +14914,29 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -13706,9 +14959,9 @@ s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -13722,13 +14975,13 @@ rm -f confdef2sed.sed # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -13737,7 +14990,7 @@ do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -13764,7 +15017,7 @@ do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -13798,10 +15051,10 @@ echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -13817,10 +15070,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } diff --git a/sim/ucsim/configure.in b/sim/ucsim/configure.in index eb113efc..600d53cb 100644 --- a/sim/ucsim/configure.in +++ b/sim/ucsim/configure.in @@ -27,6 +27,13 @@ AC_DEFINE_UNQUOTED(VERSIONP, $VERSIONP) # Some options #============== +# *nix default: "${datadir}/sdcc/doc" +AC_ARG_VAR(docdir, documentation installation directory) +if test "${docdir}" = ""; then + docdir="\${datadir}"/sdcc/doc +fi +AC_SUBST(docdir) + AC_ARG_ENABLE(ucsim, [ --enable-ucsim compile ucsim frontend], if test $enable_ucsim != "no"; then @@ -59,7 +66,7 @@ if test $enable_z80 != "no"; then fi, enable_z80="no") AC_ARG_ENABLE(hc08, -[ --enable-hc08 compile simulator for hc08], +[ --enable-hc08 compile simulator for hc08], if test $enable_hc08 != "no"; then enable_hc08="yes" fi, @@ -109,6 +116,14 @@ dnl AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) +AC_PROG_LEX +if test ${LEX} = "flex"; then + AC_DEFINE(HAVE_FLEX) +fi +AC_PROG_YACC +AC_CHECK_PROG(BISON_PLUS_PLUS, bison++, bison++, :) + + AC_LANG_CPLUSPLUS # Checking for header files. @@ -204,7 +219,8 @@ AC_SUBST(curses_ok) AC_SUBST(CURSES_LIBS) AC_FUNC_VPRINTF -AC_CHECK_FUNCS(vsnprintf vasprintf) +AC_CHECK_FUNCS(vsnprintf) +AC_CHECK_FUNCS(vasprintf) AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup) AC_CHECK_FUNCS(strchr memcpy) dnl AC_CHECK_FUNCS(getline) @@ -346,11 +362,14 @@ AC_SUBST(M_OR_MM) DD_COPT(CXX, ggdb) if test "$ucsim_cv_CXXggdb" = "yes"; then - if test "$CXXFLAGS"x = x ;then - CXXFLAGS="-ggdb" - else - CXXFLAGS="$CXXFLAGS -ggdb" - fi + gopt="-ggdb" +else + gopt="-g" +fi +if test "$CXXFLAGS"x = x ;then + CXXFLAGS="$gopt" +else + CXXFLAGS="$CXXFLAGS $gopt" fi DD_COPT(CXX, pipe) @@ -466,13 +485,6 @@ fi AC_DEFINE_UNQUOTED(_A_, "${A}") AC_DEFINE_UNQUOTED(_M_, "${M}") -# *nix default: "${datadir}/sdcc/doc" -AC_ARG_VAR(docdir, documentation installation directory) -if test "${docdir}" = ""; then - docdir="\${datadir}"/sdcc/doc -fi -AC_SUBST(docdir) - # Generating output files # =========================================================================== diff --git a/sim/ucsim/ddconfig_in.h b/sim/ucsim/ddconfig_in.h index 0ee8478c..442fde0b 100644 --- a/sim/ucsim/ddconfig_in.h +++ b/sim/ucsim/ddconfig_in.h @@ -30,7 +30,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define DD_TRUE 1 #define DD_FALSE 0 -#define bool int + //#define bool int +#define NIL 0 #undef STDC_HEADERS #undef HAVE_GETOPT_H @@ -76,6 +77,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #undef HAVE_FGETS #undef HAVE_YYLEX +#undef HAVE_FLEX +#undef YYTEXT_POINTER #undef RETSIGTYPE #undef SIZEOF_CHAR diff --git a/sim/ucsim/doc/Makefile.in b/sim/ucsim/doc/Makefile.in index 10e628aa..4a996b63 100644 --- a/sim/ucsim/doc/Makefile.in +++ b/sim/ucsim/doc/Makefile.in @@ -22,6 +22,7 @@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 infodir = @infodir@ srcdir = @srcdir@ +#docdir = $(prefix)/share/doc/ucsim docdir = @docdir@/ucsim diff --git a/sim/ucsim/doc/analyzer.html b/sim/ucsim/doc/analyzer.html index 08c91d97..2922c6c8 100644 --- a/sim/ucsim/doc/analyzer.html +++ b/sim/ucsim/doc/analyzer.html @@ -1,6 +1,6 @@ -UCSIM: Code Analyzer +µCsim: Code Analyzer diff --git a/sim/ucsim/doc/cmd.html b/sim/ucsim/doc/cmd.html index 6043982e..3d72870d 100644 --- a/sim/ucsim/doc/cmd.html +++ b/sim/ucsim/doc/cmd.html @@ -5,129 +5,261 @@ -

Command reference of ucsim

+

Command reference of µCsim

+ + General commands and information -
  • help,? Help about -commands (changed 0.2.38) + + + + + +Memory manipulation -
  • fill Fill memory region + + + Execution - + + Breakpoints + + Dump commands + + Removed obsolet commands
    • wi,Wi Search for string in Internal RAM (removed 0.2.38, use where,Where instead) +href="cmd_memory.html#where">where,Where instead)
    • wx,Wx Search for string in External RAM (removed 0.2.38, use where,Where instead) +href="cmd_memory.html#where">where,Where instead)
    • wc,Wc Search for string in ROM (removed 0.2.38, use where,Where instead) +href="cmd_memory.html#where">where,Where instead)
    • gopt Get value of option(s) (removed 0.2.38, use instead)
    • fi Fill IRAM area with data (removed 0.2.38, use fill instead) +href="cmd_memory.html#fill">fill instead)
    • fx Fill XRAM area with data (removed 0.2.38, use fill instead) +href="cmd_memory.html#fill">fill instead)
    • fs Fill SFR area with data (removed 0.2.38, use fill instead) +href="cmd_memory.html#fill">fill instead)
    • fc Fill ROM area with data (removed 0.2.38, use fill instead) +href="cmd_memory.html#fill">fill instead)
    • db Dump bit (removed 0.2.38, use -Breakpoints commands of uCsim +Breakpoints commands of µCsim -

      Commands of uCsim to manage breakpoints

      +

      Commands of µCsim to manage breakpoints

      -Two kind of breakpoints can be used: fetch and event +Two kind of breakpoint can be used: fetch and event breakpoint. Fetch breakpoints are classical breakpoints. They can be placed at any instruction in the code memory. Breakpoint will be hit if CPU fetches instruction code from the memory location @@ -19,26 +19,9 @@ it stops before the instruction at location specified by the breakpoint would be executed.

      Event breakpoints are special onces. They cause stop of -execution if event specified by the breakpoint occures. Events are: - -

      wi
      writing into internal RAM at specified location; - -
      ri
      reading from internal RAM at specified address; - -
      wx
      writing into external RAM at specified location -(MOVX instruction); - -
      rx
      reading from external RAM at specified address (MOVX -instruction); - -
      ws
      writing into SFR area at specified location; - -
      rs
      reading from SFR area at specified address; - -
      rc
      reading from code memory at specified location (MOVC -instruction).
      - -Event breakpoint stops execution after specified event occured. +execution if event specified by the breakpoint occures. Event can be a +read or a write operation on any address space location. Event +breakpoint stops execution after specified event occured.

      Every breakpoint can be fix (permanent) or dynamic (temporary). Dynamic breakpoints are automatically removed when they @@ -50,11 +33,13 @@ href="#n">next. number specifies how many times the breakpoint must be hit before it causes the execution to stop. This hit number is 1 by default. +


      + -

      break addr [hit] -
      break memory_type r|w addr [hit]

      -

      tbreak addr [hit] -
      tbreak memory_type r|w addr [hit]

      +

      break addr [hit] +
      break memory_type r|w addr [hit]

      +

      tbreak addr [hit] +
      tbreak memory_type r|w addr [hit]

      Set fetch or event breakpoint. The command specifies if the breakpoint @@ -74,8 +59,8 @@ placed to. It should be address of an instruction.
      Event breakpoint
      First parameter specifies class name of memory where we are going -to watch for en event. Class names of memories can be checked by qconf command. +to watch for en event. Class names of memories can be checked by info memory command.
      Second parameter specifies the event. It can be r to specify read operation or w which means write operation. @@ -113,8 +98,10 @@ Stop at 000160: (4) Breakpoint F 000160 > +
      -

      clear [addr...]

      + +

      clear [addr...]

      Delete fetch breakpoint. Parameter specifies address of breakpoint. If there is no breakpoint specified at given address this command prints @@ -139,8 +126,10 @@ Num Type Disp Hit Cnt Address What 1 event keep 1 1 0x000006 wi > +
      + -

      delete [number...]

      +

      delete [number...]

      Delete breakpoint(s) by its number. diff --git a/sim/ucsim/doc/cmd_dump.html b/sim/ucsim/doc/cmd_dump.html index 2c36cbcc..af2150c5 100644 --- a/sim/ucsim/doc/cmd_dump.html +++ b/sim/ucsim/doc/cmd_dump.html @@ -1,36 +1,37 @@ -Dump commands of uCsim +Dump commands of µCsim -

      Dump commands of uCsim

      +

      Dump commands of µCsim

      -

      dump memory_type [start [end -[bytes_per_line]]] -
      dump bit_name...

      +

      dump memory_type [start [end [bytes_per_line]]] +
      dump bit_name...

      First form can be used get content of memory while second form can be used to check value of bit or bits. -

      dump memory_type [start [end -[bytes_per_line]]]

      +
      + +

      dump memory_type [start [end +[bytes_per_line]]]

      Hexadecimal dump of a memory region. First parameter specifies -memory. Class name of the memory must be used, it can be checked using -conf command which lists size and -class name of all available memories. +memory. It can be name of an address space or a chip, and can be +checked using info memory +command which lists size and name of all available memories.

      start and end parameters can be used to specify the -first and last address of the region. If end is omitted then 64 -memory location is dumped. If both start and end are -omitted then next 64 memory location will be dumped out. Every time -when dump command is used the address of last dumped memory location -is stored and next dump command automatically continues at next -address. +first and last address of the dumped region. If end is omitted +then 64 memory location is dumped. If both start and end +are omitted then next 64 memory location will be dumped out. Every +time when dump command is used the address of last dumped memory +location is stored and next dump command automatically continues at +next address.

      Last parameter can be used to specify how many memory locations should be dumped out in one line. It is 8 by default. @@ -59,10 +60,10 @@ F 0x000515 0x004c 78 18 06 30 03 4b 20 92 x..0.K . 0x0054 48 30 07 05 c2 07 02 00 H0...... 0x005c 9d 30 08 05 20 93 3a c2 .0.. .:. -> du x 10 20 10 +> du xram 10 20 10 0x000a ff 01 00 fa 01 01 40 01 01 44 ......@..D 0x0014 01 . -> du x +> du xram 0x0015 00 00 00 00 00 00 00 00 ........ 0x001d 00 10 01 00 ae 01 00 ae ........ 0x0025 02 12 e1 00 5a 85 00 01 ....Z... @@ -73,23 +74,139 @@ F 0x000515 0x004d 00 00 5a 85 ff 00 01 00 ..Z..... 0x0055 00 00 00 94 a7 01 0c a6 ........ 0x005d 00 6f ff 00 00 00 00 00 .o...... +> + + +


      + + +

      dump bit_name...

      + +If the simulated controller supports addressable bits (such as MCS51 +does) this command can be used to print out values of bit(s). Any form of bit address can be used +as parameter: + +
      +0> dump ac p1.2 0x21
      +     PSW.6 0xd0 00 0
      +      P1.2 0x90 ff 1
      +    0x24.1 0x24 24 0
      +0> 
      +
      + +Please note, that this command can not be used, if there is no address +space called sfr. + +
      +$ sz80
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> dump 0.0
      +No memory specified. Use "info memory" for available memories
      +0> 
      +
      + + +
      + +
      + + +

      dch [start [stop]]

      + +Hexadecimal dump of code memory area from address start to +address stop. Default value of start address is address of +following memory cell which was dumped by previous dch +command. If stop parameter is not given dch command +lists 10 lines 8 bytes per line. + +
      +$ s51 remo.hex
      +ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +58659 bytes read from remoansi.hex
      +> wc remo
      +0013da 52 65 6d 6f             Remo
      +> dch 0x13da
      +0013da 52 65 6d 6f 20 00 56 65 Remo .Ve
      +0013e2 72 73 69 6f 6e 20 31 2e rsion 1.
      +0013ea 30 20 00 43 6f 70 79 72 0 .Copyr
      +0013f2 69 67 68 74 20 28 63 29 ight (c)
      +0013fa 20 00 31 39 39 34 2c 39  .1994,9
      +001402 35 20 00 54 61 6c 6b 65 5 .Talke
      +00140a 72 20 42 74 2e 00 53 75 r Bt..Su
      +001412 6e 64 61 79 2e 00 4d 6f nday..Mo
      +00141a 6e 64 61 79 2e 00 54 68 nday..Th
      +001422 75 65 73 64 61 79 2e 00 uesday..
       > 
      +First element in every lines is address of first byte dumped out in +the line. Next elements are hexadecimal values of bytes followed by +ASCII charactes of bytes dumped out in the line. If value of the +memory cell is not printable than a dot is dumped out. + +
      + + +

      dc [start [stop]]

      + +Disassembled dump of code memory area. This command simply produces +disassambled list of memory area specified by the parameters. Default +value of start parameter is last address listed by previous +dc command. If stop parameter is not given 20 lines are +listed. + +
      +$ s51 remoansi.hex 
      +ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +58659 bytes read from remoansi.hex
      +> dc
      +   000000 02 01 60 LJMP  0160
      + * 000003 02 00 3c LJMP  003c
      + * 000006 ff       MOV   R7,A
      + * 000007 ff       MOV   R7,A
      + * 000008 ff       MOV   R7,A
      + * 000009 ff       MOV   R7,A
      + * 00000a ff       MOV   R7,A
      + * 00000b 02 3b e0 LJMP  3be0
      + * 00000e ff       MOV   R7,A
      + * 00000f ff       MOV   R7,A
      + * 000010 ff       MOV   R7,A
      + * 000011 ff       MOV   R7,A
      + * 000012 ff       MOV   R7,A
      + * 000013 02 00 ac LJMP  00ac
      + * 000016 ff       MOV   R7,A
      + * 000017 ff       MOV   R7,A
      + * 000018 ff       MOV   R7,A
      + * 000019 ff       MOV   R7,A
      + * 00001a ff       MOV   R7,A
      + * 00001b ff       MOV   R7,A
      + * 00001c ff       MOV   R7,A
      +> 
      -

      dump bit_name...

      +
      -

      disassemble [start [offset -[lines]]]

      +

      disassemble [start [offset +[lines]]]

      Disassemble code. This command can be used to list disassembled -instructions which discovered by the code analyzer. First two -parameters specify the address where the list starts. First parameter -is address where the command starts to search an instruction. This -search goes forward. When the first instruction marked by code -analyzer found the simulator skips as many instructions as you specify -in second parameter. If offset is negative the simulator goes -backward and skips specified number of instructions. Default value of +instructions which discovered by the code +analyzer. First two parameters specify the address where the list +starts. First parameter is address where the command starts to search +an instruction. This search goes forward. When the first instruction +marked by code analyzer found the simulator skips as many instructions +as you specify in second parameter. If offset is negative the +simulator goes backward and skips specified number of +instructions. Default value of start parameter is last address which was listed by previous dis command and default value of offset is -1. It means you can make continuous list repeating parameterless dis @@ -106,7 +223,6 @@ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 58659 bytes read from remoansi.hex > dis - 00d47e 22 RET 000000 02 01 60 LJMP 0160 000160 c2 90 CLR P1.0 000162 c2 97 CLR P1.7 @@ -126,8 +242,8 @@ under certain conditions; type `show c' for details. 000183 78 22 MOV R0,#22 000185 76 00 MOV @R0,#00 000187 d8 fc DJNZ R0,0185 -> bs f 0x180 -> bs d 0x189 +> br 0x180 +> tbr 0x189 > dis 0x180 -3 10 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 @@ -151,104 +267,30 @@ six digit hexadecimal number. Address is followed by hexadecimal dump of instruction's code. Last element of the list is disassembled instruction. Every number appeared on the list is hexadecimal number. - -

      dc [start [stop]]

      - -Disassembled dump of code memory area. This command simply produces -disassambled list of memory area specified by the parameters. Default -value of start parameter is last address listed by previous -dc command. If stop parameter is not given 20 lines are -listed. - -
      -$ s51 remoansi.hex 
      -ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -58659 bytes read from remoansi.hex
      -> dc
      -   000000 02 01 60 LJMP  0160
      - * 000003 02 00 3c LJMP  003c
      - * 000006 ff       MOV   R7,A
      - * 000007 ff       MOV   R7,A
      - * 000008 ff       MOV   R7,A
      - * 000009 ff       MOV   R7,A
      - * 00000a ff       MOV   R7,A
      - * 00000b 02 3b e0 LJMP  3be0
      - * 00000e ff       MOV   R7,A
      - * 00000f ff       MOV   R7,A
      - * 000010 ff       MOV   R7,A
      - * 000011 ff       MOV   R7,A
      - * 000012 ff       MOV   R7,A
      - * 000013 02 00 ac LJMP  00ac
      - * 000016 ff       MOV   R7,A
      - * 000017 ff       MOV   R7,A
      - * 000018 ff       MOV   R7,A
      - * 000019 ff       MOV   R7,A
      - * 00001a ff       MOV   R7,A
      - * 00001b ff       MOV   R7,A
      - * 00001c ff       MOV   R7,A
      -> 
      - - -

      dch [start [stop]]

      - -Hexadecimal dump of code memory area from address start to -address stop. Default value of start address is address of -following memory cell which was dumped by previous dch -command. If stop parameter is not given dch command -lists 10 lines 8 bytes per line. - -
      -$ s51 remo.hex
      -ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -58659 bytes read from remoansi.hex
      -> wc remo
      -0013da 52 65 6d 6f             Remo
      -> dch 0x13da
      -0013da 52 65 6d 6f 20 00 56 65 Remo .Ve
      -0013e2 72 73 69 6f 6e 20 31 2e rsion 1.
      -0013ea 30 20 00 43 6f 70 79 72 0 .Copyr
      -0013f2 69 67 68 74 20 28 63 29 ight (c)
      -0013fa 20 00 31 39 39 34 2c 39  .1994,9
      -001402 35 20 00 54 61 6c 6b 65 5 .Talke
      -00140a 72 20 42 74 2e 00 53 75 r Bt..Su
      -001412 6e 64 61 79 2e 00 4d 6f nday..Mo
      -00141a 6e 64 61 79 2e 00 54 68 nday..Th
      -001422 75 65 73 64 61 79 2e 00 uesday..
      -> 
      - -First element in every lines is address of first byte dumped out in -the line. Next elements are hexadecimal values of bytes followed by -ASCII charactes of bytes dumped out in the line. If value of the -memory cell is not printable than a dot is dumped out. +
      -

      di [start [stop]]

      +

      di [start [stop]]

      -Hexadecimal dump of internal RAM area from address start to -address stop. Default value of start address is address of -following memory cell which was dumped by previous di -command. If stop parameter is not given di command -lists 10 lines 8 bytes per line. +Hexadecimal dump of iram named address space area from address +start to address stop. Default value of start address is +address of following memory cell which was dumped by previous +di command. If stop parameter is not given di +command lists 10 lines 8 bytes per line.
       $ s51 remoansi.hex
      -ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
       58659 bytes read from remoansi.hex
      -> sopt stopit 1
      -> g
      +0> set opt irq_stop 1
      +0> go
       Simulation started, PC=0x000000
       Stop at 000023: (5) Interrupt
       F 000023
      -> di
      +0> di
       000000 18 02 16 ba 00 02 00 0a ........
       000008 00 00 00 00 00 00 00 00 ........
       000010 00 00 00 00 00 00 00 00 ........
      @@ -259,30 +301,33 @@ F 000023
       000038 fe 03 09 00 00 00 af 08 ........
       000040 af 08 00 00 00 00 00 00 ........
       000048 00 00 00 00 00 00 00 00 ........
      -> 
      +0> + + +
      -

      dx [start [stop]]

      +

      dx [start [stop]]

      -Hexadecimal dump of external RAM area from address start to -address stop. Default value of start address is address of -following memory cell which was dumped by previous dx -command. If stop parameter is not given dx command -lists 10 lines 8 bytes per line. +Hexadecimal dump of xram named address space area from address +start to address stop. Default value of start address is +address of following memory cell which was dumped by previous +dx command. If stop parameter is not given dx +command lists 10 lines 8 bytes per line.
       $ s51 remoansi.hex
      -ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
       58659 bytes read from remoansi.hex
      -> sopt stopit 1
      -> g
      +0> set opt irq_stop 1
      +0> go
       Simulation started, PC=0x000000
       Stop at 000023: (5) Interrupt
       F 000023
      -> dx 0x100
      +0> dx 0x100
       000100 00 00 00 00 00 00 00 00 ........
       000108 00 00 00 00 00 00 00 00 ........
       000110 00 00 00 00 00 00 00 00 ........
      @@ -293,10 +338,48 @@ F 000023
       000138 07 00 00 ff 00 00 07 cb ........
       000140 08 0c 32 00 07 cb 06 05 ..2.....
       000148 02 00 24 00 00 00 00 00 ..$.....
      -> 
      +0> + + +
      + + +

      ds [start [stop]]

      +Hexadecimal dump of sfr named address space area from address +start to address stop. Default value of start address is +address of following memory cell which was dumped by previous +ds command. If stop parameter is not given ds +command lists 10 lines 8 bytes per line. + +
      +$ s51 remo.hex
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +58659 bytes read from remoansi.hex
      +0> set opt irq_stop 1
      +0> go
      +Simulation started, PC=0x000000
      +Stop at 000023: (5) Interrupt
      +F 000023
      +0> ds
      +0x80 ff 2a 1e 13 00 00 00 80 .*......
      +0x88 d5 21 f7 fd 50 fd 00 00 .!..P...
      +0x90 fe 00 00 00 00 00 00 00 ........
      +0x98 7e 0a 00 00 00 00 00 00 ~.......
      +0xa0 ff 00 00 00 00 00 00 00 ........
      +0xa8 97 00 00 00 00 00 00 00 ........
      +0xb0 ff 00 00 00 00 00 00 00 ........
      +0xb8 15 00 00 00 00 00 00 00 ........
      +0xc0 00 00 00 00 00 00 00 00 ........
      +0xc8 00 00 00 00 00 00 00 00 ........
      +0>
      +

      + diff --git a/sim/ucsim/doc/cmd_exec.html b/sim/ucsim/doc/cmd_exec.html index 8bca1348..c4adbe9c 100644 --- a/sim/ucsim/doc/cmd_exec.html +++ b/sim/ucsim/doc/cmd_exec.html @@ -1,12 +1,60 @@ -Execution commands of uCsim +Execution commands of µCsim -

      Execution commands of uCsim

      +

      Execution commands of µCsim

      + + +

      r,run,go [start [stop]]

      + +This command starts the execution of the simulated program. + +

      Parameters are optional. First parameter specifies start address of +the execution. By default execution starts at address specified by +actual value of the PC. This can be overridden by first parameter. + +

      If second parameter is specified it places a dynamic breakpoint at +specified address which stops the execution. If stop address is not +given the simulator stops if it reaches a breakpoint, or the CPU +accepts an interrupt and stopit option is TRUE, or fatal error +occures or stop command is used on an other +console, or ENTER key is pressed on the console where the run command +was issued. + +

      If program execution is started the console is frozen it is +not possible to give commands on this console to the simulator while +execution is running. If it is needed to control the simulator during +program execution then more consoles can be used. See using multiple consoles for more information. + +

      Note that first instruction is executed without effect of +breakpoints and simulation will be started afterwards. It means that +if there is a breakpoint at start address then it will not be hit. See +following example: + +

      +$ ./s51
      +ucsim 0.2.38-pre1, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +> b 0x10
      +Breakpoint 1 at 0x000010: MOV   R7,A
      +> b 0x20
      +Breakpoint 2 at 0x000020: MOV   R7,A
      +> run 0x10
      +Warning: maybe not instruction at 0x000010
      +Simulation started, PC=0x000010
      +Stop at 0x000020: (104) Breakpoint
      +F 0x000020
      +> 
      +
      + +

      stop

      @@ -38,6 +86,8 @@ commands. If it stopped by the stop command the instruction pointed by PC is dissassembled, see the dis command for description of disassembled form. +
      +

      s,step

      @@ -61,6 +111,8 @@ under certain conditions; type `show c' for details. After execution of actual instruction pointed by PC the step command dumps out the register set. +
      +

      n,next

      @@ -101,6 +153,8 @@ under certain conditions; type `show c' for details. 000177 0f INC R7 > +
      +

      pc [address]

      @@ -124,53 +178,10 @@ Warning: maybe not instruction at 000020 * 000020 ff MOV R7,A > +
      -

      r,run,go [start [stop]]

      - -This command starts the execution of the simulated program. - -

      Parameters are optional. First parameter specifies start address of -the execution. By default execution starts at address specified by -actual value of the PC. This can be overridden by first parameter. - -

      If second parameter is specified it places a dynamic breakpoint at -specified address which stops the execution. If stop address is not -given the simulator stops if it reaches a breakpoint, or the CPU -accepts an interrupt and stopit option is TRUE, or fatal error -occures or stop command is used on an other -console, or ENTER key is pressed on the console where the run command -was issued. - -

      If program execution is started the console is frozen it is -not possible to give commands on this console to the simulator while -execution is running. If it is needed to control the simulator during -program execution then more consoles can be used. See using multiple consoles for more information. - -

      Note that first instruction is executed without effect of -breakpoints and simulation will be started afterwards. It means that -if there is a breakpoint at start address then it will not be hit. See -following example: - -

      -$ ./s51
      -ucsim 0.2.38-pre1, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> b 0x10
      -Breakpoint 1 at 0x000010: MOV   R7,A
      -> b 0x20
      -Breakpoint 2 at 0x000020: MOV   R7,A
      -> run 0x10
      -Warning: maybe not instruction at 0x000010
      -Simulation started, PC=0x000010
      -Stop at 0x000020: (104) Breakpoint
      -F 0x000020
      -> 
      -
      -
      + diff --git a/sim/ucsim/doc/cmd_general.html b/sim/ucsim/doc/cmd_general.html index e0483de0..fd0adf93 100644 --- a/sim/ucsim/doc/cmd_general.html +++ b/sim/ucsim/doc/cmd_general.html @@ -1,73 +1,109 @@ -General commands of uCsim +General commands of µCsim -

      General commands of uCsim

      +

      General commands of µCsim

      -

      Every command which changes content of ROM area such as dl or set -memory deletes result of code analyzer and causes to -re-analyze the code. +

      conf

      +Conf command can be used to display different kind of information +about µCsim. It can be followed by a subcommand: -

      show

      +

      conf +
      conf objects -Show command can be used to display different kind of information. It -must be followed by a subcommand. Subcommands are: +

      -

      show copying -
      show warranty +

      conf

      +This command (without a subcommand) prints out configuration of the +simulator: -

      show copying

      +
      +0> conf
      +ucsim version 0.5.0-pre3
      +Type of microcontroller: 51 CMOS
      +Controller has 9 hardware element(s).
      +  timer0[0]
      +  timer1[1]
      +  uart[0]
      +  port[0]
      +  port[1]
      +  port[2]
      +  port[3]
      +  irq[0]
      +  _51_dummy[0]
      +0>
      +
      -This command can be used to list licensing information. It is first 10 -point of the version 2 of GNU Genral Public License. If you do not -accept GPL simply do not use the program. +First line contains version number of the program. Second line informs +about type of the simulated microcontroller. Third line prints out how +many hardware elements are simulated. +

      conf objects

      -

      show warranty

      +This command is for development only. -This command prints out last 2 point of the license ("NO WARRANTY" -message). +
      +
      -

      download,dl

      -Download command. It is same as load above but it -reads information from command console which is standard input by -default. This command stops read records when it detects an "END" -record which is normaly the last record. This command has two -equivalent forms download and dl. +

      ?,help [command]

      + +Help command. It prints out short description of the commands. + +

      If a command name is given as parameter then µCsim prints out all +command that has similar names:

      -$ s51 -V
      -ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> do
      -:03000000020003F8
      -:1000030075812078207600D8FC900000AE83AF8203
      -:100013009000001200416005E4F0A380F690009F79
      -:1000230012004A9000A312004A9000A712006890A1
      -:1000330000AD12006875D0001200B50200B3EF6581
      -:10004300827003EE658322E493F8740193F97402DA
      -:1000530093FE740393F5828E83E869700122E4931F
      -:10006300F6A30880F4E493FC740193FD740293FEF9
      -:10007300740393FF740493F8740593F582888312D1
      -:100083000041700122E493A3A883A9828C838D820B
      -:10009300F0A3AC83AD828883898280E3212100B5FC
      -:1000A300212100B5000000B500B5000000B500B582
      -:0200B30080FECD
      -:1000B5007520117501AA850120750102850120228F
      -:00000001FF
      -197 bytes loaded
      -> 
      +0> ? s +show subcommand Generic command for showing things about the uCsim +set subcommand Set, see `set' command for more help +stop Stop +step Step +state State of microcontroller +statistic [mem [startaddr [endaddr]]] + Statistic of memory accesses +0> ? s o +show option [name] Show internal data of options +set option name|nr value + Set value of an option +0> + + +Some commands have more than one name which can produce interesting +result: + +
      +0> ? t r
      +timer delete id    Delete a timer
      +timer start id     Start a timer
      +0> 
      +
      + +It looks that names of listed subcommands start with no "r" but take a +closer look on that commands: + +
      +0> ? t d
      +timer delete id    Delete a timer
      +Names of command: delete remove
      +long help of timer delete
      +0> ? t start
      +timer start id     Start a timer
      +Names of command: run start
      +long help of timer run
      +0> 
      + +

      If parameter is unique name of a command then long description of +the command is printed out. + +


      quit

      @@ -92,6 +128,8 @@ under certain conditions; type `show c' for details. > q $ +
      +

      kill

      @@ -99,99 +137,397 @@ This kommand terminates the simulator. It does not ask for confirmation. It doesn't matter how many consoles are used and what commands are running on them. +
      -

      ?,help [command]

      -Help command. It prints out short description of the commands. +

      exec file

      -

      If a command name is given as parameter then uCsim prints out all -command that has the same name. +Reads commands from "file" and executes them. This command opens a new +console (which will use same in/out file as the actual one) to execute +the file. This means the "quit" command in the file will not exit the +simulator: -

      If parameter is unique name of a command then long description of -the command is printed out. +

      +drdani@emma:~$ cat /tmp/x
      +get opt
      +quit
      +conf
      +drdani@emma:~$ s51
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> exec "/tmp/x"
      +1> get opt
      + 0. config_file(by application) is hidden!
      + 1. console_on(by application) is hidden!
      + 2. cpu_type(by application) is hidden!
      + 3. debug(by console1): FALSE - Debug messages to console1
      + 4. debug(by console0): FALSE - Debug messages to console0
      + 5. debug(by application): FALSE - Print debug messages (-V)
      + 6. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
      + 7. null_prompt(by application): FALSE - Use \0 as prompt (-P)
      + 8. prompt(by console1): "" - Prompt string of console1
      + 9. prompt(by console0): "" - Prompt string of console0
      +10. prompt(by application): (null) - String of prompt (-p)
      +11. serial_in_file(by application) is hidden!
      +12. serial_out_file(by application) is hidden!
      +13. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
      +1> quit
      +0> 
      +
      +
      -

      reset

      -Reset command. It resets the microcontroller. It has same effect as -active signal on the RST pin. +

      expression expr

      + +Executes "expr" as an expression. For more about expressions, see command syntax.
      -$ s51 -V remoansi.hex
      -ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +0> expr 1 + 2
      +3
      +0> expr xram[256*dph+dpl]= &sp
      +129
      +0> 
      +
      + + +
      + + +

      show

      + +Show command can be used to display different kind of information. It +must be followed by a subcommand. Subcommands are: + +

      show copying +
      show warranty +
      show option +
      show error + +

      + +

      show copying

      + +This command can be used to list licensing information. It is first 10 +point of the version 2 of GNU Genral Public License. If you do not +accept GPL simply do not use the program. + +
      + +

      show warranty

      + +This command prints out last 2 point of the license ("NO WARRANTY" +message). + +
      + +

      show option

      + +This command is for development only. + +
      + +

      show error

      + +Errors or warnings are events which can happen in the simulated system +during simulation. Report of that events can be turned on or off using +set error command. Errors are +organized in parent-child relationship. Childs are listed under the +parent: + +
      +0> sh er
      +Error: non-classified [on/ON]
      +  Error: memory [on/ON]
      +    Error: invalid_address [unset/ON]
      +    Error: non_decoded [unset/ON]
      +  Error: stack [off/OFF]
      +    Error: stack_tracker [unset/OFF]
      +      Error: stack_tracker_wrong_handle [unset/OFF]
      +      Error: operation_on_empty_stack [unset/OFF]
      +      Warning: stack_operation_unmatched_to_top_of_stack [unset/OFF]
      +      Warning: stack_looks_corrupted [unset/OFF]
      +0> 
      + +First element is the type (Error or Warning). Error stops the +simulation. Warning is just reported and simulation goes on. Next +element is the name of the error. Last element shows actual value and +state. Value can be: + +
      on
      state is ON + +
      off
      state is OFF + +
      unset
      state is inherited from the parent. +
      + +If state is ON and the event happens, it is reported. If state +is OFF then the event is silently ignored. + +
      +
      + + +

      get

      + +This command can be used to get value of various kind of things. It +requires a subcommand to specify what is going to be set. Known +subcommands are: + +

      get sfr +
      get option + + +

      + +

      get sfr address...

      + +This command can be used to check values of SFR location(s) if SFR +exists in simulated memory. Note that dump memory or ds can be used as well. + +

      Parameters are interpreted as SFR names or addresses and values of +addressed locations are dumped out. + +

      +$ s51 
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -58659 bytes read from remoansi.hex
      -> dr
      -000000 00 00 00 00 00 00 00 00 ........
      -000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
      -000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
      -   000000 02 01 60 LJMP  0160
      -> s 2
      -000000 00 00 00 00 00 00 00 00 ........
      -000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
      -000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
      -   000160 c2 90    CLR   P1.0
      -000000 00 00 00 00 00 00 00 00 ........
      -000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
      -000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
      -   000162 c2 97    CLR   P1.7
      -> res
      -> dr
      -000000 00 00 00 00 00 00 00 00 ........
      -000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
      -000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
      -   000000 02 01 60 LJMP  0160
      +0> get sfr pcon p1 0 0x80 kahd scon 256
      +0x87 00 .
      +0x90 ff .
      +Warning: Invalid address 0
      +0x80 ff .
      +Warning: Invalid address kahd
      +0x98 00 .
      +Warning: Invalid address 256
      +0> 
      + +
      + + +

      get option [name]

      + +Get actual value of option(s). Some options can be set by set option to modify behavior of the +simulator. Using get option you can get actual value of these +options. If you use this command without parameter you get list of all +options known by the program. In this way you can figure out which +options can be used. + +
      +$ s51 -V
      +ucsim 0.5.0, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> get opt
      + 3. debug(by console0): FALSE - Debug messages to console0
      + 4. debug(by application): FALSE - Print debug messages (-V)
      + 5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
      + 6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
      + 7. prompt(by console0): "" - Prompt string of console0
      + 8. prompt(by application): (null) - String of prompt (-p)
      +11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
      +0> 
      +
      + +First element of the list is the number of the option. It is followed +by name of the option (debug, irq_stop, etc.). Number or +the name can be used to identify the option in +get option and set option +command. Next element shows which part of the simulator created the +option. + +

      Next element of the list is the value of the option. It can be an +integer or a floating point number, a string or a boolean value. + +

      Last part describes the option. + +

      Some options can have same name. An example is the debug +option. One is created by the application to store value given by -V +(see invokation). This will be used as +default value when a new instance of a console is created: + +

      +$ cat /tmp/x
      +get opt debug
      +$ s51
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> get opt debug
      + 3. debug(by console0): FALSE - Debug messages to console0
      + 4. debug(by application): FALSE - Print debug messages (-V)
      +0> set opt 4 1
      +0> get opt debug
      + 3. debug(by console0): FALSE - Debug messages to console0
      + 4. debug(by application): TRUE - Print debug messages (-V)
      +0> exec "/tmp/x"
      +1> get opt debug
      + 3. debug(by console1): TRUE - Debug messages to console1
      + 4. debug(by console0): FALSE - Debug messages to console0
      + 5. debug(by application): TRUE - Print debug messages (-V)
      +1> 
      +0> 
      +
      + +
      + +
      + + +

      set

      + +This command can be used to set various kind of things. It requires a +subcommand to specify what is going to be set. Known subcommands are: + +

      set option +
      set error +
      set memory +
      set bit +
      set hardware + + +

      + +

      set option name|nr value

      + +

      Set option value. Options described at (get option) command can be set using +this command. First parameter must be an option name or number and +second the new value. Interpretation of the value depends on type of +the option. Value for a boolean type of option interpreted as follows: +if first character of the value is one of 1, t, +T, y, Y then value will be TRUE otherwise +it will be FALSE. + +

      +$ s51 -V
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +> get opt
      + 0. config_file(by application) is hidden!
      + 1. console_on(by application) is hidden!
      + 2. cpu_type(by application) is hidden!
      + 3. debug(by console0): TRUE - Debug messages to console0
      + 4. debug(by application): TRUE - Print debug messages (-V)
      + 5. irq_stop(by mcs51_controller): FALSE - Stop when IRQ accepted
      + 6. null_prompt(by application): FALSE - Use \0 as prompt (-P)
      + 7. prompt(by console0): "" - Prompt string of console0
      + 8. prompt(by application): (null) - String of prompt (-p)
      + 9. serial_in_file(by application) is hidden!
      +10. serial_out_file(by application) is hidden!
      +11. xtal(by application): 11059200.000 - Frequency of XTAL in Hz
      +> set opt debug f
      +Ambiguous option name, use number instead
      +> set opt 3 f
      +> get opt debug
      + 3. debug(by console0): FALSE - Debug messages to console0
      + 4. debug(by application): TRUE - Print debug messages (-V)
       > 
      +
      + + +

      set error error_name +on|off|unset

      + +This command can be used to set if an error event should be reported +or not. Actual settings can be retrieved by show +error command. + +
      + + +

      set memory memory_type address +data...

      + +This command can be used to modify content of any simulated +memory. First parameter must be a class name to specify type of +memory. Class names can de checked by info memory command. Chips and +address spaces can be used as well. + +

      Second parameter specifies start address of the modification. + +

      Remaining parameters will be written into the memory starting at +address specified by second parameter. Data list can include numbers +as well as strings. See syntax for more +details. + +

      Modified memory locations will be dumped out. + +

      +0> set mem xram 1 "ab\tcd\0ef\012ghq" 2 "ABC"
      +0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
      +0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
      +0> set mem sfr pcon 0x34
      +0x87 34                      4
      +0> set mem xram_chip 1 2
      +0x0001 02                      .
      +0> 
      -

      where,Where memory_type data...

      +
      -Searching for some data in memory. First parameter specifies -memory. Class name of the memory must be used, it can be checked using -conf command which lists size and -class name of all available memories. -

      Other parameters can be mixed list of strings (characters between " -and ") and numbers. Strings can contain escape sequencies. Ucsim -merges all parameters together and will search for megred list of -values in specified memory. +

      set bit address 0|1

      -

      where command do case unsensitive search while Where -command is for case sensitive search. +Set one bit to 0 or 1. First parameter specifies the bit. It can be +the address of the bit (number or syqmbolic name) or it can be +specified in address.bitnumber format where +address addresses SFR area and bitnumber is number of +bit in specified SFR location. Using this syntax any SFR (and 8051's +internal RAM) location can be modified it need not be really bit +addressable. -

      Search is done in whole memory and all matches are dumped out. +

      Second parameter interpreted as 1 if it is not zero. + +

      Modified memory location is dumped out.

      -$ /s51
      +$ s51 
       ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -> set mem x 20 "Dani d ani D ani dani Dani"
      -0x0014 44 61 6e 69 20 64 20 61 Dani d a
      -0x001c 6e 69 20 44 20 61 6e 69 ni D ani
      -0x0024 20 64 61 6e 69 20 44 61  dani Da
      -0x002c 6e 69                   ni
      -> where x "dani"
      -0x0014 44 61 6e 69             Dani
      -0x0025 64 61 6e 69             dani
      -0x002a 44 61 6e 69             Dani
      -> Where x "d ani"
      -0x0019 64 20 61 6e 69          d ani
      -> 
      +> set bit tf1 1 +0x88 80 . +> set bit 130 0 +0x80 fb . +> set bit pcon.2 1 +0x87 04 . +> set bit 10.7 1 +0x0a 80 . +> + +
      -

      conf

      -This command prints out configuration of the simulator: +

      set hardware hardware_id data

      + +This command can be used to set value into a hardware element of the +controller (conf command lists them). + +

      Actually only port element of MCS51 accepts this method. It +can be used to set value of external circuits which +connected to ports of simulated controller. First parameter specifies +port element (as an array), second is the new value.

      -> conf
      -ucsim version 0.2.37
      +0> conf
       Type of microcontroller: 51 CMOS
      -Controller has 8 hardware element(s).
      +Controller has 9 hardware element(s).
         timer0[0]
         timer1[1]
         uart[0]
      @@ -200,21 +536,27 @@ Controller has 8 hardware element(s).
         port[2]
         port[3]
         irq[0]
      -Memories:
      -  ROM  size= 0x010000  65536 width=  8 class= "rom"
      -  XRAM size= 0x010000  65536 width=  8 class= "xram"
      -  IRAM size= 0x000100    256 width=  8 class= "iram"
      -  SFR  size= 0x000100    256 width=  8 class= "sfr"
      -> 
      +  _51_dummy[0]
      +0> set hw port[0] 12
      +0> i h po[0]
      +port[0]
      +P0    11111111 0xff 255 . (Value in SFR register)
      +Pin0  00001100 0x0c  12 . (Output of outside circuits)
      +Port0 00001100 0x0c  12 . (Value on the port pins)
      +0> set hw port[0] 23
      +0> i h po[0]
      +port[0]
      +P0    11111111 0xff 255 . (Value in SFR register)
      +Pin0  00010111 0x17  23 . (Output of outside circuits)
      +Port0 00010111 0x17  23 . (Value on the port pins)
      +0> set hw irq[0] 12
      +Nothing to do
      +0> 
       
      -First line contains version number of the program. Second line informs -about type of the simulated microcontroller. Third line prints out how -many hardware elements are simulated. Following lines contain -information about memories. Note that size of the simulated memory -segment can be bigger than size of addressable part of the memory as -you see above SFR type of the memory has bigger simulated than -addressable size. +
      + +

      state

      @@ -244,20 +586,45 @@ Idle times and main program.

      Last line infroms about maximum value of the stack pointer and a "not very well" calculated average value of it. +


      + -

      file,load "FILE"

      +

      reset

      -Loads file named FILE into the simulated code memory. File must -contain data in Intel HEX format. +Reset command. It resets the microcontroller. It has same effect as +active signal on the RST pin.
      -> file "../../remo.hex"
      -55470 words read from ../../remo.hex
      -> 
      -
      +$ s51 -V remoansi.hex +ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt. +ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. +58659 bytes read from remoansi.hex +> i r +000000 00 00 00 00 00 00 00 00 ........ +000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 . +000000 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 + 000000 02 01 60 LJMP 0160 +> s +000000 00 00 00 00 00 00 00 00 ........ +000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 . +000000 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 + 000160 c2 90 CLR P1.0 +> s +000000 00 00 00 00 00 00 00 00 ........ +000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 . +000000 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 + 000162 c2 97 CLR P1.7 +> res +> i r +000000 00 00 00 00 00 00 00 00 ........ +000000 00 . ACC= 0x00 0 . B= 0x00 DPTR= 0x0000 @DPTR= 0x00 0 . +000000 00 . PSW= 0x00 CY=0 AC=0 OV=0 P=0 + 000000 02 01 60 LJMP 0160 +> -Don't forget to enclose file name in quotes to make the parameter to -be a string. +

      info

      @@ -266,34 +633,36 @@ This command prints out information about different things which must be specified as paramater to the command. Following subcommands are known: -

      info breakpoints -
      info registers -
      info hardware +

      info breakpoints +
      info registers +
      info hardware +
      info stack +
      info memory +

      -

      info breakpoints

      +

      info breakpoints

      This subcommand prints out information about breakpoints:
      -> b 12
      +0> b 12
       Breakpoint 1 at 0x00000c: MOV   R7,A
      -> tb 43
      +0> tb 43
       Breakpoint 2 at 0x00002b: MOV   R7,A
      -> bse ws f 0x80
      -> i b
      +0> b sfr w 0x80
      +0> i b
       Num Type       Disp Hit   Cnt   Address  What
       1   fetch      keep 1     1     0x00000c MOV   R7,A
       2   fetch      del  1     1     0x00002b MOV   R7,A
      -1   event      keep 1     1     0x000080 ws
      -> 
      +3   event      keep 1     1     0x000080 write
      +0> 
       
      As you see above, the command can be shortened to "i b". The list of breakpoints contains 7 columns: -
      Num
      Number of the breakpoint. Normal and event -breakpoints are numbered separately. +
      Num
      Number of the breakpoint.
      Type
      This column shows type of the breakpoint. It can be fetch for normal breakpoints or event for event @@ -317,7 +686,10 @@ breakpoints it contains type of event.
      -

      info registers

      +
      + + +

      info registers

      This subcommand prints out full register set of the CPU. Output of this command depends of type of CPU. @@ -396,16 +768,68 @@ the status register too, and value of the stack pointer.

      Following line shows indirect addressing registers X, Y, and Z as well as pointed memory values. -

      Last line is disassembled instruction ap PC. +

      Last line is disassembled instruction at PC. -

      info hardware|hw identifier

      +
      Registers of Z80 family
      + +
      +$ sz80
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> i r
      +SZ-A--P-C  Flags= 0x00   0 .  A= 0x00   0 .
      +00-0--0-0
      +BC= 0x0000 [BC]= 00   0 .  DE= 0x0000 [DE]= 00   0 .  HL= 0x0000 [HL]= 00   0 .
      +IX= 0x0000 [IX]= 00   0 .  IY= 0x0000 [IY]= 00   0 .  SP= 0x0000 [SP]= 00   0 .
      + ? 0x0000 00          NOP
      +0> 
      +
      + +
      Registers of XA family
      + +
      +$ sxa
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +The XA Simulator is in development, UNSTABLE, DEVELOPERS ONLY!
      +0> i r
      +CA---VNZ | R0:0100 R1:0302 R2:0504 R3:0706
      +00---000 | R4:0908 R5:0b0a R6:0d0c SP:0100 ES:0000  DS:0000
      + ? 0x0302 02 03             ADD   R0l,[R3]
      +0> 
      +
      + +
      Registers of HC08 family
      + +
      +$ shc08
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +0> i r
      +V--HINZC  Flags= 0x60  96 `  A= 0x00   0 .
      +0--00000      H= 0x00   0 .  X= 0x00   0 .
      +SP= 0x00ff [SP+1]= 00   0 .
      + ? 0x0000 00 01 02    brset #0,*0x01,0x0005
      +0> 
      +
      + +
      + + +

      info hardware|hw identifier

      This subcommand prints out information about a unit of the controller. identifier specifies hardware element. One form of it is a name. Names of hardware elements can be checked by conf command. This form is accepted only when name is unique. If more than one element exists with the same name then name -must be followed by id number is squere brackets in same form as it is +must be followed by id number in squere brackets in same form as it is listed by conf command.

      Ouput format of this command depends on CPU family and type of the @@ -414,12 +838,12 @@ controller even in the same CPU family.

       $ s51 -t 51
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -> conf
      -ucsim version 0.2.38-pre2
      +0> conf
      +ucsim version 0.5.0-pre3
       Type of microcontroller: 51 CMOS
       Controller has 8 hardware element(s).
         timer0[0]
      @@ -430,325 +854,237 @@ Controller has 8 hardware element(s).
         port[2]
         port[3]
         irq[0]
      -Memories:
      -  ROM  size= 0x010000  65536 width=  8 class= "rom"
      -  XRAM size= 0x010000  65536 width=  8 class= "xram"
      -  IRAM size= 0x000100    256 width=  8 class= "iram"
      -  SFR  size= 0x000100    256 width=  8 class= "sfr"
      -> i h port[2]
      +  _51_dummy[0]
      +0> i h port[2]
       port[2]
       P2    11111111 0xff 255 . (Value in SFR register)
       Pin2  11111111 0xff 255 . (Output of outside circuits)
       Port2 11111111 0xff 255 . (Value on the port pins)
      -> i h t[0]
      +0> i h t[0]
       timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
      -> i h u
      +0> i h u
       uart[0] Shift, fixed clock MultiProc=none irq=dis prio=0
       Receiver OFF RB8=0 irq=0
       Transmitter TB8=0 irq=0
      -> 
      +0> 
       
      Timer #2 differs a little bit from other timers of MCS51:
       $ s51 -t 52
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +ucsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
       ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -> i h timer0
      +0> i h timer0
       timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
      -> i h t[2]
      +0> i h t[2]
       timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
      -> 
      +0> 
       
      +
      -

      timer a|d|g|r|s|v id [value]

      - -Handling of timers. First parameter of timer command determines the -operation which can be - -
      add (or simply a)
      to create a new timer. New timers -are turned ON by default and initialized to value 0. - -
      del (or simply d)
      to remove a timer if you don't need -it any more. - -
      get (or simply g)
      to get value of timers. See comment -below. - -
      run (or simply r)
      to turn a timer ON. - -
      stop (or simply s)
      to turn a timer OFF. It still exist -but doesn't count xtal periods. - -
      value (or simply v)
      to set value of the timer (number -of xtal periods). `param' is the new value. -
      +

      info stack

      -id can be a number or a string. Timers are numbered from 1. You -can use any number greater than 0 to identify a timer. Or you can use -a simbolic name, in this case simulator uses the first unused number -to allocate a new timer: +This command prints out information about data stored in the CPU's +stack and operations which put them there.
      -> tim a 3
      -> tim g 0
      -timer #0("time") ON: 0.463255 sec (5123232 clks)
      -timer #0("isr") ON: 0.0051888 sec (57384 clks)
      -timer #3("unnamed") ON: 0 sec (0 clks)
      -> tim a "a"
      -> tim g 0
      -timer #0("time") ON: 0.463255 sec (5123232 clks)
      -timer #0("isr") ON: 0.0051888 sec (57384 clks)
      -timer #1("a") ON: 0 sec (0 clks)
      -timer #3("unnamed") ON: 0 sec (0 clks)
      -> 
      +$ s51 ~/remo.hex
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +This is free software, and you are welcome to redistribute it
      +under certain conditions; type `show c' for details.
      +55470 words read from /home/staff/drdani/remo.hex
      +0> set opt irq_stop true
      +0> r
      +Simulation started, PC=0x000000
      +Stop at 0x000023: (2) Interrupt
      +F 0x000023
      +0> i s
      +OP   SP before-after   L DATA/ADDR   INSTRUCTION
      +call 0x000022-0x000024 2 0x002976    0x022a 12 29 76 LCALL 2976
      +call 0x000024-0x000026 2 0x002379    0x2976 12 23 79 LCALL 2379
      +call 0x000026-0x000028 2 0x003612    0x2517 12 36 12 LCALL 3612
      +intr 0x000028-0x00002a 2 0x000023    0x366f 20 0c 02 JB    21.4,3674
      +0> 
       
      -If you use 0 as timer id in "get" operation, simulator prints out -value of all timers including predefined ones. - - -

      set

      - -This command can be used to set various kind of things. It requires a -subcommand to specify what is going to be set. Known subcommands are: - -

      set memory -
      set bit -
      set port -
      set option - +First column shows the operation which can be call or +push or intr (interrupt call). Next column contains +value of the SP register before and after the operation. Column "L" +shows size of the data, and the next column the data itself. Note, +that for call operations (call, and intr) the called address is +printed, not the pushed one! Last column is the instruction which has +been executed when the operation occured. -

      set memory memory_type address -data...

      +
      -This command can be used to modify content of any simulated -memory. First parameter must be a class name to specify type of -memory. Class names can de checked by conf command. -

      Second parameter specifies start address of the modification. +

      info memory

      -

      Remaining parameters will be written into the memory starting at -address specified by second parameter. Data list can include numbers -as well as strings. See syntax for more -details. -q -

      Modified memory locations are dumped out. +This command shows information about memory +system: chips, address spaces and address decoders.

       $ s51
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -> set mem x 1 "ab\tcd\0ef\012ghq" 2 "ABC"
      -0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
      -0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
      -> set mem sfr pcon 0x34
      -0x87 34                      4
      -> 
      - +0> i m +Memory chips: + 0x000000-0x010000 65536 rom_chip (8,%02x,0x%04x) + 0x000000-0x000080 128 iram_chip (8,%02x,0x%02x) + 0x000000-0x010000 65536 xram_chip (8,%02x,0x%04x) + 0x000000-0x000080 128 sfr_chip (8,%02x,0x%02x) +Address spaces: + 0x000000-0x010000 65536 rom (8,%02x,0x%04x) + 0x000000-0x000080 128 iram (8,%02x,0x%02x) + 0x000080-0x000080 128 sfr (8,%02x,0x%02x) + 0x000000-0x010000 65536 xram (8,%02x,0x%04x) +Address decoders: + 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated + 0 iram 0x00 0x7f -> iram_chip 0x00 activated + 0 sfr 0x80 0xff -> sfr_chip 0x00 activated + 0 xram 0x0000 0xffff -> xram_chip 0x0000 activated +0> + -

      set bit address 0|1

      +First column shows address ranges, next one is the size followed by +the name of the memory. This name can be used in other commands (such +as dump, set +memory, etc.). Last column shows some technical information +(width in bits, format specifier to print out content and address). -Set one bit to 0 or 1. First parameter specifies the bit. It can be -the address of the bit (number or syqmbolic name) or it can be -specified in address.bitnumber format where -address addresses SFR area and bitnumber is number of -bit in specified SFR location. Using this syntax any SFR (and 8051's -internal RAM) location can be modified it need not be really bit -addressable. +

      Address decoders are associated with address spaces. Each address +space has a list of decoders. First column of the address decoder +information is the number of the decoder. Next three columns specifies +name and area of the address space which is handled by the +decoder. After "->" sign the name and the address of the memory +chip is printed where the decoder maps the area of the address space. -

      Second parameter interpreted as 1 if it is not zero. - -

      Modified memory location is dumped out. +

      Memory system of other controller family can be different.

      -$ s51 
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      +$ savr
      +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
       This is free software, and you are welcome to redistribute it
       under certain conditions; type `show c' for details.
      -> set bit tf1 1
      -0x88 80 .
      -> set bit 130 0
      -0x80 fb .
      -> set bit pcon.2 1
      -0x87 04 .
      -> set bit 10.7 1
      -0x0a 80 .
      -> 
      +0> i m
      +Memory chips:
      +  0x000000-0x00ffff    65536 rom_chip (16,%04x,0x%04x)
      +  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
      +Address spaces:
      +  0x000000-0x00ffff    65536 rom (16,%04x,0x%04x)
      +  0x000000-0x00ffff    65536 iram (8,%02x,0x%04x)
      +Address decoders:
      + 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
      + 0 iram 0x0000 0x007f -> iram_chip 0x00 activated
      +0> 
       
      +
      -

      set port hardware_id data

      +
      -This command can be used to set value of external circuits which -connected to ports of simulated controller. First parameter specifies -port number. It can be an array which specifies a hardware element or -simply a number. -
      -> set port 0 12
      -> i h po[0]
      -port[0]
      -P0    11111111 0xff 255 . (Value in SFR register)
      -Pin0  00001100 0x0c  12 . (Output of outside circuits)
      -Port0 00001100 0x0c  12 . (Value on the port pins)
      -> set port port[0] 23
      -> i h po[0]
      -port[0]
      -P0    11111111 0xff 255 . (Value in SFR register)
      -Pin0  00010111 0x17  23 . (Output of outside circuits)
      -Port0 00010111 0x17  23 . (Value on the port pins)
      -> 
      +

      timer

      +Handling of timers. Don't be confused! This command doesn't handle +timer element of the controller. It manages "clock counters" which can +be used to profile applications. -

      set option name value

      +

      Known subcommands are: -

      Set option value. Options described at (get option) command can be set using -this command. First parameter must be an option name and second the -new value. Interpretation of the value depends on type of the -option. Value for a boolean type of option interpreted as follows: if -first character of the value is one of 1, t, -T, y, Y then value will be TRUE otherwise -it will be FALSE. +

      timer add +
      timer delete +
      timer get +
      timer start +
      timer stop +
      timer set -

      -$ s51 -V
      -ucsim 0.2.38, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> get opt
      -verbose TRUE Verbose flag.
      -stopit FALSE Stop if interrupt accepted.
      -debug FALSE Debug messages appears on this console.
      -> set opt debug t
      -> get opt
      -verbose TRUE Verbose flag.
      -stopit FALSE Stop if interrupt accepted.
      -debug TRUE Debug messages appears on this console.
      -> 
      +

      Each subcommand can (some must) be followed by a timer id which can be +a number or a string. Timers are numbered from 1. You can use any +number greater than 0 to identify a timer. Or you can use a simbolic +name, in this case simulator uses the first unused number to allocate +a new timer. +

      -

      get

      +

      timer add|create|make id [direction +[in_isr]]

      -This command can be used to get value of various kind of things. It -requires a subcommand to specify what is going to be set. Known -subcommands are: +To create a new timer. New timers are turned ON by default and +initialized to value 0. Direction is an integer (can be +positive or negative) number which is added to the actual value in +every step. If in_isr is TRUE the timer counts only when +execution is in an interrupt handler. -

      get sfr -
      get option +


      -

      get sfr address...

      +

      timer delete|remove id

      -This command can be used to check values of SFR location(s) if SFR -exists in simulated memory. Note that dump memory or ds can be used as well. +To remove a timer if you don't need it any more. -

      Parameters are interpreted as SFR names or addresses and values of -addressed locations are dumped out. +


      -
      -$ s51 
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> get sfr pcon p1 0 0x80 kahd scon
      -0x87 00 .
      -0x90 ff .
      -0x00 00 .
      -0x80 ff .
      -Warning: Invalid address kahd
      -0x98 00 .
      -> 
      +

      timer get [id]

      -

      get option name

      +To get value of timers. If you don't use timer id in this command +simulator prints out value of all timers including predefined +ones. See example below. -Get actual value of option(s). Some options can be set by set option to modify behavior of the -simulator. Using get option you can get actual value of these -options. If you use this command without parameter you get list of all -options known by the program. In this way you can figure out which -options can be used. +
      -
      -$ s51 -V
      -ucsim 0.2.38, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> get opt
      -verbose TRUE Verbose flag.
      -stopit FALSE Stop if interrupt accepted.
      -debug FALSE Debug flag.
      -> get opt stopit
      -stopit FALSE Stop if interrupt accepted.
      -> 
      -This version of the simulator knows about three options. First element -of the list is name of the option (verbose, debug and -stopit). This name can be used to identify the option in -gopt and set option -command. Second element of the list is the value of the option. In -this case type of both options is boolean, their value can be TRUE or -FALSE. Third element is a short description of the option. +

      timer start|run id

      -
      verbose
      ? +To turn a timer ON. -
      debug
      Debug flag can be set by -V option of the -program to TRUE otherwise its default value is FALSE. If it is TRUE, -the simulator prints out short messages about important events. +
      -
      stopit
      Setting this option to TRUE (default value is -FALSE) forces execution to stop every time when CPU accepts an -interrupt. You do not have to use breakpoints to inspect interrupts. -
      +

      timer stop id

      + +To turn a timer OFF. It still exist but doesn't count xtal periods. +
      -

      fill memory_type start end data

      -Fill memory region with specified data. First parameter specifies -memory. Class name of the memory must be used, it can be checked using -conf command which lists size and -class name of all available memories. +

      timer set|value id value

      -

      start and end parameters specify first and last -address of the memory region to be filled. +To set value of the timer (number of xtal periods). value is +the new value. -

      data parameter specifies the data which is used to fill the -memory region.

      -$ s51 
      -ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
      -ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
      -This is free software, and you are welcome to redistribute it
      -under certain conditions; type `show c' for details.
      -> fill x 12 0x12 0x56
      -> dump x 0 0x20
      -0x0000 00 00 00 00 00 00 00 00 ........
      -0x0008 00 00 00 00 56 56 56 56 ....VVVV
      -0x0010 56 56 56 00 00 00 00 00 VVV.....
      -0x0018 00 00 00 00 00 00 00 00 ........
      -0x0020 00                      .
      -> 
      +0> tim a 3 +0> tim g +timer #0("time") ON: 0.463255 sec (5123232 clks) +timer #0("isr") ON: 0.0051888 sec (57384 clks) +timer #0("idle") ON,ISR: 0 sec (0 clks) +timer #3("unnamed") ON: 0 sec (0 clks) +0> tim a "a" +0> tim g +timer #0("time") ON: 0.463255 sec (5123232 clks) +timer #0("isr") ON: 0.0051888 sec (57384 clks) +timer #0("idle") ON,ISR: 0 sec (0 clks) +timer #1("a") ON: 0 sec (0 clks) +timer #3("unnamed") ON: 0 sec (0 clks) +0> + +

      + diff --git a/sim/ucsim/doc/cmd_removed.html b/sim/ucsim/doc/cmd_removed.html index f9376994..b4130b7b 100644 --- a/sim/ucsim/doc/cmd_removed.html +++ b/sim/ucsim/doc/cmd_removed.html @@ -1,11 +1,11 @@ -Removed commands of uCsim +Removed commands of µCsim -

      Removed commands of uCsim

      +

      Removed commands of µCsim

      @@ -584,8 +584,6 @@ Port2 11111111 0xff 255 . Port3 11110111 0xf7 247 . 000088 TR1 1 > - -

      sp port data

      diff --git a/sim/ucsim/doc/cmd_set.html b/sim/ucsim/doc/cmd_set.html index 053627a2..fa96645a 100644 --- a/sim/ucsim/doc/cmd_set.html +++ b/sim/ucsim/doc/cmd_set.html @@ -1,6 +1,6 @@ -Set commands of uCsim +Set commands of µCsim diff --git a/sim/ucsim/doc/commref.html b/sim/ucsim/doc/commref.html index f50252cc..c77ed6b7 100644 --- a/sim/ucsim/doc/commref.html +++ b/sim/ucsim/doc/commref.html @@ -1,6 +1,6 @@ -UCSIM: Command Reference +µCsim: Command Reference diff --git a/sim/ucsim/doc/cpu_types.html b/sim/ucsim/doc/cpu_types.html index 5c8820b7..75886a5c 100644 --- a/sim/ucsim/doc/cpu_types.html +++ b/sim/ucsim/doc/cpu_types.html @@ -1,6 +1,6 @@ -UCSIM: CPU types +µCsim: CPU types diff --git a/sim/ucsim/doc/index.html b/sim/ucsim/doc/index.html index 726c1762..4836fac0 100644 --- a/sim/ucsim/doc/index.html +++ b/sim/ucsim/doc/index.html @@ -18,12 +18,14 @@ developer ]

      Software simulator for microcontrollers

      -uCsim can be used to simulate microcontrollers. It -supports MCS51 family. AVR and Z80 support is under development. +µCsim can be used to simulate microcontrollers. It +supports MCS51 family. AVR core, Z80, HC08 and XA are supported by +UNIX version only.

      Download

      -Simulator is available for two platforms: DOS and UNIX but DOS version +Simulator is available for two platforms: DOS (MCS51 only) +and UNIX but DOS version is not supported any more. DOS version is not finished so I call it demo version and it is available in binary only. Limitations of DOS version are: @@ -74,9 +76,10 @@ subdirectory.
    • Compile the package with make command. -
    • Install executable s51 to any directory you want. It can be -done with make install command which will place files -in installation directory specified with --prefix=dir option of configure. Note that you may have to have special privilege to do this if installation directory is not writable by you. @@ -136,9 +139,13 @@ debugger interfaces.
    • Serial interfaces.
      The simulator can virtually connect a terminal to serial interface of the simulated CPU. +
    • Memory simulation.
      Simulated CPU +provides address spaces, storage is simulated by memory chips, address +decoders conects them together. +
    • Command syntax and command reference. (Now updated up to -0.2.38)
      The simulator can be controlled via a command line +0.5.0)
      The simulator can be controlled via a command line interface. It accepts simple commands.
    diff --git a/sim/ucsim/doc/invoke.html b/sim/ucsim/doc/invoke.html index 024b138e..58f1affd 100644 --- a/sim/ucsim/doc/invoke.html +++ b/sim/ucsim/doc/invoke.html @@ -1,6 +1,6 @@ -UCSIM: Invokation +µCsim: Invokation @@ -13,6 +13,8 @@ families:

    MCS51 family is simulated by s51
    AVR family is simulated by savr
    Z80 processor is simulated by sz80 +
    XA family is simulated by sxa +
    HC08 processor is simulated by shc08

    The simulator can be started in the following way: @@ -56,8 +58,8 @@ computer.

    -Z portnum
    Listen for incoming connections on port portnum. Using this -option uCsim can serve multiple consoles. You can get a console -by simply telnet into machine running uCsim to port +option µCsim can serve multiple consoles. You can get a console +by simply telnet into machine running µCsim to port portnumber. This option is not available on platforms which doesn't support BSD networking. @@ -75,7 +77,7 @@ specify a teminal with -s option.
    -S in=file,out=file
    Using this option you can specify different files for input and -output streams that uCsim uses to simulate microprocessor's +output streams that µCsim uses to simulate microprocessor's serial interface.
    See more about serial interface diff --git a/sim/ucsim/doc/mulcons.html b/sim/ucsim/doc/mulcons.html index 771c47c5..a5888da0 100644 --- a/sim/ucsim/doc/mulcons.html +++ b/sim/ucsim/doc/mulcons.html @@ -1,6 +1,6 @@ -UCSIM: Multiple Consoles +µCsim: Multiple Consoles @@ -20,7 +20,7 @@ command during the simulated program is executed. then will listen and wait for network connection requests and provide console functions for network connections. -

    To run uCsim in the background you have to use To run µCsim in the background you have to use -Z option for the simulator:

    diff --git a/sim/ucsim/doc/serial.html b/sim/ucsim/doc/serial.html
    index 7707d7cb..77664466 100644
    --- a/sim/ucsim/doc/serial.html
    +++ b/sim/ucsim/doc/serial.html
    @@ -1,6 +1,6 @@
     
     
    -UCSIM: Serial Interafces
    +µCsim: Serial Interafces
     
     
     
    diff --git a/sim/ucsim/doc/syntax.html b/sim/ucsim/doc/syntax.html
    index cd4f62a0..cf61ae8d 100644
    --- a/sim/ucsim/doc/syntax.html
    +++ b/sim/ucsim/doc/syntax.html
    @@ -1,56 +1,462 @@
     
     
    -Command syntax of uCsim
    +Command syntax of µCsim
     
     
     
     
    -

    Command syntax of uCsim

    +Content: -

    Command names

    + + + +

    Command syntax of µCsim

    + +µCsim uses a very simple command interpreter. Command can be entered +after µCsim displays the prompt and interpreted when ENTER key is +pressed. Commands must start with the name of the command following +parameters. Name of the command can be abbreviated if abbreviation is +unique. Some commands have more than one names. + +

    Syntacticaly parameters can be a string, bit name, array, number or +symbol. Interpretation of these syntactical elements depends on actual +command. + +

    If the command line can not be recognized as a known command, +µCsim tries to evaluate the command line as an +expression. See below for information about +operands and operators which can be used in expressions. + + +

    Command names

    + +Name of the command must be the first word of the command line. It is +not necessary to enter whole name if abbreviation is unique. Help +command can be used to check out if a command has more names: + +
    +> help run
    +run [start [stop]] Go
    +Names of command: go r run
    +...
    +
    + +Some commands just groups other commands. These commands have a set of +so-called sub-commands. Sub-command must be second word in the +command line. For example: + +
    +> help set
    +set subcommand     Set, see `set' command for more help
    +Names of command: set
    +long help of set
    +> set
    +"set" must be followed by the name of a subcommand
    +List of subcommands:
    +set option name|nr value
    +                   Set value of an option
    +set error on|off|unset
    +                   Set value of an error
    +set memory memory_type address data...
    +                   Place list of data into memory
    +set bit addr 0|1   Set specified bit to 0 or 1
    +set hardware cathegory params...
    +                   Set parameters of specified hardware element
    +

    Type of parameters

    -

    String

    +

    String type

    -

    Bit

    +To distinguish strings and symbols, strings can be sorrounded by +(double) quotes. Quotes can be omitted if command parameter is +interpreted as string and actual parameter start with a letter (so it +doesn't look to be a number) and doesn't contain space. Let's look an +example: -

    Array

    +
    +0> set opt 7 s51>
    +0s51>set opt 7 ".s51> "
    +0.s51> 
    +
    -

    Number

    -

    Some commands accept parameters which in most cases can be +

    Bit type

    + +If parameter contains a dot (.) it is treated as bit +specification. Part before the dot gives memory address and part after +the dot means bit number in the specified data. + +
    +0> dump p1.1
    +      P1.1 0x90 ff 1
    +0> dump 0x80.1
    +      P4.1 0x80 ff 1
    +0> 
    +
    + + +

    Array type

    + +Parameters contain [ character are treated as arrays. Arrays can be +used to specify hardware elements. Array index selects an object if +more than one exists: + +
    +0> info hw port[0]
    +port[0]
    +P0    11111111 0xff 255 . (Value in SFR register)
    +Pin0  11111111 0xff 255 . (Output of outside circuits)
    +Port0 11111111 0xff 255 . (Value on the port pins)
    +0> 
    +
    + + +

    Number type

    + +Some commands accept parameters which in most cases can be numbers. Numbers can be entered in C-style form. If the number begins whith 0x or 0X it is interpreted as a hexadecimal number. If it begins with 0 followed by digits it is interpreted as octal number. In other cases it is interpreted as decimal number. -

    Symbol

    + +

    Symbol type

    + +If a command parameter can not be classified in other ways (doesn't +start with a digit or a quote, doesn't contain dot or [) then it will +be treated as a symbol. Symbols can be interpreted in several +ways.

    Interpretation of parameters

    -

    Address

    -

    Number

    +

    Address parameters

    + +Many commands requires memory addresses as parameters. Addresses can +be specified using number or symbol type of parameters. Value of +symbols depends on processor type. For example MCS52 family of +controllers defines more symbols than MCS51 family. + + +

    Number, data parameters

    + +When a command expects a number it should get a number. Note, that symbols is not converted to number they +can be used as address only! + + +

    String parameters

    + +Strings can be entered without quotes if they are recognized as +srtings (see above) and do not contain spaces. + + +

    Data list parameters

    + +Data list can be any space separated list of numbers and strings. If +you include a string in the list, it is broken to list of bytes where +every byte is ASCII code of a string's character. + +
    +> where xram "ab" 0x43
    +0xf961 61 62 63                abc
    +> 
    +
    + + +

    Memory parameters

    + +Where memory type is expected, name of the memory should be +used. Most commands accept memory chip and address space too. See +memory simulation for more information. + + +

    Hardware element parameters

    + +Hardwer elements can be specified by using arrays, where array name is +name of the element and the array index selects one if more than one +exists. + + +

    Bit parameters

    + +Bits can be specified by several ways. One way is using bit type of +command parameter: + +
    +0> dump 0.2
    +    0x00.2 0x00 00 0
    +0> dump 0xc3.2
    +    0xc3.2 0xc3 00 0
    +0> dump p2.3
    +      P2.3 0xa0 ff 1
    +0>
    +
    + +In this way, any IRAM or SFR location can be addressed as the above +example shows. -

    Data

    +

    Other way is using bit address either by value or by symbolic name: -

    String

    +
    +0> dump ea
    +     IE0.7 0xa8 00 0
    +0> dump 34
    +    0x24.2 0x24 24 1
    +0> dump 0xc7
    +   SCON1.7 0xc0 00 0
    +0> 
    +
    -

    Data list

    +Of course, only addressable bits can be accessed in this way. -

    Memory

    +
    + + +

    Expressions

    + +If first word of the command line is not recognized as a known +command, the command line will be evaluated as an expression and the +result value printed (in decimal): + +
    +0> 12*(34+56)
    +1080
    +0> 
    +
    + + +

    Operands

    + +Operands of the expressions can be + +
    • number; + +
    • memory (either address space, or memory chip); + +
    • or bit
    + + +

    Number operands

    + +Numbers can be entered in decimal, octal (starting with 0 followed by +a number), or hexadecimal (started with 0x): + +
    +0> 12
    +12
    +0> 012
    +10
    +0> 0x12
    +18
    +0> 
    +
    + +Numbers must be integers (floating point is not supported) and not +bigger than the value which can be stored as long int. + + +

    Memory operands

    + +Memory can be an address space location or a memory chip cell. It can +be specified in following form: + +
    name[address]
    + +where name is the name of the address space or memory chip and +address is an expression specifying location (index) of the +cell. + +

    Registers in SFR address space can also be specified using +pre-defined names (symbols) of the registers. -

    Hardware element

    +
    +0> xram[0x543]
    +67
    +0> xram_chip[1347]
    +67
    +0> rom[12*(34+56)]
    +56
    +0> sp
    +7
    +0> rom[256*dph+dpl]
    +88
    +0> 
    +
    -

    Bit

    +Value of the memory operand is always a positive integer number. -

    + +

    Bit operands

    + +Bit operands are evaluated to 0 or 1. Any bit of any memory location +can be specified as bit using following form: + +
    memory.bitnumber
    + +where memory is a memory location as a memory operand and +bitnumber is number of the bit within the specified memory +cell specified as an expression. Note, that dot (.) is part of the +syntax, not an operator. + +

    Alternatively, name of the bit can be used to specify named SFR +bits. + +

    +0> p0.3
    +1
    +0> xram[12*(34+56)].9-2
    +0
    +0> it0
    +0
    +0> 
    +
    + + +

    Operators

    + + + + + + + + +
    Type Operator Meaning
    Primary ( ) Group of sub-expressions
    One operand - & Unary minus, address of
    Arithmetic * / Multiply, divide
    + - Add, substract
    Assignment = Assign to
    + +Arithmetic operators and parenthesises work as usual. + +

    Assigment operator can be used to modify memory cells and bits of +the cells. Result will be the assigned value. + +

    +0> p0=23
    +23
    +0> i h port[0]
    +port[0]
    +P0    00010111 0x17  23 . (Value in SFR register)
    +Pin0  11111111 0xff 255 . (Output of outside circuits)
    +Port0 00010111 0x17  23 . (Value on the port pins)
    +0> p0.0= 0
    +0
    +0> i h p[0]
    +port[0]
    +P0    00010110 0x16  22 . (Value in SFR register)
    +Pin0  11111111 0xff 255 . (Output of outside circuits)
    +Port0 00010110 0x16  22 . (Value on the port pins)
    +0> xram[256*dph+dpl]= rom[0]
    +108
    +0> dump rom 0 0
    +0x0000 6c                      l
    +0> dump sfr dph dph
    +0x83 00                      .
    +0> dump sfr dpl dpl
    +0x82 00                      .
    +0> dump xram 0 0
    +0x0000 6c                      l
    +0> 0x6c
    +108
    +0> dump ea
    +     IE0.7 0xa8 00 0
    +0> ea= 1111
    +1
    +0> dump ea
    +     IE0.7 0xa8 80 1
    +0> 
    +
    + +When a symbolic name of the SFR is used, it results value of the named +register not the value of the symbol. "Address of" operator can be +used to get value of the symbol. + +
    +0> dpl
    +0
    +0> &dpl
    +130
    +0> ea
    +1
    +0> &ea
    +175
    +0> 256*dph+dpl
    +46630
    +0> &xram[256*dph+dpl]
    +46630
    +0> 
    +

    + +

    Redirection

    + +Output of any command can be redirected to a file. Same syntax can be +used for this as for UNIX shell. The only difference is that +µCsim doesn't allow to put redirection at the beginning of the +command! + +
    +$ s51 remo.hex
    +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
    +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    +This is free software, and you are welcome to redistribute it
    +under certain conditions; type `show c' for details.
    +55470 words read from remo.hex
    +0> dump >/tmp/rom.dump rom
    +0> quit
    +$ cat /tmp/rom.dump
    +0x0000 02 01 60 02 00 3c 06 07 ..`..<..
    +0x0008 08 09 0a 02 2f 6b 0e 0f ..../k..
    +0x0010 10 11 12 02 00 ac 16 17 ........
    +0x0018 18 19 1a 1b 1c 1d 1e 1f ........
    +0x0020 20 21 22 02 01 1c 26 27  !"...&'
    +0x0028 28 29 2a 32 2c 2d 2e 2f ()*2,-./
    +0x0030 02 0f a7 02 0e 9c 02 0d ........
    +0x0038 d2 02 08 41 c0 82 c0 83 ...A....
    +0x0040 c0 d0 c0 e0 c0 00 a2 90 ........
    +0x0048 c0 d0 c2 90 78 18 06 30 ....x..0
    +$ s51 remo.hex
    +uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
    +uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    +This is free software, and you are welcome to redistribute it
    +under certain conditions; type `show c' for details.
    +55470 words read from remo.hex
    +0> dump rom 0x50 >>/tmp/rom.dump
    +0> quit
    +$ cat /tmp/rom.dump
    +0x0000 02 01 60 02 00 3c 06 07 ..`..<..
    +0x0008 08 09 0a 02 2f 6b 0e 0f ..../k..
    +0x0010 10 11 12 02 00 ac 16 17 ........
    +0x0018 18 19 1a 1b 1c 1d 1e 1f ........
    +0x0020 20 21 22 02 01 1c 26 27  !"...&'
    +0x0028 28 29 2a 32 2c 2d 2e 2f ()*2,-./
    +0x0030 02 0f a7 02 0e 9c 02 0d ........
    +0x0038 d2 02 08 41 c0 82 c0 83 ...A....
    +0x0040 c0 d0 c0 e0 c0 00 a2 90 ........
    +0x0048 c0 d0 c2 90 78 18 06 30 ....x..0
    +0x0050 03 4b 20 92 48 30 07 05 .K .H0..
    +0x0058 c2 07 02 00 9d 30 08 05 .....0..
    +0x0060 20 93 3a c2 08 90 08 60  .:....`
    +0x0068 e0 b4 ff 03 02 00 9d 04 ........
    +0x0070 f0 14 f8 03 03 03 54 1f ......T.
    +0x0078 90 08 62 25 82 f5 82 e5 ..b%....
    +0x0080 83 34 00 f5 83 e8 54 07 .4....T.
    +0x0088 f8 08 74 80 23 d8 fd f8 ..t.#...
    +0x0090 e0 30 93 07 c8 f4 58 f0 .0....X.
    +0x0098 02 00 9d 48 f0 d0 d0 92 ...H....
    +$ 
    +
    + + +
    + + diff --git a/sim/ucsim/error.cc b/sim/ucsim/error.cc index 7f3fa5d6..a8c533bb 100644 --- a/sim/ucsim/error.cc +++ b/sim/ucsim/error.cc @@ -7,42 +7,208 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ +#include +#include "i_string.h" + // prj (local) #include "errorcl.h" +#include "globals.h" +#include "utils.h" // cmd.src #include "newcmdcl.h" +struct id_element error_on_off_names[]= { + { ERROR_PARENT, "unset" }, + { ERROR_ON , "on" }, + { ERROR_OFF , "off" }, + { 0 , 0 } +}; + +class cl_error_class error_class_base(err_error, "non-classified", ERROR_ON); + +class cl_list *registered_errors= NIL; + +/* + */ + +cl_error_class::cl_error_class(enum error_type typ, char *aname): + cl_base() +{ + type= typ; + on= ERROR_PARENT; + set_name(aname, "not-known"); + if (!registered_errors) + registered_errors= new cl_list(2, 2, "registered errors"); + registered_errors->add(this); +} + +cl_error_class::cl_error_class(enum error_type typ, char *aname, + enum error_on_off be_on): + cl_base() +{ + type= typ; + on= be_on; + set_name(aname, "not-known"); + if (!registered_errors) + registered_errors= new cl_list(2, 2, "registered errors"); + registered_errors->add(this); +} + +cl_error_class::cl_error_class(enum error_type typ, char *aname, + class cl_error_class *parent): + cl_base() +{ + type= typ; + on= ERROR_PARENT; + set_name(aname, "not-known"); + if (!registered_errors) + registered_errors= new cl_list(2, 2, "registered errors"); + registered_errors->add(this); + if (parent) + parent->add_child(this); +} + +cl_error_class::cl_error_class(enum error_type typ, char *aname, + class cl_error_class *parent, + enum error_on_off be_on): + cl_base() +{ + type= typ; + on= be_on; + set_name(aname, "not-known"); + if (!registered_errors) + registered_errors= new cl_list(2, 2, "registered errors"); + registered_errors->add(this); + if (parent) + parent->add_child(this); +} + +void +cl_error_class::set_on(enum error_on_off val) +{ + if (!get_parent() && + val == ERROR_PARENT) + return; + on= val; +} + +bool +cl_error_class::is_on(void) +{ + if (on == ERROR_PARENT) + { + if (!get_parent()) + return(DD_TRUE); + class cl_error_class *p= + dynamic_cast(get_parent()); + return(p->is_on()); + } + else + return(on == ERROR_ON); +} + +enum error_type +cl_error_class::get_type(void) +{ + return(type); +} + +/*char * +cl_error_class::get_name(void) +{ + return(name); +}*/ + +char * +cl_error_class::get_type_name() +{ + return(get_id_string(error_type_names, type, "untyped")); + /*switch (type) + { + case err_unknown: return("unclassified"); break; + case err_error: return("error"); break; + case err_warning: return("warning"); break; + } + return("untyped");*/ +} + + +/* + */ cl_error::cl_error(void): cl_base() -{} +{ + //type= err_unknown; + classification= 0; +} cl_error::~cl_error(void) {} +int +cl_error::init(void) +{ + //type= get_type(); + return(0); +} + +enum error_type +cl_error::get_type(void) +{ + if (classification) + return(classification->get_type()); + return(err_unknown); +} + +enum error_on_off +cl_error::get_on(void) +{ + if (!classification) + return(ERROR_ON); + return(classification->get_on()); +} + +bool +cl_error::is_on(void) +{ + if (!classification) + return(DD_TRUE); + return(classification->is_on()); +} + void cl_error::print(class cl_commander *c) { - c->dd_printf("Error\n"); + c->dd_printf("%s\n", get_type_name()); +} + +char * +cl_error::get_type_name() +{ + enum error_type type= get_type(); + return(get_id_string(error_type_names, type, "untyped")); } diff --git a/sim/ucsim/errorcl.h b/sim/ucsim/errorcl.h index 99f83e81..8e0461f7 100644 --- a/sim/ucsim/errorcl.h +++ b/sim/ucsim/errorcl.h @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #ifndef ERRORCL_HEADER @@ -32,22 +34,101 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "pobjcl.h" #include "stypes.h" -// cmd.src -//#include "newcmdcl.h" +extern struct id_element error_on_off_names[]; + +enum error_on_off { + ERROR_PARENT, + ERROR_ON, + ERROR_OFF +}; + +const int err_stop= (err_unknown|err_error); + +/* +#define ERROR_METHODS(NAME) \ +enum error_type \ +cl_error_##NAME ::get_type(void)\ +{\ + return(err_##NAME##_class.get_type());\ +}\ +bool \ +cl_error_##NAME ::is_on(void)\ +{\ + return(err_##NAME##_class.is_on());\ +} +*/ + +#define ERROR_CLASS_DECL(NAME) \ +extern class cl_error_class error_##NAME##_class;\ +class cl_error_##NAME + +/* +#define ERROR_CLASS_DEF(TYPE,NAME,CLASS_NAME) \ +class cl_error_class error_##NAME##_class(TYPE, CLASS_NAME); +*/ +/* +#define ERROR_CLASS_DEF_ON(TYPE,NAME,CLASS_NAME,ON) \ +class cl_error_class error_##NAME##_class(TYPE, CLASS_NAME, ON); +*/ + +#define ERROR_CLASS_DEF_PARENT(TYPE,NAME,CLASS_NAME,PARENT) \ +class cl_error_class error_##NAME##_class(TYPE, CLASS_NAME, &(PARENT)); + +#define ERROR_CLASS_DEF_PARENT_ON(TYPE,NAME,CLASS_NAME,PARENT,ON) \ +class cl_error_class error_##NAME##_class(TYPE, CLASS_NAME, &(PARENT), ON); + + +extern class cl_list *registered_errors; + +class cl_error_class: public cl_base +{ +protected: + enum error_type type; + //char *name; + enum error_on_off on; +public: + cl_error_class(enum error_type typ, char *aname); + cl_error_class(enum error_type typ, char *aname, + enum error_on_off be_on); + cl_error_class(enum error_type typ, char *aname, + class cl_error_class *parent); + cl_error_class(enum error_type typ, char *aname, + class cl_error_class *parent, + enum error_on_off be_on); + + enum error_on_off get_on(void) { return(on); } + void set_on(enum error_on_off val); + bool is_on(void); + enum error_type get_type(void); + char *get_type_name(void); + //char *get_name(void); +}; + +extern class cl_error_class error_class_base; class cl_commander; //forward class cl_error: public cl_base { +protected: + class cl_error_class *classification; public: bool inst; // Occured during instruction execution t_addr PC; // Address of the instruction public: cl_error(void); virtual ~cl_error(void); + virtual int init(void); + +public: + virtual enum error_type get_type(void); + virtual enum error_on_off get_on(void); + virtual bool is_on(void); + virtual class cl_error_class *get_class(void) { return(classification); } virtual void print(class cl_commander *c); + virtual char *get_type_name(); }; diff --git a/sim/ucsim/eventcl.h b/sim/ucsim/eventcl.h new file mode 100644 index 00000000..fa0c5254 --- /dev/null +++ b/sim/ucsim/eventcl.h @@ -0,0 +1,16 @@ +/*@1@*/ + +#ifndef EVENTCL_HEADER +#define EVENTCL_HEADER + + +enum event { + ev_nothing = 0x00000000, + + ev_address_space_added = 0x00000001 +}; + + +#endif + +/* End of eventcl.h */ diff --git a/sim/ucsim/globals.cc b/sim/ucsim/globals.cc index 1c8b9282..d6d93583 100644 --- a/sim/ucsim/globals.cc +++ b/sim/ucsim/globals.cc @@ -66,6 +66,12 @@ struct id_element cpu_states[]= { { 0, 0 } }; +struct id_element error_type_names[]= { + { err_unknown, "unclassified" }, + { err_error, "error" }, + { err_warning, "warning" } +}; + char *warranty= " NO WARRANTY\n" @@ -88,7 +94,8 @@ char *warranty= "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n" "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n" "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n" -"POSSIBILITY OF SUCH DAMAGES.\n"; +"POSSIBILITY OF SUCH DAMAGES.\n" +; char *copying= @@ -275,7 +282,7 @@ char *copying= "signed it. However, nothing else grants you permission to modify or\n" "distribute the Program or its derivative works. These actions are\n" "prohibited by law if you do not accept this License. Therefore, by\n" -"modifying or distributing the Program (or any work based on the\n" +"odifying or distributing the Program (or any work based on the\n" "Program), you indicate your acceptance of this License to do so, and\n" "all its terms and conditions for copying, distributing or modifying\n" "the Program or works based on it.\n" @@ -347,7 +354,58 @@ char *copying= "Software Foundation, write to the Free Software Foundation; we sometimes\n" "make exceptions for this. Our decision will be guided by the two goals\n" "of preserving the free status of all derivatives of our free software and\n" -"of promoting the sharing and reuse of software generally.\n"; +"of promoting the sharing and reuse of software generally.\n" +; + + +/* + * Information about different type of CPUs + */ + +struct cpu_entry *cpus= NIL; + +struct cpu_entry cpus_51[]= +{ + {"51" , CPU_51, CPU_HMOS}, + {"8051" , CPU_51, CPU_HMOS}, + {"8751" , CPU_51, CPU_HMOS}, + {"C51" , CPU_51, CPU_CMOS}, + {"80C51" , CPU_51, CPU_CMOS}, + {"87C51" , CPU_51, CPU_CMOS}, + {"31" , CPU_31, CPU_HMOS}, + {"8031" , CPU_31, CPU_HMOS}, + {"C31" , CPU_31, CPU_CMOS}, + {"80C31" , CPU_31, CPU_CMOS}, + + {"52" , CPU_52, CPU_HMOS}, + {"8052" , CPU_52, CPU_HMOS}, + {"8752" , CPU_52, CPU_HMOS}, + {"C52" , CPU_52, CPU_CMOS}, + {"80C52" , CPU_52, CPU_CMOS}, + {"87C52" , CPU_52, CPU_CMOS}, + {"32" , CPU_32, CPU_HMOS}, + {"8032" , CPU_32, CPU_HMOS}, + {"C32" , CPU_32, CPU_CMOS}, + {"80C32" , CPU_32, CPU_CMOS}, + + {"51R" , CPU_51R, CPU_CMOS}, + {"51RA" , CPU_51R, CPU_CMOS}, + {"51RB" , CPU_51R, CPU_CMOS}, + {"51RC" , CPU_51R, CPU_CMOS}, + {"C51R" , CPU_51R, CPU_CMOS}, + {"C51RA" , CPU_51R, CPU_CMOS}, + {"C51RB" , CPU_51R, CPU_CMOS}, + {"C51RC" , CPU_51R, CPU_CMOS}, + + {"89C51R", CPU_89C51R, CPU_CMOS}, + + {"251" , CPU_251, CPU_CMOS}, + {"C251" , CPU_251, CPU_CMOS}, + + {"DS390" , CPU_DS390, CPU_CMOS}, + {"DS390F", CPU_DS390F, CPU_CMOS}, + {NULL, 0, 0} +}; /* End of globals.cc */ diff --git a/sim/ucsim/globals.h b/sim/ucsim/globals.h index ff273b5d..45c54926 100644 --- a/sim/ucsim/globals.h +++ b/sim/ucsim/globals.h @@ -42,10 +42,16 @@ extern char delimiters[]; extern struct id_element mem_ids[]; extern struct id_element mem_classes[]; extern struct id_element cpu_states[]; +extern struct id_element error_type_names[]; +//extern char *case_string(enum letter_case lcase, const char *str); extern char *warranty; extern char *copying; +extern struct cpu_entry *cpus; +extern struct cpu_entry cpus_51[]; + + #endif /* End of globals.h */ diff --git a/sim/ucsim/gui.src/gui.cc b/sim/ucsim/gui.src/gui.cc index dbacfcf0..8565ca11 100644 --- a/sim/ucsim/gui.src/gui.cc +++ b/sim/ucsim/gui.src/gui.cc @@ -32,7 +32,7 @@ cl_gui::cl_gui(class cl_sim *asim): cl_base() { sim= asim; - ifs= new cl_list(2, 2); + ifs= new cl_list(2, 2, "ifs of a gui"); } cl_gui::~cl_gui(void) diff --git a/sim/ucsim/gui.src/serio.src/Makefile.in b/sim/ucsim/gui.src/serio.src/Makefile.in index 9c71adcd..7afa286e 100644 --- a/sim/ucsim/gui.src/serio.src/Makefile.in +++ b/sim/ucsim/gui.src/serio.src/Makefile.in @@ -17,7 +17,7 @@ M_OR_MM = @M_OR_MM@ LIBS = @CURSES_LIBS@ @LIBS@ -EXEEXT = @EXEEXT@ +EXEEXT = @EXEEXT@ curses_ok = @curses_ok@ diff --git a/sim/ucsim/gui.src/serio.src/main.cc b/sim/ucsim/gui.src/serio.src/main.cc index 5293a174..98ea1bd0 100644 --- a/sim/ucsim/gui.src/serio.src/main.cc +++ b/sim/ucsim/gui.src/serio.src/main.cc @@ -2,6 +2,8 @@ * to emulate the serial input and output of an 8051 controller * * main.cc - the main stuff * ******************************************************************************/ +#include "ddconfig.h" + #include #include #include @@ -92,7 +94,7 @@ int main(int argc, char **argv) if(string[0] != 0) fobj->SendByte(string[0]); - + if(fobj->RecvStr(string) > 0) view->AddStrOutWin(string); diff --git a/sim/ucsim/hc08.src/Makefile.in b/sim/ucsim/hc08.src/Makefile.in index 3759862a..8b62d78e 100644 --- a/sim/ucsim/hc08.src/Makefile.in +++ b/sim/ucsim/hc08.src/Makefile.in @@ -26,7 +26,7 @@ SHAREDLIB = @SHAREDLIB@ EXEEXT = @EXEEXT@ -LIBS = @LIBS@ -L$(PRJDIR) -lutil -lsim -lutil -lcmd -lguiucsim +LIBS = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lutil -lsim -lcmd -lguiucsim -Wl,--end-group DL = @DL@ dl_ok = @dl_ok@ diff --git a/sim/ucsim/hc08.src/hc08.cc b/sim/ucsim/hc08.src/hc08.cc index 06af92c9..3550cbb9 100644 --- a/sim/ucsim/hc08.src/hc08.cc +++ b/sim/ucsim/hc08.src/hc08.cc @@ -74,7 +74,7 @@ cl_hc08::init(void) xtal = 8000000; - rom= mem(MEM_ROM); + rom= address_space(MEM_ROM_ID); // ram= mem(MEM_XRAM); ram= rom; @@ -112,7 +112,7 @@ cl_hc08::id_string(void) /* * Making elements of the controller */ - +/* t_addr cl_hc08::get_mem_size(enum mem_class type) { @@ -124,7 +124,7 @@ cl_hc08::get_mem_size(enum mem_class type) } return(cl_uc::get_mem_size(type)); } - +*/ void cl_hc08::mk_hw_elements(void) { @@ -132,6 +132,27 @@ cl_hc08::mk_hw_elements(void) /* t_uc::mk_hw() does nothing */ } +void +cl_hc08::make_memories(void) +{ + class cl_address_space *as; + + as= new cl_address_space("rom", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); +} + /* * Help command interpreter @@ -199,12 +220,12 @@ cl_hc08::get_disasm_info(t_addr addr, int start_addr = addr; struct dis_entry *dis_e; - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); dis_e = NULL; switch(code) { case 0x9e: /* ESC code to sp relative op-codes */ - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_hc08_9e[i].mask) != disass_hc08_9e[i].code && disass_hc08_9e[i].mnemonic) @@ -272,46 +293,46 @@ cl_hc08::disass(t_addr addr, char *sep) switch (*(b++)) { case 's': // s signed byte immediate - sprintf(temp, "#%d", (char)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "#%d", (char)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case 'w': // w word immediate operand sprintf(temp, "#0x%04x", - (uint)((get_mem(MEM_ROM, addr+immed_offset)<<8) | - (get_mem(MEM_ROM, addr+immed_offset+1))) ); + (uint)((get_mem(MEM_ROM_ID, addr+immed_offset)<<8) | + (get_mem(MEM_ROM_ID, addr+immed_offset+1))) ); ++immed_offset; ++immed_offset; break; case 'b': // b byte immediate operand - sprintf(temp, "#0x%02x", (uint)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "#0x%02x", (uint)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case 'x': // x extended addressing sprintf(temp, "0x%04x", - (uint)((get_mem(MEM_ROM, addr+immed_offset)<<8) | - (get_mem(MEM_ROM, addr+immed_offset+1))) ); + (uint)((get_mem(MEM_ROM_ID, addr+immed_offset)<<8) | + (get_mem(MEM_ROM_ID, addr+immed_offset+1))) ); ++immed_offset; ++immed_offset; break; case 'd': // d direct addressing - sprintf(temp, "*0x%02x", (uint)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "*0x%02x", (uint)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case '2': // 2 word index offset sprintf(temp, "0x%04x", - (uint)((get_mem(MEM_ROM, addr+immed_offset)<<8) | - (get_mem(MEM_ROM, addr+immed_offset+1))) ); + (uint)((get_mem(MEM_ROM_ID, addr+immed_offset)<<8) | + (get_mem(MEM_ROM_ID, addr+immed_offset+1))) ); ++immed_offset; ++immed_offset; break; case '1': // b byte index offset - sprintf(temp, "0x%02x", (uint)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "0x%02x", (uint)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case 'p': // b byte index offset sprintf(temp, "0x%04x", addr+immed_offset+1 - +(char)get_mem(MEM_ROM, addr+immed_offset)); + +(char)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; default: @@ -569,10 +590,11 @@ cl_hc08::exec_inst(void) default: return(resHALT); } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + PC= rom->inc_address(PC, -1); sim->stop(resINV_INST); return(resINV_INST); diff --git a/sim/ucsim/hc08.src/hc08cl.h b/sim/ucsim/hc08.src/hc08cl.h index eae0bb23..35efadf8 100644 --- a/sim/ucsim/hc08.src/hc08cl.h +++ b/sim/ucsim/hc08.src/hc08cl.h @@ -40,16 +40,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_hc08: public cl_uc { public: - cl_mem *ram; - cl_mem *rom; + class cl_memory *ram; + class cl_memory *rom; struct t_regs regs; public: cl_hc08(class cl_sim *asim); virtual int init(void); virtual char *id_string(void); - virtual t_addr get_mem_size(enum mem_class type); + //virtual t_addr get_mem_size(enum mem_class type); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual struct dis_entry *dis_tbl(void); virtual int inst_length(t_addr addr); diff --git a/sim/ucsim/libtool b/sim/ucsim/libtool new file mode 100755 index 00000000..4f5a9019 --- /dev/null +++ b/sim/ucsim/libtool @@ -0,0 +1,5315 @@ +#! /bin/sh + +# libtool - Provide generalized library-building support services. +# Generated automatically by (GNU 0.5.2) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host p4: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# The default C compiler. +CC="gcc" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# A symbol stripping program +STRIP=strip + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC" +pic_mode=default + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Can we write directly to a .lo ? +compiler_o_lo="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}.so\$versuffix \${libname}\${release}.so\$major \$libname.so" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}.so\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGISTW][ABCDGISTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern char \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | sed 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL CONFIG + +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | no/*-*-nonstopux*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test $linkmode = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test $pass = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test $pass = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test $pass = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test $pass != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test $pass = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test $linkmode != prog && test $linkmode != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test $pass = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test $pass = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test $linkmode = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test $linkmode = prog && test $pass != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test $linkalldeplibs = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + + if test $linkmode = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test $linkmode = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test $linkmode = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test $linkmode = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test $linkmode = lib; then + if test -n "$dependency_libs" && + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test $pass = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + major=`expr $current - $age + 1` + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test $build_libtool_need_lc = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for file magic test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test $hardcode_into_libs = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test $need_relink = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test $need_relink = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`echo $file | sed -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = ":" && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test $mode = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test $mode = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/sim/ucsim/main_in.mk b/sim/ucsim/main_in.mk index 413f4dbe..b101d697 100644 --- a/sim/ucsim/main_in.mk +++ b/sim/ucsim/main_in.mk @@ -26,10 +26,10 @@ CFLAGS = @CFLAGS@ -I$(PRJDIR) -Wall CXXFLAGS = @CXXFLAGS@ -I$(PRJDIR) -Wall M_OR_MM = @M_OR_MM@ -EXEEXT = @EXEEXT@ +EXEEXT = @EXEEXT@ -LIB_LIST = util sim cmd sim -UCSIM_LIBS = $(patsubst %,-l%,$(LIB_LIST)) +LIB_LIST = util cmd sim +UCSIM_LIBS = -Wl,--start-group $(patsubst %,-l%,$(LIB_LIST)) -Wl,--end-group UCSIM_LIB_FILES = $(patsubst %,lib%.a,$(LIB_LIST)) prefix = @prefix@ @@ -122,19 +122,11 @@ ucsim: $(UCSIM_OBJECTS) $(UCSIM_LIB_FILES) echo $(UCSIM_LIB_FILES) $(CXX) $(CXXFLAGS) -o $@ $< -L$(PRJDIR) $(UCSIM_LIBS) +ptt: ptt.o + $(CXX) $(CXXFLAGS) -o $@ $< -lpthread .cc.o: $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ -.y.cc: - rm -f $*.cc $*.h - $(YACC) -d $< - mv y.tab.c $*.cc - mv y.tab.h $*.h - -.l.cc: - rm -f $*.cc - $(LEX) -t $< >$*.cc - # Remaking configuration # ---------------------- diff --git a/sim/ucsim/mkecho b/sim/ucsim/mkecho index 4718b7da..91ac1aa1 100755 --- a/sim/ucsim/mkecho +++ b/sim/ucsim/mkecho @@ -1,5 +1,8 @@ #!/bin/sh + if [ -f ${1}/devel ]; then shift echo "$@" fi + +# End of mkecho diff --git a/sim/ucsim/option.cc b/sim/ucsim/option.cc index 1c9ad202..45e62cf1 100644 --- a/sim/ucsim/option.cc +++ b/sim/ucsim/option.cc @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #include "ddconfig.h" @@ -42,6 +44,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "simcl.h" +/*struct id_element option_type_names[]= { + { non_opt , "non" }, + { integer_opt , "integer" }, + { float_opt , "float" }, + { bool_opt , "boolean" }, + { string_opt , "string" }, + { pointer_opt , "pointer" }, + { 0, 0 } + };*/ + /* * Base class for option's objects *____________________________________________________________________________ @@ -54,8 +66,12 @@ cl_option::cl_option(class cl_base *the_creator, char *aname, char *Ihelp): creator= the_creator; set_name(aname); help= strdup(Ihelp); - users= new cl_list(2, 2); + char *s= (char*)malloc(strlen(aname)+100); + sprintf(s, "users of option \"%s\"", aname); + users= new cl_list(2, 2, s); + free(s); memset(&value, 0, sizeof(value)); + show(); } class cl_option & @@ -153,6 +169,51 @@ cl_option::set_value(char *opt) } +void +cl_option::get_value(void **val) +{ + if (val) + *val= value.pval; +} + +void +cl_option::set_value(void *opt) +{ + value.pval= opt; + inform_users(); +} + + +void +cl_option::get_value(long *val) +{ + if (val) + *val= value.ival; +} + +void +cl_option::set_value(long opt) +{ + value.ival= opt; + inform_users(); +} + + +void +cl_option::get_value(double *val) +{ + if (val) + *val= value.fval; +} + +void +cl_option::set_value(double opt) +{ + value.fval= opt; + inform_users(); +} + + /* * List of options */ @@ -334,6 +395,36 @@ cl_options::set_value(char *the_name, cl_base *creator, char *value) return(o); } +class cl_option * +cl_options::set_value(char *the_name, cl_base *creator, void *value) +{ + class cl_option *o= get_option(the_name, creator); + + if (o) + o->set_value(value); + return(o); +} + +class cl_option * +cl_options::set_value(char *the_name, cl_base *creator, long value) +{ + class cl_option *o= get_option(the_name, creator); + + if (o) + o->set_value(value); + return(o); +} + +class cl_option * +cl_options::set_value(char *the_name, cl_base *creator, double value) +{ + class cl_option *o= get_option(the_name, creator); + + if (o) + o->set_value(value); + return(o); +} + /* * Reference to an option @@ -379,21 +470,21 @@ cl_optref::create(class cl_base *creator, case non_opt: option= 0; break; - /*case integer_opt: - option= new cl_option(creator, the_name, help); - break;*/ - /*case float_opt: - option= new cl_option(creator, the_name, help); - break;*/ + case integer_opt: + option= new cl_number_option(creator, the_name, help); + break; + case float_opt: + option= new cl_float_option(creator, the_name, help); + break; case bool_opt: option= new cl_bool_option(creator, the_name, help); break; case string_opt: option= new cl_string_option(creator, the_name, help); break; - /*case pointer_opt: - option= new cl_option(creator, the_name, help); - break;*/ + case pointer_opt: + option= new cl_pointer_option(creator, the_name, help); + break; default: option= 0; break; @@ -489,6 +580,57 @@ cl_optref::get_value(char *) } } +void * +cl_optref::get_value(void *) +{ + if (!option) + { + fprintf(stderr, "Warning: \"%s\" is sdereferencing a non-existent " + "pointer option: %s\n", object_name(owner), get_name()); + return(NIL); + } + else + { + void *p= NIL; + option->get_value(&p); + return(p); + } +} + +long +cl_optref::get_value(long) +{ + if (!option) + { + fprintf(stderr, "Warning: \"%s\" is sdereferencing a non-existent " + "number option: %s\n", object_name(owner), get_name()); + return(0); + } + else + { + long l= 0; + option->get_value(&l); + return(l); + } +} + +double +cl_optref::get_value(double) +{ + if (!option) + { + fprintf(stderr, "Warning: \"%s\" is sdereferencing a non-existent " + "float option: %s\n", object_name(owner), get_name()); + return(0); + } + else + { + double d= 0; + option->get_value(&d); + return(d); + } +} + /* * BOOL type of option @@ -558,10 +700,39 @@ cl_string_option::print(class cl_console *con) con->dd_printf("(null)"); } + /* - * Debug on console + * PONITER type of option + *____________________________________________________________________________ + * */ +cl_pointer_option::cl_pointer_option(class cl_base *the_creator, + char *aname, char *Ihelp): + cl_option(the_creator, aname, Ihelp) +{} + +class cl_option & +cl_pointer_option::operator=(class cl_option &o) +{ + set_value((o.get_value())->pval); + return(*this); +} + +void +cl_pointer_option::print(class cl_console *con) +{ + if (value.pval) + con->dd_printf("\"%p\"", value.pval); + else + con->dd_printf("(null)"); +} + + +/* + * Debug on console + */ +/* cl_cons_debug_opt::cl_cons_debug_opt(class cl_app *the_app, char *Iid, char *Ihelp): @@ -573,8 +744,7 @@ cl_cons_debug_opt::cl_cons_debug_opt(class cl_app *the_app, void cl_cons_debug_opt::print(class cl_console *con) { - if (/*sim->cmd->actual_console && - sim->cmd->actual_console*/con->flags & CONS_DEBUG) + if (con->flags & CONS_DEBUG) con->dd_printf("TRUE"); else con->dd_printf("FALSE"); @@ -613,13 +783,63 @@ cl_cons_debug_opt::set_value(char *s) if (c == '1' || c == 'T' || c == 'Y') - //app->get_commander()->actual_console->flags|= CONS_DEBUG; set_value(1); else - //app->get_commander()->actual_console->flags&= ~CONS_DEBUG; set_value(0); } } +*/ + +/* + * NUMBER type of option + *____________________________________________________________________________ + * + */ + +cl_number_option::cl_number_option(class cl_base *the_creator, + char *aname, char *Ihelp): + cl_option(the_creator, aname, Ihelp) +{} + +void +cl_number_option::print(class cl_console *con) +{ + con->dd_printf("%ld", value.ival); +} + +void +cl_number_option::set_value(char *s) +{ + if (s) + value.ival= strtol(s, NIL, 0); + inform_users(); +} + + +/* + * FLOAT type of option + *____________________________________________________________________________ + * + */ + +cl_float_option::cl_float_option(class cl_base *the_creator, + char *aname, char *Ihelp): + cl_option(the_creator, aname, Ihelp) +{} + +void +cl_float_option::print(class cl_console *con) +{ + con->dd_printf("%.3f", value.fval); +} + +void +cl_float_option::set_value(char *s) +{ + if (s) + value.fval= strtod(s, NIL); + inform_users(); +} /* End of option.cc */ diff --git a/sim/ucsim/optioncl.h b/sim/ucsim/optioncl.h index c2b30692..da4d4baa 100644 --- a/sim/ucsim/optioncl.h +++ b/sim/ucsim/optioncl.h @@ -80,12 +80,19 @@ public: virtual void show(void) { hidden= DD_FALSE; } virtual void print(class cl_console *con) {} + virtual char *get_type_name(void) { return("non"); } + virtual union option_value *get_value(void) { return(&value); } virtual void get_value(bool *val); virtual void get_value(char **val); - virtual union option_value *get_value(void) { return(&value); } - virtual void set_value(bool); - virtual void set_value(char *s); + virtual void get_value(void **val); + virtual void get_value(long *val); + virtual void get_value(double *val); + virtual void set_value(bool opt); + virtual void set_value(char *opt); + virtual void set_value(void *opt); + virtual void set_value(long opt); + virtual void set_value(double opt); virtual void new_reference(class cl_optref *ref); virtual void del_reference(class cl_optref *ref); @@ -96,7 +103,7 @@ public: class cl_options: public cl_sorted_list { public: - cl_options(void): cl_sorted_list(2, 2) { Duplicates= DD_TRUE; } + cl_options(void): cl_sorted_list(2, 2, "options") { Duplicates= DD_TRUE; } virtual void *key_of(void *item); virtual int compare(void *key1, void *key2); virtual void new_option(class cl_option *opt); @@ -112,6 +119,12 @@ public: bool value); virtual class cl_option *set_value(char *the_name, cl_base *creator, char *value); + virtual class cl_option *set_value(char *the_name, cl_base *creator, + void *value); + virtual class cl_option *set_value(char *the_name, cl_base *creator, + long value); + virtual class cl_option *set_value(char *the_name, cl_base *creator, + double value); }; @@ -137,6 +150,9 @@ public: virtual bool get_value(bool); virtual char *get_value(char *); + virtual void *get_value(void *); + virtual long get_value(long); + virtual double get_value(double); }; @@ -144,10 +160,8 @@ class cl_bool_option: public cl_option { public: cl_bool_option(class cl_base *the_creator, char *aname, char *Ihelp); - virtual void print(class cl_console *con); - //virtual void get_value(bool *val); - //virtual void set_value(bool); + virtual char *get_type_name(void) { return("boolean"); } virtual void set_value(char *s); }; @@ -157,14 +171,42 @@ class cl_string_option: public cl_option public: cl_string_option(class cl_base *the_creator, char *aname, char *Ihelp); virtual class cl_option &operator=(class cl_option &o); + virtual void print(class cl_console *con); + virtual char *get_type_name(void) { return("string"); } +}; + +class cl_pointer_option: public cl_option +{ +public: + cl_pointer_option(class cl_base *the_creator, char *aname, char *Ihelp); + virtual class cl_option &operator=(class cl_option &o); virtual void print(class cl_console *con); - //virtual void get_value(char *val); - //virtual void set_value(char *opt); + virtual char *get_type_name(void) { return("pointer"); } }; -class cl_cons_debug_opt: public cl_option +class cl_number_option: public cl_option +{ +public: + cl_number_option(class cl_base *the_creator, char *aname, char *Ihelp); + virtual void print(class cl_console *con); + virtual char *get_type_name(void) { return("integer"); } + virtual void set_value(char *s); +}; + + +class cl_float_option: public cl_option +{ +public: + cl_float_option(class cl_base *the_creator, char *aname, char *Ihelp); + virtual void print(class cl_console *con); + virtual char *get_type_name(void) { return("float"); } + virtual void set_value(char *s); +}; + + +/*class cl_cons_debug_opt: public cl_option { public: class cl_app *app; @@ -177,7 +219,7 @@ public: virtual void set_value(bool); virtual void set_value(char *s); -}; +};*/ #endif diff --git a/sim/ucsim/packages_in.mk b/sim/ucsim/packages_in.mk index 0c60e06b..4027b938 100644 --- a/sim/ucsim/packages_in.mk +++ b/sim/ucsim/packages_in.mk @@ -1,4 +1,4 @@ -EXEEXT = @EXEEXT@ +EXEEXT = @EXEEXT@ enable_51 = @enable_51@ enable_avr = @enable_avr@ diff --git a/sim/ucsim/pobj.cc b/sim/ucsim/pobj.cc index f747e96b..126e14db 100644 --- a/sim/ucsim/pobj.cc +++ b/sim/ucsim/pobj.cc @@ -49,6 +49,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA cl_base::cl_base(void) { name= 0; + parent= 0; + children= 0; } @@ -60,6 +62,16 @@ cl_base::~cl_base(void) { if (name) free(name); + if (children) + { + int i; + for (i= 0; i < children->count; i++) + { + } + children->disconn_all(); + delete children; + } + parent= 0; } int cl_base::init(void) {return(0);} @@ -86,6 +98,161 @@ cl_base::set_name(char *new_name) return(name); } +char * +cl_base::set_name(char *new_name, char *def_name) +{ + char *def; + + if (!def_name || + *def_name == '\0') + def= strdup(""); + else + def= strdup(def_name); + if (name) + free(name); + if (!new_name) + name= def; + else if (*new_name) + name= strdup(new_name); + else + name= def; + return(name); +} + +bool +cl_base::is_named(char *the_name) +{ + if (!name || + !*name || + !the_name || + !*the_name) + return(DD_FALSE); + return(strcmp(name, the_name) == 0); +} + +bool +cl_base::is_inamed(char *the_name) +{ + if (!name || + !*name || + !the_name || + !*the_name) + return(DD_FALSE); + return(strcasecmp(name, the_name) == 0); +} + + +int +cl_base::nuof_children(void) +{ + if (!children) + return(0); + return(children->count); +} + +void +cl_base::add_child(class cl_base *child) +{ + if (!children) + { + char *s; + s= (char*)malloc(strlen(get_name("?"))+100); + sprintf(s, "childs of %s", get_name("?")); + children= new cl_list(1, 1, s); + free(s); + } + if (child) + { + children->add(child); + child->parent= this; + } +} + +void +cl_base::remove_child(class cl_base *child) +{ + if (child && + children) + { + child->unlink(); + children->disconn(child); + } +} + +void +cl_base::remove_from_chain(void) +{ + if (parent) + parent->remove_child(this); +} + +void +cl_base::unlink(void) +{ + parent= 0; +} + +class cl_base * +cl_base::first_child(void) +{ + if (!children || + children->count == 0) + return(0); + return(dynamic_cast(children->object_at(0))); +} + +class cl_base * +cl_base::next_child(class cl_base *child) +{ + if (!children || + !child) + return(0); + return((class cl_base *)(children->next(child))); +} + + +bool +cl_base::handle_event(class cl_event &event) +{ + return(pass_event_down(event)); +} + +bool +cl_base::pass_event_down(class cl_event &event) +{ + int i; + if (!children) + return(DD_FALSE); + for (i= 0; i < children->count; i++) + { + class cl_base *child= + dynamic_cast(children->object_at(i)); + if (child) + { + child->handle_event(event); + if (event.is_handled()) + return(DD_TRUE); + } + } + return(DD_FALSE); +} + + +/* + * Event + */ + +cl_event::cl_event(enum event what_event): + cl_base() +{ + handled= DD_FALSE; + what= what_event; +} + +cl_event::~cl_event(void) +{ +} + /* * ==========================================================================* @@ -98,7 +265,7 @@ cl_base::set_name(char *new_name) * Initializing a collection */ -cl_list::cl_list(t_index alimit, t_index adelta): +cl_list::cl_list(t_index alimit, t_index adelta, char *aname): cl_base() { count= 0; @@ -106,6 +273,7 @@ cl_list::cl_list(t_index alimit, t_index adelta): Limit= 0; Delta= adelta; set_limit(alimit); + set_name(aname, "unnamed list"); } @@ -133,6 +301,15 @@ cl_list::at(t_index index) return(Items[index]); } +class cl_base * +cl_list::object_at(t_index index) +{ + if (index < 0 || + index >= count) + error(1, index); + return((class cl_base *)(Items[index])); +} + /*void * cl_list::operator[](t_index index) { @@ -146,7 +323,7 @@ cl_list::operator[](t_index index) /* * Deleting the indexed item from the collection */ - +#include "globals.h" void cl_list::disconn_at(t_index index) { @@ -154,6 +331,16 @@ cl_list::disconn_at(t_index index) index >= count) error(1, 0); count--; + /*{ char s[1000]; + s[0]='\0'; + sprintf(s, "disconn_at(%d) PC=0x%x", index, + application? + ((application->sim)? + ((application->sim->uc)?(application->sim->uc->PC): + -3): + -1): + -2); + strcat(s,"\n");}*/ memmove(&Items[index], &Items[index+1], (count-index)*sizeof(void *)); } @@ -222,6 +409,16 @@ cl_list::add_at(t_index index, void *item) if (count == Limit) set_limit(count + Delta); + { char s[1000]; + s[0]='\0'; + sprintf(s, "%s add_at(%d,%p) PC=0x%x (count=%d)", get_name("?"), index, item, + application? + ((application->sim)? + ((application->sim->uc)?(application->sim->uc->PC): + -3): + -1): + -2, count); + strcat(s,"\n");} memmove(&Items[index+1], &Items[index], (count-index)*sizeof(void *)); count++; @@ -355,6 +552,19 @@ cl_list::index_of(void *item, t_index *idx) return(DD_FALSE); } +void * +cl_list::next(void *item) +{ + for (t_index i= 0; i < count; i++) + if (item == Items[i]) + { + if (count >= 2 && + i < count-1) + return(Items[i+1]); + } + return(0); +} + /* * Inserting a new item to the collection. @@ -369,6 +579,13 @@ cl_list::add(void *item) return(loc); } +t_index +cl_list::add(class cl_base *item, class cl_base *parent) +{ + if (parent && item) + parent->add_child(item); + return(add(item)); +} void cl_list::push(void *item) @@ -460,8 +677,8 @@ cl_list::set_limit(t_index alimit) * Initilizing the sorted collection */ -cl_sorted_list::cl_sorted_list(t_index alimit, t_index adelta): - cl_list(alimit, adelta) +cl_sorted_list::cl_sorted_list(t_index alimit, t_index adelta, char *aname): + cl_list(alimit, adelta, aname) { Duplicates= DD_FALSE; } @@ -567,8 +784,8 @@ cl_sorted_list::search(void *key, t_index &index) * Initilizing the string collection */ -cl_strings::cl_strings(t_index alimit, t_index adelta): - cl_sorted_list(alimit, adelta) +cl_strings::cl_strings(t_index alimit, t_index adelta, char *aname): + cl_sorted_list(alimit, adelta, aname) { Duplicates= DD_TRUE; } @@ -610,8 +827,8 @@ cl_strings::free_item(void* item) * Initilizing the unsorted string collection */ -cl_ustrings::cl_ustrings(t_index alimit, t_index adelta): - cl_strings(alimit, adelta) +cl_ustrings::cl_ustrings(t_index alimit, t_index adelta, char *aname): + cl_strings(alimit, adelta, aname) {} diff --git a/sim/ucsim/pobjcl.h b/sim/ucsim/pobjcl.h index b7ccb87c..317d1ce8 100644 --- a/sim/ucsim/pobjcl.h +++ b/sim/ucsim/pobjcl.h @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #ifndef POBJ_HEADER @@ -32,6 +34,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "pobjt.h" +#include "eventcl.h" + /* # ==========================================================================# @@ -40,10 +44,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA # */ +class cl_list; +class cl_event; + class cl_base { private: char *name; + class cl_base *parent; + class cl_list *children; public: cl_base(void); virtual ~cl_base(void); @@ -54,6 +63,41 @@ public: virtual bool have_name(void) { return(name != 0); } virtual bool have_real_name(void) { return(name != 0 && *name != '\0'); } char *set_name(char *new_name); + char *set_name(char *new_name, char *def_name); + bool is_named(char *the_name); + bool is_inamed(char *the_name); + + class cl_base *get_parent(void) { return(parent); } + int nuof_children(void); + + virtual void add_child(class cl_base *child); + virtual void remove_child(class cl_base *child); + virtual void remove_from_chain(void); + virtual void unlink(void); + virtual class cl_base *first_child(void); + virtual class cl_base *next_child(class cl_base *child); + + virtual bool handle_event(class cl_event &event); + virtual bool pass_event_down(class cl_event &event); +}; + + +/* + * Event + */ + +class cl_event: public cl_base +{ +protected: + bool handled; +public: + enum event what; +public: + cl_event(enum event what_event); + virtual ~cl_event(void); + + bool is_handled(void) { return(handled); } + virtual void handle(void) { handled= DD_TRUE; } }; @@ -74,12 +118,14 @@ protected: t_index Delta; public: - cl_list(t_index alimit, t_index adelta); + cl_list(t_index alimit, t_index adelta, char *aname); virtual ~cl_list(void); void *at(t_index index); + class cl_base *object_at(t_index index); virtual t_index index_of(void *item); virtual bool index_of(void *item, t_index *idx); + virtual void *next(void *item); int get_count(void); virtual void *pop(void); virtual void *top(void); @@ -96,6 +142,7 @@ public: void add_at(t_index index, void *item); void put_at(t_index index, void *item); virtual t_index add(void *item); + virtual t_index add(class cl_base *item, class cl_base *parent); virtual void push(void *item); void *first_that(match_func test, void *arg); @@ -119,8 +166,8 @@ class cl_sorted_list: public cl_list { public: bool Duplicates; - - cl_sorted_list(t_index alimit, t_index adelta); +public: + cl_sorted_list(t_index alimit, t_index adelta, char *aname); virtual ~cl_sorted_list(void); virtual bool search(void *key, t_index& index); @@ -142,7 +189,7 @@ private: class cl_strings: public cl_sorted_list { public: - cl_strings(t_index alimit, t_index adelta); + cl_strings(t_index alimit, t_index adelta, char *aname); virtual ~cl_strings(void); private: @@ -161,7 +208,7 @@ private: class cl_ustrings: public cl_strings { public: - cl_ustrings(t_index alimit, t_index adelta); + cl_ustrings(t_index alimit, t_index adelta, char *aname); virtual ~cl_ustrings(void); private: diff --git a/sim/ucsim/ptt.cc b/sim/ucsim/ptt.cc new file mode 100644 index 00000000..8138260d --- /dev/null +++ b/sim/ucsim/ptt.cc @@ -0,0 +1,232 @@ +#include +#include + +// simulated system +struct app { + long PC; + bool simulating; +} sys; + +// locks +pthread_mutex_t simulation_lock; +pthread_mutex_t application_lock; + + +pthread_t sim_th; + +struct sim_args { + long int steps2go; +}; + +void +step_start(void) +{ + pthread_mutex_lock(&application_lock); +} + +void +step_end(void) +{ + pthread_mutex_unlock(&application_lock); +} + +void * +sim_thread(void *arg) +{ + printf("Sim: thread started, now trying lock...\n"); + pthread_mutex_lock(&simulation_lock); + printf("Sim: got lock, now run\n"); + struct sim_args *args= (struct sim_args *)arg; + bool done= 0; + long steps2go= args->steps2go, steps= steps2go; + while (!done) + { + step_start(); + sys.PC++; + if (steps2go > 0) + { + steps--; + if (done= steps == 0) + printf("Sim: %s steps done\n", steps2go); + } + else if (steps2go == 0) + { + } + /*else if (steps2go < 0) + {*/ + if (done= !sys.simulating) + printf("Sim: requested to stop\n"); + /*}*/ + step_end(); + } + printf("Sim: finished, releasing lock...\n"); + pthread_mutex_unlock(&simulation_lock); + printf("Sim: done\n"); + return(NULL); +} + + +void +start_command(void) +{ + pthread_mutex_lock(&application_lock); +} + +void +end_command(void) +{ + pthread_mutex_unlock(&application_lock); +} + + +void +g_cmd(FILE *fin, FILE *fout) +{ + start_command(); + fprintf(fout, "PC=%ld, simulating=%d\n", sys.PC, sys.simulating); + end_command(); +} + +void +s_cmd(FILE *fin, FILE *fout) +{ + start_command(); + fscanf(fin, " %ld", &sys.PC); + fprintf(fout, "PC=%ld\n", sys.PC); + end_command(); +} + +void +start_simulation(int steps) +{ + struct sim_args sargs; + sargs.steps2go= steps; + sys.simulating= 1; + pthread_attr_t ta; + pthread_attr_init(&ta); + pthread_attr_setdetachstate(&ta, PTHREAD_CREATE_DETACHED); + pthread_create(&sim_th, &ta, sim_thread, &sargs); + pthread_attr_destroy(&ta); +} + +void +r_cmd(FILE *fin, FILE *fout) +{ + start_command(); + if (pthread_mutex_trylock(&simulation_lock) != 0) + { + fprintf(fout, "Simulation already runing\n"); + } + else + { + fprintf(fout, "Run from PC=%ld\n", sys.PC); + start_simulation(-1); + pthread_mutex_unlock(&simulation_lock); + } + end_command(); +} + +void +S_cmd(FILE *fin, FILE *fout) +{ + fprintf(fout, "Trying to get app lock...\n"); + start_command(); + fprintf(fout, "OK, lock is ours, set stopper flag...\n"); + sys.simulating= 0; + fprintf(fout, "Release lock, to give chance of stop\n"); + end_command(); + fprintf(fout, "Wait for stop...\n"); + pthread_mutex_lock(&simulation_lock); + fprintf(fout, "We got sim lock, so it stopped\n"); + pthread_mutex_unlock(&simulation_lock); + fprintf(fout, "Stopped at PC=%ld\n", sys.PC); +} + + +struct input_args { + int nr; + char *fin_name; + char *fout_name; +}; + +void * +input_thread(void *arg) +{ + struct input_args *args= (struct input_args *)arg; + FILE *fin, *fout; + if (args->fin_name) + fin= fopen(args->fin_name, "r"); + else + fin= stdin; + if (args->fout_name) + fout= fopen(args->fout_name, "w"); + else + fout= stdout; + bool done= 0; + while (!done) + { + char cmd[100]; + fprintf(fout, "%d> ", args->nr); fflush(fout); + fscanf(fin, " %99s", &cmd[0]); + fprintf(fout, "%d Got command: %c\n", args->nr, cmd[0]); + switch (cmd[0]) + { + case 'q': + done= 1; + break; + case 'g': + g_cmd(fin, fout); + break; + case 's': + s_cmd(fin, fout); + break; + case 'r': + r_cmd(fin, fout); + break; + case 'S': + S_cmd(fin, fout); + break; + default: + fprintf(fout, "%d Unknown command\n", args->nr); + break; + } + } + fprintf(fout, "%d Console finished\n", args->nr); + fclose(fin); + fclose(fout); + return(NULL); +} + + +int +main(int argc, char *argv[]) +{ + pthread_t input_th[3]; + int threads= 0; + + pthread_mutex_init(&simulation_lock, NULL); + pthread_mutex_init(&application_lock, NULL); + + struct input_args iargs= { 0, NULL, NULL }; + pthread_create(&input_th[0], NULL, input_thread, &iargs); + threads++; + if (argc > 1) + { + struct input_args iargs= { 1, argv[1], argv[1] }; + pthread_create(&input_th[1], NULL, input_thread, &iargs); + threads++; + } + if (argc > 2) + { + struct input_args iargs= { 2, argv[2], argv[2] }; + pthread_create(&input_th[2], NULL, input_thread, &iargs); + threads++; + } + int i; + for (i= 0; i < threads; i++) + { + void *ret; + pthread_join(input_th[i], &ret); + } + return(0); +} diff --git a/sim/ucsim/s51.src/Makefile.in b/sim/ucsim/s51.src/Makefile.in index 89a45c9e..50b4f374 100644 --- a/sim/ucsim/s51.src/Makefile.in +++ b/sim/ucsim/s51.src/Makefile.in @@ -29,7 +29,7 @@ SDCC = sdcc SDCFLAGS = --debug --stack-after-data --model-small SDCPPFLAGS = -LIBS = @LIBS@ -L$(PRJDIR) -lsim -lutil -lsim -lcmd -lguiucsim +LIBS = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lutil -lsim -lcmd -lguiucsim -Wl,--end-group DL = @DL@ dl_ok = @dl_ok@ @@ -45,7 +45,7 @@ man2dir = $(mandir)/man2 infodir = @infodir@ srcdir = @srcdir@ -EXEEXT = @EXEEXT@ +EXEEXT = @EXEEXT@ OBJECTS_SHARED = glob.o sim51.o \ inc.o jmp.o mov.o logic.o arith.o bit.o \ @@ -132,6 +132,7 @@ $(PRJDIR)/s51.so: $(OBJECTS_SHARED) $(CXX) -shared $(OBJECTS_SHARED) -o $@ otherlibs: + cd $(PRJDIR) && $(MAKE) libs cd $(PRJDIR)/cmd.src && $(MAKE) all cd $(PRJDIR)/sim.src && $(MAKE) all $(MAKE) -C $(PRJDIR)/gui.src checkconf ucsim_lib diff --git a/sim/ucsim/s51.src/arith.cc b/sim/ucsim/s51.src/arith.cc index 15eb73d5..7e8da880 100644 --- a/sim/ucsim/s51.src/arith.cc +++ b/sim/ucsim/s51.src/arith.cc @@ -42,7 +42,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_rr(uchar code) +cl_51core::inst_rr(uchar code) { uchar ac; @@ -62,7 +62,7 @@ t_uc51::inst_rr(uchar code) */ int -t_uc51::inst_rrc(uchar code) +cl_51core::inst_rrc(uchar code) { bool cy; uchar ac; @@ -84,7 +84,7 @@ t_uc51::inst_rrc(uchar code) */ int -t_uc51::inst_rl(uchar code) +cl_51core::inst_rl(uchar code) { uchar ac; @@ -104,7 +104,7 @@ t_uc51::inst_rl(uchar code) */ int -t_uc51::inst_add_a_Sdata(uchar code) +cl_51core::inst_add_a_Sdata(uchar code) { uchar data, ac; bool newC, newA, c6; @@ -129,11 +129,11 @@ t_uc51::inst_add_a_Sdata(uchar code) */ int -t_uc51::inst_add_a_addr(uchar code) +cl_51core::inst_add_a_addr(uchar code) { uchar data, ac; bool newC, newA, c6; - class cl_cell *cell; + class cl_memory_cell *cell; t_addr a; cell= get_direct(a= fetch()); @@ -157,11 +157,11 @@ t_uc51::inst_add_a_addr(uchar code) */ int -t_uc51::inst_add_a_Sri(uchar code) +cl_51core::inst_add_a_Sri(uchar code) { uchar data, ac; bool newC, newA, c6; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); ac = acc->get(); @@ -184,7 +184,7 @@ t_uc51::inst_add_a_Sri(uchar code) */ int -t_uc51::inst_add_a_rn(uchar code) +cl_51core::inst_add_a_rn(uchar code) { uchar data, ac; bool newC, newA, c6; @@ -209,7 +209,7 @@ t_uc51::inst_add_a_rn(uchar code) */ int -t_uc51::inst_rlc(uchar code) +cl_51core::inst_rlc(uchar code) { bool cy; uchar ac; @@ -231,7 +231,7 @@ t_uc51::inst_rlc(uchar code) */ int -t_uc51::inst_addc_a_Sdata(uchar code) +cl_51core::inst_addc_a_Sdata(uchar code) { uchar data, ac; bool orgC, newC, newA, c6; @@ -256,11 +256,11 @@ t_uc51::inst_addc_a_Sdata(uchar code) */ int -t_uc51::inst_addc_a_addr(uchar code) +cl_51core::inst_addc_a_addr(uchar code) { uchar data, ac; bool orgC, newC, newA, c6; - class cl_cell *cell; + class cl_memory_cell *cell; t_addr a; cell= get_direct(a= fetch()); @@ -284,11 +284,11 @@ t_uc51::inst_addc_a_addr(uchar code) */ int -t_uc51::inst_addc_a_Sri(uchar code) +cl_51core::inst_addc_a_Sri(uchar code) { uchar data, ac; bool orgC, newC, newA, c6; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); ac = acc->get(); @@ -311,7 +311,7 @@ t_uc51::inst_addc_a_Sri(uchar code) */ int -t_uc51::inst_addc_a_rn(uchar code) +cl_51core::inst_addc_a_rn(uchar code) { uchar data, ac; bool orgC, newC, newA, c6; @@ -336,7 +336,7 @@ t_uc51::inst_addc_a_rn(uchar code) */ int -t_uc51::inst_div_ab(uchar code) +cl_51core::inst_div_ab(uchar code) { uchar temp, pw, b, ac; @@ -364,7 +364,7 @@ t_uc51::inst_div_ab(uchar code) */ int -t_uc51::inst_subb_a_Sdata(uchar code) +cl_51core::inst_subb_a_Sdata(uchar code) { uchar data, ac, result, pw, c; @@ -392,10 +392,10 @@ t_uc51::inst_subb_a_Sdata(uchar code) */ int -t_uc51::inst_subb_a_addr(uchar code) +cl_51core::inst_subb_a_addr(uchar code) { uchar data, ac, result, pw, c; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); ac = acc->get(); @@ -422,10 +422,10 @@ t_uc51::inst_subb_a_addr(uchar code) */ int -t_uc51::inst_subb_a_Sri(uchar code) +cl_51core::inst_subb_a_Sri(uchar code) { uchar data, ac, result, pw, c; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); data= cell->read(); @@ -452,7 +452,7 @@ t_uc51::inst_subb_a_Sri(uchar code) */ int -t_uc51::inst_subb_a_rn(uchar code) +cl_51core::inst_subb_a_rn(uchar code) { uchar data, ac, result, pw, c; @@ -480,7 +480,7 @@ t_uc51::inst_subb_a_rn(uchar code) */ int -t_uc51::inst_mul_ab(uchar code) +cl_51core::inst_mul_ab(uchar code) { uint temp, pw, ac, b, x; @@ -503,7 +503,7 @@ t_uc51::inst_mul_ab(uchar code) */ int -t_uc51::inst_da_a(uchar code) +cl_51core::inst_da_a(uchar code) { uchar ac, pw; diff --git a/sim/ucsim/s51.src/bit.cc b/sim/ucsim/s51.src/bit.cc index 2b6cf83e..7b55a33a 100644 --- a/sim/ucsim/s51.src/bit.cc +++ b/sim/ucsim/s51.src/bit.cc @@ -40,13 +40,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_orl_c_bit(uchar code) +cl_51core::inst_orl_c_bit(uchar code) { uchar bitaddr; t_addr a; t_mem m; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(bitaddr= fetch(), &a, &m); SFR_SET_C(SFR_GET_C || (mem->read(a) & m)); @@ -62,11 +62,11 @@ t_uc51::inst_orl_c_bit(uchar code) */ int -t_uc51::inst_anl_c_bit(uchar code) +cl_51core::inst_anl_c_bit(uchar code) { t_mem m; t_addr a; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); SFR_SET_C(SFR_GET_C && @@ -83,11 +83,11 @@ t_uc51::inst_anl_c_bit(uchar code) */ int -t_uc51::inst_mov_bit_c(uchar code) +cl_51core::inst_mov_bit_c(uchar code) { t_addr a; t_mem m, d; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); d= mem->read(a, HW_PORT); @@ -107,11 +107,11 @@ t_uc51::inst_mov_bit_c(uchar code) */ int -t_uc51::inst_mov_c_bit(uchar code) +cl_51core::inst_mov_c_bit(uchar code) { t_addr a; t_mem m; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); SFR_SET_C(mem->read(a) & m); @@ -119,6 +119,27 @@ t_uc51::inst_mov_c_bit(uchar code) } +/* + * 0xa0 2 24 ORL C,/bit + *____________________________________________________________________________ + * + */ + +int +cl_51core::inst_orl_c_Sbit(uchar code) +{ + t_mem m; + t_addr a; + class cl_address_space *mem; + + mem= bit2mem(fetch(), &a, &m); + SFR_SET_C(SFR_GET_C || + !(mem->read(a) & m)); + tick(1); + return(resGO); +} + + /* * 0xb0 2 24 ANL C,/bit *____________________________________________________________________________ @@ -126,11 +147,11 @@ t_uc51::inst_mov_c_bit(uchar code) */ int -t_uc51::inst_anl_c_Sbit(uchar code) +cl_51core::inst_anl_c_Sbit(uchar code) { t_mem m; t_addr a; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); SFR_SET_C(SFR_GET_C && @@ -147,11 +168,11 @@ t_uc51::inst_anl_c_Sbit(uchar code) */ int -t_uc51::inst_cpl_bit(uchar code) +cl_51core::inst_cpl_bit(uchar code) { t_addr a; t_mem m, d; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); d= mem->read(a, HW_PORT); @@ -167,7 +188,7 @@ t_uc51::inst_cpl_bit(uchar code) */ int -t_uc51::inst_cpl_c(uchar code) +cl_51core::inst_cpl_c(uchar code) { psw->write(psw->read() ^ bmCY); return(resGO); @@ -181,11 +202,11 @@ t_uc51::inst_cpl_c(uchar code) */ int -t_uc51::inst_clr_bit(uchar code) +cl_51core::inst_clr_bit(uchar code) { t_addr a; t_mem m; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); t_mem d= mem->read(a, HW_PORT); @@ -201,7 +222,7 @@ t_uc51::inst_clr_bit(uchar code) */ int -t_uc51::inst_clr_c(uchar code) +cl_51core::inst_clr_c(uchar code) { psw->write(psw->read() & ~bmCY); return(resGO); @@ -215,11 +236,11 @@ t_uc51::inst_clr_c(uchar code) */ int -t_uc51::inst_setb_bit(uchar code) +cl_51core::inst_setb_bit(uchar code) { t_addr a; t_mem m, d; - class cl_mem *mem; + class cl_address_space *mem; mem= bit2mem(fetch(), &a, &m); d= mem->read(a, HW_PORT); @@ -235,7 +256,7 @@ t_uc51::inst_setb_bit(uchar code) */ int -t_uc51::inst_setb_c(uchar code) +cl_51core::inst_setb_c(uchar code) { psw->write(psw->read() | bmCY); return(resGO); diff --git a/sim/ucsim/s51.src/glob.cc b/sim/ucsim/s51.src/glob.cc index 65e9c0ce..f09e8f25 100644 --- a/sim/ucsim/s51.src/glob.cc +++ b/sim/ucsim/s51.src/glob.cc @@ -593,52 +593,4 @@ struct name_entry bit_tab51[]= }; -/* - * Information about different type of CPUs - */ - -struct cpu_entry cpus_51[]= -{ - {"51" , CPU_51, CPU_HMOS}, - {"8051" , CPU_51, CPU_HMOS}, - {"8751" , CPU_51, CPU_HMOS}, - {"C51" , CPU_51, CPU_CMOS}, - {"80C51" , CPU_51, CPU_CMOS}, - {"87C51" , CPU_51, CPU_CMOS}, - {"31" , CPU_31, CPU_HMOS}, - {"8031" , CPU_31, CPU_HMOS}, - {"C31" , CPU_31, CPU_CMOS}, - {"80C31" , CPU_31, CPU_CMOS}, - - {"52" , CPU_52, CPU_HMOS}, - {"8052" , CPU_52, CPU_HMOS}, - {"8752" , CPU_52, CPU_HMOS}, - {"C52" , CPU_52, CPU_CMOS}, - {"80C52" , CPU_52, CPU_CMOS}, - {"87C52" , CPU_52, CPU_CMOS}, - {"32" , CPU_32, CPU_HMOS}, - {"8032" , CPU_32, CPU_HMOS}, - {"C32" , CPU_32, CPU_CMOS}, - {"80C32" , CPU_32, CPU_CMOS}, - - {"51R" , CPU_51R, CPU_CMOS}, - {"51RA" , CPU_51R, CPU_CMOS}, - {"51RB" , CPU_51R, CPU_CMOS}, - {"51RC" , CPU_51R, CPU_CMOS}, - {"C51R" , CPU_51R, CPU_CMOS}, - {"C51RA" , CPU_51R, CPU_CMOS}, - {"C51RB" , CPU_51R, CPU_CMOS}, - {"C51RC" , CPU_51R, CPU_CMOS}, - - {"89C51R", CPU_89C51R, CPU_CMOS}, - - {"251" , CPU_251, CPU_CMOS}, - {"C251" , CPU_251, CPU_CMOS}, - - {"DS390" , CPU_DS390, CPU_CMOS}, - {"DS390F", CPU_DS390F, CPU_CMOS}, - {NULL, 0, 0} -}; - - /* End of s51.src/glob.cc */ diff --git a/sim/ucsim/s51.src/glob.h b/sim/ucsim/s51.src/glob.h index 76e5f9ba..4e4a8067 100644 --- a/sim/ucsim/s51.src/glob.h +++ b/sim/ucsim/s51.src/glob.h @@ -32,7 +32,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA extern struct dis_entry disass_51[]; extern struct name_entry sfr_tab51[]; extern struct name_entry bit_tab51[]; -extern struct cpu_entry cpus_51[]; #endif diff --git a/sim/ucsim/s51.src/inc.cc b/sim/ucsim/s51.src/inc.cc index d3391997..23d35641 100644 --- a/sim/ucsim/s51.src/inc.cc +++ b/sim/ucsim/s51.src/inc.cc @@ -39,7 +39,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_inc_a(uchar code) +cl_51core::inst_inc_a(uchar code) { acc->wadd(1); return(resGO); @@ -53,9 +53,9 @@ t_uc51::inst_inc_a(uchar code) */ int -t_uc51::inst_inc_addr(uchar code) +cl_51core::inst_inc_addr(uchar code) { - class cl_cell *cell= get_direct(fetch()); + class cl_memory_cell *cell= get_direct(fetch()); t_mem d= cell->read(HW_PORT); cell->write(d+1); @@ -70,9 +70,9 @@ t_uc51::inst_inc_addr(uchar code) */ int -t_uc51::inst_inc_Sri(uchar code) +cl_51core::inst_inc_Sri(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); cell->wadd(1); @@ -87,9 +87,9 @@ t_uc51::inst_inc_Sri(uchar code) */ int -t_uc51::inst_inc_rn(uchar code) +cl_51core::inst_inc_rn(uchar code) { - class cl_cell *reg= get_reg(code & 0x07); + class cl_memory_cell *reg= get_reg(code & 0x07); reg->wadd(1); return(resGO); @@ -103,7 +103,7 @@ t_uc51::inst_inc_rn(uchar code) */ int -t_uc51::inst_dec_a(uchar code) +cl_51core::inst_dec_a(uchar code) { acc->wadd(-1); @@ -118,9 +118,9 @@ t_uc51::inst_dec_a(uchar code) */ int -t_uc51::inst_dec_addr(uchar code) +cl_51core::inst_dec_addr(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); t_mem d= cell->read(HW_PORT); @@ -136,9 +136,9 @@ t_uc51::inst_dec_addr(uchar code) */ int -t_uc51::inst_dec_Sri(uchar code) +cl_51core::inst_dec_Sri(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); cell->add(-1); @@ -153,9 +153,9 @@ t_uc51::inst_dec_Sri(uchar code) */ int -t_uc51::inst_dec_rn(uchar code) +cl_51core::inst_dec_rn(uchar code) { - class cl_cell *reg= get_reg(code & 0x07); + class cl_memory_cell *reg= get_reg(code & 0x07); reg->wadd(-1); return(resGO); @@ -169,7 +169,7 @@ t_uc51::inst_dec_rn(uchar code) */ int -t_uc51::inst_inc_dptr(uchar code) +cl_51core::inst_inc_dptr(uchar code) { uint dptr; diff --git a/sim/ucsim/s51.src/interrupt.cc b/sim/ucsim/s51.src/interrupt.cc index 36196292..80aad40c 100644 --- a/sim/ucsim/s51.src/interrupt.cc +++ b/sim/ucsim/s51.src/interrupt.cc @@ -47,9 +47,7 @@ cl_interrupt::cl_interrupt(class cl_uc *auc): int cl_interrupt::init(void) { - class cl_mem *sfr; - - sfr= uc->mem(MEM_SFR); + sfr= uc->address_space(MEM_SFR_ID); if (sfr) { //sfr->register_hw(IE, this, 0); @@ -71,7 +69,7 @@ cl_interrupt::added_to_uc(void) } void -cl_interrupt::write(class cl_cell *cell, t_mem *val) +cl_interrupt::write(class cl_memory_cell *cell, t_mem *val) { if (cell == cell_tcon) { @@ -84,7 +82,7 @@ cl_interrupt::write(class cl_cell *cell, t_mem *val) } /*void -cl_interrupt::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_interrupt::mem_cell_changed(class cl_m *mem, t_addr addr) { }*/ @@ -132,7 +130,7 @@ cl_interrupt::happen(class cl_hw *where, enum hw_event he, void *params) void cl_interrupt::print_info(class cl_console *con) { - int ie= uc->get_mem(MEM_SFR, IE); + int ie= sfr->get(IE); int i; con->dd_printf("Interrupts are %s. Interrupt sources:\n", @@ -145,7 +143,7 @@ cl_interrupt::print_info(class cl_console *con) con->dd_printf(" %-3s", (ie&(is->ie_mask))?"en":"dis"); con->dd_printf(" %2d", uc->it_priority(is->ie_mask)); con->dd_printf(" %-3s", - (uc->get_mem(MEM_SFR, is->src_reg)&(is->src_mask))? + (sfr->get(is->src_reg)&(is->src_mask))? "YES":"no"); con->dd_printf(" %-3s", (is->active)?"act":"no"); con->dd_printf(" %s", object_name(is)); diff --git a/sim/ucsim/s51.src/interruptcl.h b/sim/ucsim/s51.src/interruptcl.h index b2076758..2b84e8c3 100644 --- a/sim/ucsim/s51.src/interruptcl.h +++ b/sim/ucsim/s51.src/interruptcl.h @@ -38,18 +38,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_interrupt: public cl_hw { public: + class cl_address_space *sfr; bool was_reti, bit_IT0, bit_IT1, bit_INT0, bit_INT1; - class cl_cell *cell_tcon; + class cl_memory_cell *cell_tcon; public: cl_interrupt(class cl_uc *auc); virtual int init(void); virtual void added_to_uc(void); - //virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + //virtual t_mem read(class cl_memory_cell *cell); + virtual void write(class cl_memory_cell *cell, t_mem *val); - //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); virtual int tick(int cycles); virtual void reset(void); diff --git a/sim/ucsim/s51.src/jmp.cc b/sim/ucsim/s51.src/jmp.cc index 285a746d..ed6f1147 100644 --- a/sim/ucsim/s51.src/jmp.cc +++ b/sim/ucsim/s51.src/jmp.cc @@ -48,7 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_ajmp_addr(uchar code) +cl_51core::inst_ajmp_addr(uchar code) { uchar h, l; @@ -67,7 +67,7 @@ t_uc51::inst_ajmp_addr(uchar code) */ int -t_uc51::inst_jbc_bit_addr(uchar code) +cl_51core::inst_jbc_bit_addr(uchar code) { uchar bitaddr, jaddr; @@ -75,13 +75,13 @@ t_uc51::inst_jbc_bit_addr(uchar code) jaddr = fetch(); t_addr a; t_mem m; - class cl_mem *mem; + class cl_address_space *mem; if ((mem= bit2mem(bitaddr, &a, &m)) == 0) return(resBITADDR); t_mem d= mem->read(a, HW_PORT); mem->write(a, d & ~m); if (d & m) - PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1); + PC= rom->validate_address(PC + (signed char)jaddr); tick(1); return(resGO); } @@ -94,7 +94,7 @@ t_uc51::inst_jbc_bit_addr(uchar code) */ int -t_uc51::inst_ljmp(uchar code) +cl_51core::inst_ljmp(uchar code) { PC= fetch()*256 + fetch(); tick(1); @@ -109,25 +109,30 @@ t_uc51::inst_ljmp(uchar code) */ int -t_uc51::inst_acall_addr(uchar code) +cl_51core::inst_acall_addr(uchar code) { uchar h, l; - class cl_cell *stck; - t_mem sp; + class cl_memory_cell *stck; + t_mem sp, sp_before/*, sp_after*/; h= (code >> 5) & 0x07; l= fetch(); + sp_before= sfr->get(SP); sp= sfr->wadd(SP, 1); //proc_write_sp(sp); stck= iram->get_cell(sp); stck->write(PC & 0xff); // push low byte tick(1); - sp= sfr->wadd(SP, 1); + sp= /*sp_after*= */sfr->wadd(SP, 1); //proc_write_sp(sp); stck= iram->get_cell(sp); stck->write((PC >> 8) & 0xff); // push high byte + t_mem pushed= PC; PC= (PC & 0xf800) | (h*256 + l); + class cl_stack_op *so= new cl_stack_call(instPC, PC, pushed, sp_before, sp); + so->init(); + stack_write(so); return(resGO); } @@ -139,17 +144,18 @@ t_uc51::inst_acall_addr(uchar code) */ int -t_uc51::inst_lcall(uchar code, uint addr) +cl_51core::inst_lcall(uchar code, uint addr, bool intr) { uchar h= 0, l= 0; - t_mem sp; - class cl_cell *stck; + t_mem sp, sp_before/*, sp_after*/; + class cl_memory_cell *stck; if (!addr) { h= fetch(); l= fetch(); } + sp_before= sfr->get(SP); sp= sfr->wadd(SP, 1); //proc_write_sp(sp); stck= iram->get_cell(sp); @@ -161,10 +167,18 @@ t_uc51::inst_lcall(uchar code, uint addr) //proc_write_sp(sp); stck= iram->get_cell(sp); stck->write((PC >> 8) & 0xff); // push high byte + t_mem pushed= PC; if (addr) PC= addr; else PC= h*256 + l; + class cl_stack_op *so; + if (intr) + so= new cl_stack_intr(instPC, PC, pushed, sp_before, sp/*_after*/); + else + so= new cl_stack_call(instPC, PC, pushed, sp_before, sp/*_after*/); + so->init(); + stack_write(so); return(resGO); } @@ -176,19 +190,19 @@ t_uc51::inst_lcall(uchar code, uint addr) */ int -t_uc51::inst_jb_bit_addr(uchar code) +cl_51core::inst_jb_bit_addr(uchar code) { uchar bitaddr, jaddr; t_addr a; t_mem m; - class cl_mem *mem; + class cl_address_space *mem; if ((mem= bit2mem(bitaddr= fetch(), &a, &m)) == 0) return(resBITADDR); tick(1); jaddr= fetch(); if (mem->read(a) & m) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -200,13 +214,13 @@ t_uc51::inst_jb_bit_addr(uchar code) */ int -t_uc51::inst_ret(uchar code) +cl_51core::inst_ret(uchar code) { uchar h= 0, l= 0; - t_mem sp; - class cl_cell *stck; + t_mem sp, sp_before/*, sp_after*/; + class cl_memory_cell *stck; - sp= sfr->read(SP); + sp= sp_before= sfr->read(SP); stck= iram->get_cell(sp); h= stck->read(); sp= sfr->wadd(SP, -1); @@ -216,6 +230,9 @@ t_uc51::inst_ret(uchar code) l= stck->read(); sp= sfr->wadd(SP, -1); PC= h*256 + l; + class cl_stack_op *so= new cl_stack_ret(instPC, PC, sp_before, sp/*_after*/); + so->init(); + stack_read(so); return(resGO); } @@ -227,19 +244,19 @@ t_uc51::inst_ret(uchar code) */ int -t_uc51::inst_jnb_bit_addr(uchar code) +cl_51core::inst_jnb_bit_addr(uchar code) { uchar bitaddr, jaddr; t_mem m; t_addr a; - class cl_mem *mem; + class cl_address_space *mem; if ((mem= bit2mem(bitaddr= fetch(), &a, &m)) == 0) return(resBITADDR); tick(1); jaddr= fetch(); if (!(mem->read(a) & m)) - PC= (PC + (signed char)jaddr) & (get_mem_size(MEM_ROM)-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -251,13 +268,13 @@ t_uc51::inst_jnb_bit_addr(uchar code) */ int -t_uc51::inst_reti(uchar code) +cl_51core::inst_reti(uchar code) { uchar h= 0, l= 0; - t_mem sp; - class cl_cell *stck; + t_mem sp, sp_before, sp_after; + class cl_memory_cell *stck; - sp= sfr->read(SP); + sp= sp_before= sfr->read(SP); stck= iram->get_cell(sp); h= stck->read(); sp= sfr->wadd(SP, -1); @@ -265,7 +282,7 @@ t_uc51::inst_reti(uchar code) stck= iram->get_cell(sp); l= stck->read(); - sp= sfr->wadd(SP, -1); + sp= sp_after= sfr->wadd(SP, -1); PC= h*256 + l; interrupt->was_reti= DD_TRUE; @@ -276,6 +293,10 @@ t_uc51::inst_reti(uchar code) il= (class it_level *)(it_levels->pop()); delete il; } + class cl_stack_op *so= + new cl_stack_iret(instPC, PC, sp_before, sp_after); + so->init(); + stack_read(so); return(resGO); } @@ -287,14 +308,14 @@ t_uc51::inst_reti(uchar code) */ int -t_uc51::inst_jc_addr(uchar code) +cl_51core::inst_jc_addr(uchar code) { uchar jaddr; jaddr= fetch(); tick(1); if (SFR_GET_C) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -306,14 +327,14 @@ t_uc51::inst_jc_addr(uchar code) */ int -t_uc51::inst_jnc_addr(uchar code) +cl_51core::inst_jnc_addr(uchar code) { uchar jaddr; jaddr= fetch(); tick(1); if (!SFR_GET_C) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -325,14 +346,14 @@ t_uc51::inst_jnc_addr(uchar code) */ int -t_uc51::inst_jz_addr(uchar code) +cl_51core::inst_jz_addr(uchar code) { uchar jaddr; jaddr= fetch(); tick(1); if (!acc->read()) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -344,14 +365,14 @@ t_uc51::inst_jz_addr(uchar code) */ int -t_uc51::inst_jnz_addr(uchar code) +cl_51core::inst_jnz_addr(uchar code) { uchar jaddr; jaddr= fetch(); tick(1); if (acc->read()) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -363,10 +384,9 @@ t_uc51::inst_jnz_addr(uchar code) */ int -t_uc51::inst_jmp_Sa_dptr(uchar code) +cl_51core::inst_jmp_Sa_dptr(uchar code) { - PC= (sfr->read(DPH)*256 + sfr->read(DPL) + acc->read()) & - (EROM_SIZE - 1); + PC= rom->validate_address(sfr->read(DPH)*256 + sfr->read(DPL) + acc->read()); tick(1); return(resGO); } @@ -379,11 +399,11 @@ t_uc51::inst_jmp_Sa_dptr(uchar code) */ int -t_uc51::inst_sjmp(uchar code) +cl_51core::inst_sjmp(uchar code) { signed char target= fetch(); - PC= (PC + target) & (EROM_SIZE -1); + PC= rom->validate_address(PC + target); tick(1); return(resGO); } @@ -396,7 +416,7 @@ t_uc51::inst_sjmp(uchar code) */ int -t_uc51::inst_cjne_a_Sdata_addr(uchar code) +cl_51core::inst_cjne_a_Sdata_addr(uchar code) { uchar data, jaddr, ac; @@ -405,7 +425,7 @@ t_uc51::inst_cjne_a_Sdata_addr(uchar code) tick(1); SFR_SET_C((ac= acc->read()) < data); if (ac != data) - PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -417,11 +437,11 @@ t_uc51::inst_cjne_a_Sdata_addr(uchar code) */ int -t_uc51::inst_cjne_a_addr_addr(uchar code) +cl_51core::inst_cjne_a_addr_addr(uchar code) { uchar data, jaddr; t_addr a; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(a= fetch()); jaddr= fetch(); @@ -429,7 +449,7 @@ t_uc51::inst_cjne_a_addr_addr(uchar code) data= cell->read(); SFR_SET_C(acc->get() < data); if (acc->read() != data) - PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -441,10 +461,10 @@ t_uc51::inst_cjne_a_addr_addr(uchar code) */ int -t_uc51::inst_cjne_Sri_Sdata_addr(uchar code) +cl_51core::inst_cjne_Sri_Sdata_addr(uchar code) { uchar data, jaddr; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); data = fetch(); @@ -453,7 +473,7 @@ t_uc51::inst_cjne_Sri_Sdata_addr(uchar code) t_mem d; SFR_SET_C((d= cell->read()) < data); if (d != data) - PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -465,10 +485,10 @@ t_uc51::inst_cjne_Sri_Sdata_addr(uchar code) */ int -t_uc51::inst_cjne_rn_Sdata_addr(uchar code) +cl_51core::inst_cjne_rn_Sdata_addr(uchar code) { uchar data, jaddr; - class cl_cell *reg; + class cl_memory_cell *reg; reg = get_reg(code & 0x07); data = fetch(); @@ -477,7 +497,7 @@ t_uc51::inst_cjne_rn_Sdata_addr(uchar code) t_mem r; SFR_SET_C((r= reg->read()) < data); if (r != data) - PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -489,10 +509,10 @@ t_uc51::inst_cjne_rn_Sdata_addr(uchar code) */ int -t_uc51::inst_djnz_addr_addr(uchar code) +cl_51core::inst_djnz_addr_addr(uchar code) { uchar jaddr; - class cl_cell *cell; + class cl_memory_cell *cell; cell = get_direct(fetch()); jaddr= fetch(); @@ -500,7 +520,7 @@ t_uc51::inst_djnz_addr_addr(uchar code) t_mem d= cell->read(HW_PORT);//cell->wadd(-1); d= cell->write(d-1); if (d) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } @@ -512,17 +532,17 @@ t_uc51::inst_djnz_addr_addr(uchar code) */ int -t_uc51::inst_djnz_rn_addr(uchar code) +cl_51core::inst_djnz_rn_addr(uchar code) { uchar jaddr; - class cl_cell *reg; + class cl_memory_cell *reg; reg = get_reg(code & 0x07); jaddr= fetch(); tick(1); t_mem r= reg->wadd(-1); if (r) - PC= (PC + (signed char)jaddr) & (EROM_SIZE-1); + PC= rom->validate_address(PC + (signed char)jaddr); return(resGO); } diff --git a/sim/ucsim/s51.src/logic.cc b/sim/ucsim/s51.src/logic.cc index d7158110..229f80ce 100644 --- a/sim/ucsim/s51.src/logic.cc +++ b/sim/ucsim/s51.src/logic.cc @@ -42,9 +42,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_orl_addr_a(uchar code) +cl_51core::inst_orl_addr_a(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(cell->read(HW_PORT) | acc->read()); @@ -59,9 +59,9 @@ t_uc51::inst_orl_addr_a(uchar code) */ int -t_uc51::inst_orl_addr_Sdata(uchar code) +cl_51core::inst_orl_addr_Sdata(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; int res= resGO; cell= get_direct(fetch()); @@ -79,7 +79,7 @@ t_uc51::inst_orl_addr_Sdata(uchar code) */ int -t_uc51::inst_orl_a_Sdata(uchar code) +cl_51core::inst_orl_a_Sdata(uchar code) { uchar d; @@ -96,10 +96,10 @@ t_uc51::inst_orl_a_Sdata(uchar code) */ int -t_uc51::inst_orl_a_addr(uchar code) +cl_51core::inst_orl_a_addr(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); d= acc->read(); @@ -115,10 +115,10 @@ t_uc51::inst_orl_a_addr(uchar code) */ int -t_uc51::inst_orl_a_Sri(uchar code) +cl_51core::inst_orl_a_Sri(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); d= acc->read(); @@ -134,7 +134,7 @@ t_uc51::inst_orl_a_Sri(uchar code) */ int -t_uc51::inst_orl_a_rn(uchar code) +cl_51core::inst_orl_a_rn(uchar code) { t_mem d; @@ -151,9 +151,9 @@ t_uc51::inst_orl_a_rn(uchar code) */ int -t_uc51::inst_anl_addr_a(uchar code) +cl_51core::inst_anl_addr_a(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(cell->read(HW_PORT) & acc->read()); @@ -168,9 +168,9 @@ t_uc51::inst_anl_addr_a(uchar code) */ int -t_uc51::inst_anl_addr_Sdata(uchar code) +cl_51core::inst_anl_addr_Sdata(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; t_mem d; cell= get_direct(fetch()); @@ -188,7 +188,7 @@ t_uc51::inst_anl_addr_Sdata(uchar code) */ int -t_uc51::inst_anl_a_Sdata(uchar code) +cl_51core::inst_anl_a_Sdata(uchar code) { uchar d; @@ -205,10 +205,10 @@ t_uc51::inst_anl_a_Sdata(uchar code) */ int -t_uc51::inst_anl_a_addr(uchar code) +cl_51core::inst_anl_a_addr(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); d= acc->read(); @@ -224,10 +224,10 @@ t_uc51::inst_anl_a_addr(uchar code) */ int -t_uc51::inst_anl_a_Sri(uchar code) +cl_51core::inst_anl_a_Sri(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); d= acc->read(); @@ -243,7 +243,7 @@ t_uc51::inst_anl_a_Sri(uchar code) */ int -t_uc51::inst_anl_a_rn(uchar code) +cl_51core::inst_anl_a_rn(uchar code) { uchar d; @@ -260,9 +260,9 @@ t_uc51::inst_anl_a_rn(uchar code) */ int -t_uc51::inst_xrl_addr_a(uchar code) +cl_51core::inst_xrl_addr_a(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(cell->read(HW_PORT) ^ acc->read()); @@ -277,9 +277,9 @@ t_uc51::inst_xrl_addr_a(uchar code) */ int -t_uc51::inst_xrl_addr_Sdata(uchar code) +cl_51core::inst_xrl_addr_Sdata(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(cell->read(HW_PORT) ^ fetch()); @@ -295,7 +295,7 @@ t_uc51::inst_xrl_addr_Sdata(uchar code) */ int -t_uc51::inst_xrl_a_Sdata(uchar code) +cl_51core::inst_xrl_a_Sdata(uchar code) { uchar d; @@ -312,10 +312,10 @@ t_uc51::inst_xrl_a_Sdata(uchar code) */ int -t_uc51::inst_xrl_a_addr(uchar code) +cl_51core::inst_xrl_a_addr(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); d= acc->read(); @@ -331,10 +331,10 @@ t_uc51::inst_xrl_a_addr(uchar code) */ int -t_uc51::inst_xrl_a_Sri(uchar code) +cl_51core::inst_xrl_a_Sri(uchar code) { t_mem d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); d= acc->read(); @@ -350,7 +350,7 @@ t_uc51::inst_xrl_a_Sri(uchar code) */ int -t_uc51::inst_xrl_a_rn(uchar code) +cl_51core::inst_xrl_a_rn(uchar code) { t_mem d; @@ -367,7 +367,7 @@ t_uc51::inst_xrl_a_rn(uchar code) */ int -t_uc51::inst_cpl_a(uchar code) +cl_51core::inst_cpl_a(uchar code) { acc->write(~(acc->read())); return(resGO); diff --git a/sim/ucsim/s51.src/mov.cc b/sim/ucsim/s51.src/mov.cc index 512da92b..a932e9d1 100644 --- a/sim/ucsim/s51.src/mov.cc +++ b/sim/ucsim/s51.src/mov.cc @@ -49,7 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ int -t_uc51::inst_mov_a_Sdata(uchar code) +cl_51core::inst_mov_a_Sdata(uchar code) { acc->write(fetch()); return(resGO); @@ -63,9 +63,9 @@ t_uc51::inst_mov_a_Sdata(uchar code) */ int -t_uc51::inst_mov_addr_Sdata(uchar code) +cl_51core::inst_mov_addr_Sdata(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(fetch()); @@ -81,9 +81,9 @@ t_uc51::inst_mov_addr_Sdata(uchar code) */ int -t_uc51::inst_mov_Sri_Sdata(uchar code) +cl_51core::inst_mov_Sri_Sdata(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); t_mem d= fetch(); @@ -99,9 +99,9 @@ t_uc51::inst_mov_Sri_Sdata(uchar code) */ int -t_uc51::inst_mov_rn_Sdata(uchar code) +cl_51core::inst_mov_rn_Sdata(uchar code) { - class cl_cell *reg; + class cl_memory_cell *reg; reg= get_reg(code & 0x07); reg->write(fetch()); @@ -116,9 +116,9 @@ t_uc51::inst_mov_rn_Sdata(uchar code) */ int -t_uc51::inst_movc_a_Sa_pc(uchar code) +cl_51core::inst_movc_a_Sa_pc(uchar code) { - acc->write(mem(MEM_ROM)->read(PC + acc->read())); + acc->write(rom->read(PC + acc->read())); tick(1); return(resGO); } @@ -131,9 +131,9 @@ t_uc51::inst_movc_a_Sa_pc(uchar code) */ int -t_uc51::inst_mov_addr_addr(uchar code) +cl_51core::inst_mov_addr_addr(uchar code) { - class cl_cell *d, *s; + class cl_memory_cell *d, *s; /* SD reversed s & d here */ s= get_direct(fetch()); @@ -151,9 +151,9 @@ t_uc51::inst_mov_addr_addr(uchar code) */ int -t_uc51::inst_mov_addr_Sri(uchar code) +cl_51core::inst_mov_addr_Sri(uchar code) { - class cl_cell *d, *s; + class cl_memory_cell *d, *s; d= get_direct(fetch()); s= iram->get_cell(get_reg(code & 0x01)->read()); @@ -170,9 +170,9 @@ t_uc51::inst_mov_addr_Sri(uchar code) */ int -t_uc51::inst_mov_addr_rn(uchar code) +cl_51core::inst_mov_addr_rn(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(get_reg(code & 0x07)->read()); @@ -188,7 +188,7 @@ t_uc51::inst_mov_addr_rn(uchar code) */ int -t_uc51::inst_mov_dptr_Sdata(uchar code) +cl_51core::inst_mov_dptr_Sdata(uchar code) { sfr->write(DPH, fetch()); sfr->write(DPL, fetch()); @@ -204,11 +204,9 @@ t_uc51::inst_mov_dptr_Sdata(uchar code) */ int -t_uc51::inst_movc_a_Sa_dptr(uchar code) +cl_51core::inst_movc_a_Sa_dptr(uchar code) { - acc->write(get_mem(MEM_ROM, - sfr->read(DPH)*256+sfr->read(DPL) + - acc->read())); + acc->write(rom->read(sfr->read(DPH)*256+sfr->read(DPL) + acc->read())); tick(1); return(resGO); } @@ -221,9 +219,9 @@ t_uc51::inst_movc_a_Sa_dptr(uchar code) */ int -t_uc51::inst_mov_Sri_addr(uchar code) +cl_51core::inst_mov_Sri_addr(uchar code) { - class cl_cell *d, *s; + class cl_memory_cell *d, *s; d= iram->get_cell(get_reg(code & 0x01)->read()); s= get_direct(fetch()); @@ -240,9 +238,9 @@ t_uc51::inst_mov_Sri_addr(uchar code) */ int -t_uc51::inst_mov_rn_addr(uchar code) +cl_51core::inst_mov_rn_addr(uchar code) { - class cl_cell *reg, *cell; + class cl_memory_cell *reg, *cell; reg = get_reg(code & 0x07); cell= get_direct(fetch()); @@ -259,15 +257,21 @@ t_uc51::inst_mov_rn_addr(uchar code) */ int -t_uc51::inst_push(uchar code) +cl_51core::inst_push(uchar code) { - t_addr sp; - class cl_cell *stck, *cell; + t_addr sp, sp_before/*, sp_after*/; + t_mem data; + class cl_memory_cell *stck, *cell; cell= get_direct(fetch()); - sp= sfr->wadd(SP, 1); + sp_before= sfr->get(SP); + sp= /*sp_after= */sfr->wadd(SP, 1); stck= iram->get_cell(sp); - stck->write(cell->read()); + stck->write(data= cell->read()); + class cl_stack_op *so= + new cl_stack_push(instPC, data, sp_before, sp/*_after*/); + so->init(); + stack_write(so); tick(1); return(resGO); } @@ -280,10 +284,10 @@ t_uc51::inst_push(uchar code) */ int -t_uc51::inst_xch_a_addr(uchar code) +cl_51core::inst_xch_a_addr(uchar code) { t_mem temp; - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); temp= acc->read(); @@ -300,10 +304,10 @@ t_uc51::inst_xch_a_addr(uchar code) */ int -t_uc51::inst_xch_a_Sri(uchar code) +cl_51core::inst_xch_a_Sri(uchar code) { t_mem temp; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); temp= acc->read(); @@ -320,10 +324,10 @@ t_uc51::inst_xch_a_Sri(uchar code) */ int -t_uc51::inst_xch_a_rn(uchar code) +cl_51core::inst_xch_a_rn(uchar code) { t_mem temp; - class cl_cell *reg; + class cl_memory_cell *reg; reg = get_reg(code & 0x07); temp= acc->read(); @@ -340,16 +344,22 @@ t_uc51::inst_xch_a_rn(uchar code) */ int -t_uc51::inst_pop(uchar code) +cl_51core::inst_pop(uchar code) { - t_addr sp; - class cl_cell *cell, *stck; + t_addr sp, sp_before/*, sp_after*/; + t_mem data; + class cl_memory_cell *cell, *stck; + sp_before= sfr->get(SP); cell= get_direct(fetch()); stck= iram->get_cell(sfr->get(SP)); - cell->write(stck->read()); - sp= sfr->wadd(SP, -1); + cell->write(data= stck->read()); + sp= /*sp_after= */sfr->wadd(SP, -1); tick(1); + class cl_stack_op *so= + new cl_stack_pop(instPC, data, sp_before, sp/*_after*/); + so->init(); + stack_read(so); return(resGO); } @@ -361,10 +371,10 @@ t_uc51::inst_pop(uchar code) */ int -t_uc51::inst_xchd_a_Sri(uchar code) +cl_51core::inst_xchd_a_Sri(uchar code) { t_mem temp, d; - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); temp= (d= cell->read()) & 0x0f; @@ -381,10 +391,9 @@ t_uc51::inst_xchd_a_Sri(uchar code) */ int -t_uc51::inst_movx_a_Sdptr(uchar code) +cl_51core::inst_movx_a_Sdptr(uchar code) { - acc->write(read_mem(MEM_XRAM, - sfr->read(DPH)*256 + sfr->read(DPL))); + acc->write(xram->read(sfr->read(DPH)*256 + sfr->read(DPL))); tick(1); return(resGO); } @@ -397,12 +406,12 @@ t_uc51::inst_movx_a_Sdptr(uchar code) */ int -t_uc51::inst_movx_a_Sri(uchar code) +cl_51core::inst_movx_a_Sri(uchar code) { t_mem d; d= get_reg(code & 0x01)->read(); - acc->write(read_mem(MEM_XRAM, sfr->read(P2)*256 + d)); + acc->write(xram->read(sfr->read(P2)*256 + d)); tick(1); return(resGO); } @@ -415,26 +424,24 @@ t_uc51::inst_movx_a_Sri(uchar code) */ int -t_uc51::inst_mov_a_addr(uchar code) +cl_51core::inst_mov_a_addr(uchar code) { - class cl_cell *cell; - int address = fetch(); - + class cl_memory_cell *cell; + t_addr address= fetch(); + /* If this is ACC, it is an invalid instruction */ if (address == ACC) { - sim->app->get_commander()-> - debug ("Invalid Instruction : E5 E0 MOV A,ACC at %06x\n", PC); - - return(resHALT); + //sim->app->get_commander()-> + //debug("Invalid Instruction : E5 E0 MOV A,ACC at %06x\n", PC); + inst_unknown(); } else { cell= get_direct(address); acc->write(cell->read()); - return(resGO); } - + return(resGO); } @@ -445,9 +452,9 @@ t_uc51::inst_mov_a_addr(uchar code) */ int -t_uc51::inst_mov_a_Sri(uchar code) +cl_51core::inst_mov_a_Sri(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); acc->write(cell->read()); @@ -462,7 +469,7 @@ t_uc51::inst_mov_a_Sri(uchar code) */ int -t_uc51::inst_mov_a_rn(uchar code) +cl_51core::inst_mov_a_rn(uchar code) { acc->write(get_reg(code & 0x07)->read()); return(resGO); @@ -476,9 +483,9 @@ t_uc51::inst_mov_a_rn(uchar code) */ int -t_uc51::inst_movx_Sdptr_a(uchar code) +cl_51core::inst_movx_Sdptr_a(uchar code) { - write_mem(MEM_XRAM, sfr->read(DPH)*256 + sfr->read(DPL), acc->read()); + xram->write(sfr->read(DPH)*256 + sfr->read(DPL), acc->read()); tick(1); return(resGO); } @@ -491,12 +498,12 @@ t_uc51::inst_movx_Sdptr_a(uchar code) */ int -t_uc51::inst_movx_Sri_a(uchar code) +cl_51core::inst_movx_Sri_a(uchar code) { t_mem d; d= get_reg(code & 0x01)->read(); - write_mem(MEM_XRAM, sfr->read(P2)*256 + d, acc->read()); + xram->write(sfr->read(P2)*256 + d, acc->read()); tick(1); return(resGO); } @@ -509,9 +516,9 @@ t_uc51::inst_movx_Sri_a(uchar code) */ int -t_uc51::inst_mov_addr_a(uchar code) +cl_51core::inst_mov_addr_a(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= get_direct(fetch()); cell->write(acc->read()); @@ -526,9 +533,9 @@ t_uc51::inst_mov_addr_a(uchar code) */ int -t_uc51::inst_mov_Sri_a(uchar code) +cl_51core::inst_mov_Sri_a(uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell= iram->get_cell(get_reg(code & 0x01)->read()); cell->write(acc->read()); @@ -543,9 +550,9 @@ t_uc51::inst_mov_Sri_a(uchar code) */ int -t_uc51::inst_mov_rn_a(uchar code) +cl_51core::inst_mov_rn_a(uchar code) { - class cl_cell *reg; + class cl_memory_cell *reg; reg= get_reg(code &0x07); reg->write(acc->read()); diff --git a/sim/ucsim/s51.src/pca.cc b/sim/ucsim/s51.src/pca.cc index 173893aa..3497fa2c 100644 --- a/sim/ucsim/s51.src/pca.cc +++ b/sim/ucsim/s51.src/pca.cc @@ -47,10 +47,13 @@ cl_pca::cl_pca(class cl_uc *auc, int aid): int cl_pca::init(void) { - class cl_mem *sfr= uc->mem(MEM_SFR); - t_addr CCAPL[5]= {CCAPL[0], CCAPL[1], CCAPL[2], CCAPL[3], CCAPL[4]}; - t_addr CCAPH[5]= {CCAPH[0], CCAPH[1], CCAPH[2], CCAPH[3], CCAPH[4]}; - t_addr CCAPM[5]= {CCAPM[0], CCAPM[1], CCAPM[2], CCAPM[3], CCAPM[4]}; + sfr= uc->address_space(MEM_SFR_ID); + //t_addr CCAPL[5]= {CCAPL[0], CCAPL[1], CCAPL[2], CCAPL[3], CCAPL[4]}; + //t_addr CCAPH[5]= {CCAPH[0], CCAPH[1], CCAPH[2], CCAPH[3], CCAPH[4]}; + //t_addr CCAPM[5]= {CCAPM[0], CCAPM[1], CCAPM[2], CCAPM[3], CCAPM[4]}; + t_addr CCAPL[5]= {CCAP0L, CCAP1L, CCAP2L, CCAP3L, CCAP4L}; + t_addr CCAPH[5]= {CCAP0H, CCAP1H, CCAP2H, CCAP3H, CCAP4H}; + t_addr CCAPM[5]= {CCAPM0, CCAPM1, CCAPM2, CCAPM3, CCAPM4}; int i; if (!sfr) @@ -88,7 +91,7 @@ cl_pca::added_to_uc(void) } void -cl_pca::write(class cl_cell *cell, t_mem *val) +cl_pca::write(class cl_memory_cell *cell, t_mem *val) { //uchar bmCEX[5]= {bmCEX0, bmCEX1, bmCEX2, bmCEX3, bmCEX4}; //uchar bmCCF[5]= {bmCCF0, bmCCF1, bmCCF2, bmCCF3, bmCCF4}; @@ -139,9 +142,9 @@ cl_pca::write(class cl_cell *cell, t_mem *val) } /*void -cl_pca::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_pca::mem_cell_changed(class cl_m *mem, t_addr addr) { - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_m *sfr= uc->mem(MEM_SFR); if (mem && sfr && mem == sfr) { @@ -188,7 +191,7 @@ cl_pca::tick(int cycles) void cl_pca::do_pca_counter(int cycles) { - //class cl_mem *sfr= uc->mem(MEM_SFR); + //class cl_m *sfr= uc->mem(MEM_SFR); while (cycles--) { @@ -215,8 +218,6 @@ cl_pca::do_pca_counter(int cycles) void cl_pca::do_pca_module(int nr) { - class cl_mem *sfr= uc->mem(MEM_SFR); - uchar bmCEX[5]= {bmCEX0, bmCEX1, bmCEX2, bmCEX3, bmCEX4}; uchar bmCCF[5]= {bmCCF0, bmCCF1, bmCCF2, bmCCF3, bmCCF4}; //uint p1= sfr->get(P1); diff --git a/sim/ucsim/s51.src/pcacl.h b/sim/ucsim/s51.src/pcacl.h index c782118b..9c5ced51 100644 --- a/sim/ucsim/s51.src/pcacl.h +++ b/sim/ucsim/s51.src/pcacl.h @@ -40,10 +40,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_pca: public cl_hw { public: - class cl_cell *cell_cl, *cell_ch; - class cl_cell *cell_ccapl[5], *cell_ccaph[5], *cell_ccapm[5]; + class cl_address_space *sfr; + class cl_memory_cell *cell_cl, *cell_ch; + class cl_memory_cell *cell_ccapl[5], *cell_ccaph[5], *cell_ccapm[5]; t_mem ccapm[5]; - class cl_cell *cell_cmod, *cell_ccon; + class cl_memory_cell *cell_cmod, *cell_ccon; long t0_overflows, ECI_edge; t_mem clk_source; bool bit_CIDL, bit_WDTE, bit_ECF, bit_CR; @@ -54,11 +55,11 @@ public: virtual void added_to_uc(void); - //virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + //virtual t_mem read(class cl_memory_cell *cell); + virtual void write(class cl_memory_cell *cell, t_mem *val); //virtual t_mem set_cmd(t_mem value); - //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); virtual int tick(int cycles); virtual void do_pca_counter(int cycles); diff --git a/sim/ucsim/s51.src/port.cc b/sim/ucsim/s51.src/port.cc index 37cf983c..a02ad790 100644 --- a/sim/ucsim/s51.src/port.cc +++ b/sim/ucsim/s51.src/port.cc @@ -73,7 +73,7 @@ cl_port::init(void) } default: addr_p= P0; return(1); } - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); if (!sfr) { fprintf(stderr, "No SFR to register port into\n"); @@ -85,14 +85,14 @@ cl_port::init(void) } t_mem -cl_port::read(class cl_cell *cell) +cl_port::read(class cl_memory_cell *cell) { //printf("port[%d] read\n",id); return(cell->get() & port_pins); } void -cl_port::write(class cl_cell *cell, t_mem *val) +cl_port::write(class cl_memory_cell *cell, t_mem *val) { struct ev_port_changed ep; @@ -131,13 +131,14 @@ cl_port::set_cmd(class cl_cmdline *cmdline, class cl_console *con) } else { - con->dd_printf("Error: wrong systax\n"); + con->dd_printf("set hardware port[%d] pins_value\n Set port pins\n", + id); value= 0; } } /*void -cl_port::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_port::mem_cell_changed(class cl_m *mem, t_addr addr) { cl_hw::mem_cell_changed(mem, addr); t_mem d= sfr->get(); @@ -150,7 +151,7 @@ cl_port::print_info(class cl_console *con) uchar data; con->dd_printf("%s[%d]\n", id_string, id); - data= cell_p->get();//uc->get_mem(MEM_SFR, sfr); + data= cell_p->get(); con->dd_printf("P%d ", id); con->print_bin(data, 8); con->dd_printf(" 0x%02x %3d %c (Value in SFR register)\n", @@ -162,7 +163,6 @@ cl_port::print_info(class cl_console *con) con->dd_printf(" 0x%02x %3d %c (Output of outside circuits)\n", data, data, isprint(data)?data:'.'); - //data= /*uc->*/port_pins/*[id]*/ & sfr->get();//uc->get_mem(MEM_SFR, sfr); data= cell_p->read(); con->dd_printf("Port%d ", id); con->print_bin(data, 8); diff --git a/sim/ucsim/s51.src/portcl.h b/sim/ucsim/s51.src/portcl.h index b5a55ebe..001d7c9d 100644 --- a/sim/ucsim/s51.src/portcl.h +++ b/sim/ucsim/s51.src/portcl.h @@ -39,18 +39,18 @@ class cl_port: public cl_hw { public: t_addr addr_p; - class cl_cell *cell_p; + class cl_memory_cell *cell_p; t_mem port_pins; t_mem prev; public: cl_port(class cl_uc *auc, int aid); virtual int init(void); - virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + virtual t_mem read(class cl_memory_cell *cell); + virtual void write(class cl_memory_cell *cell, t_mem *val); virtual void set_cmd(class cl_cmdline *cmdline, class cl_console *con); - //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); //virtual int tick(int cycles); virtual void print_info(class cl_console *con); diff --git a/sim/ucsim/s51.src/s51.cc b/sim/ucsim/s51.src/s51.cc index 11eabe48..207f5dec 100644 --- a/sim/ucsim/s51.src/s51.cc +++ b/sim/ucsim/s51.src/s51.cc @@ -47,7 +47,8 @@ main(int argc, char *argv[]) int retval; //class cl_app *app; class cl_sim *sim; - + + cpus= cpus_51; application= new cl_app(); application->init(argc, argv); sim= new cl_sim51(application); diff --git a/sim/ucsim/s51.src/serial.cc b/sim/ucsim/s51.src/serial.cc index 3b5436d0..1b32248b 100644 --- a/sim/ucsim/s51.src/serial.cc +++ b/sim/ucsim/s51.src/serial.cc @@ -48,7 +48,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA cl_serial::cl_serial(class cl_uc *auc): cl_hw(auc, HW_UART, 0, "uart") -{} +{ + serial_in= serial_out= NIL; +} cl_serial::~cl_serial(void) { @@ -64,16 +66,18 @@ cl_serial::~cl_serial(void) tcsetattr(fileno(serial_in), TCSANOW, &saved_attributes_in); fclose(serial_in); } + delete serial_in_file_option; + delete serial_out_file_option; } int cl_serial::init(void) { - class cl_mem *sfr; int i; struct termios tattr; - sfr= uc->mem(MEM_SFR); + set_name("mcs51_uart"); + sfr= uc->address_space(MEM_SFR_ID); if (sfr) { //sbuf= sfr->register_hw(SBUF, this, 0); @@ -84,8 +88,23 @@ cl_serial::init(void) register_cell(sfr, SCON, &scon, wtd_restore_write); } - serial_in = (FILE*)application->args->get_parg(0, "Ser_in"); - serial_out= (FILE*)application->args->get_parg(0, "Ser_out"); + serial_in_file_option= new cl_optref(this); + serial_in_file_option->init(); + serial_in_file_option->use("serial_in_file"); + serial_out_file_option= new cl_optref(this); + serial_out_file_option->init(); + serial_out_file_option->use("serial_out_file"); + + //char *fni, *fno; + /*if ((fni= serial_in_file_option->get_value((char*)0))) + serial_in= fopen(fni, "r"); + if ((fno= serial_out_file_option->get_value((char*)0))) + serial_out= fopen(fno, "w");*/ + + //serial_in = (FILE*)application->args->get_parg(0, "Ser_in"); + //serial_out= (FILE*)application->args->get_parg(0, "Ser_out"); + serial_in = (FILE*)serial_in_file_option->get_value((void*)0); + serial_out= (FILE*)serial_out_file_option->get_value((void*)0); if (serial_in) { // making `serial' unbuffered @@ -156,7 +175,7 @@ cl_serial::new_hw_added(class cl_hw *new_hw) new_hw->id == 2) { there_is_t2= DD_TRUE; - t_mem d= uc->mem(MEM_SFR)->get(T2CON); + t_mem d= sfr->get(T2CON); t2_baud= d & (bmRCLK | bmTCLK); } } @@ -171,7 +190,7 @@ cl_serial::added_to_uc(void) } t_mem -cl_serial::read(class cl_cell *cell) +cl_serial::read(class cl_memory_cell *cell) { if (cell == sbuf) return(s_in); @@ -180,7 +199,7 @@ cl_serial::read(class cl_cell *cell) } void -cl_serial::write(class cl_cell *cell, t_mem *val) +cl_serial::write(class cl_memory_cell *cell, t_mem *val) { if (cell == sbuf) { @@ -236,9 +255,8 @@ cl_serial::write(class cl_cell *cell, t_mem *val) } /*void -cl_serial::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_serial::mem_cell_changed(class cl_m *mem, t_addr addr) { - class cl_mem *sfr= uc->mem(MEM_SFR); t_mem d; d= sbuf->get(); @@ -421,7 +439,7 @@ cl_serial::print_info(class cl_console *con) con->dd_printf(" (timer%d)", (t2_baud)?2:1); con->dd_printf(" MultiProc=%s", (mode&2)?((sc&bmSM2)?"ON":"OFF"):"none"); - con->dd_printf(" irq=%s", (uc->get_mem(MEM_SFR, IE)&bmES)?"en":"dis"); + con->dd_printf(" irq=%s", (sfr->get(IE)&bmES)?"en":"dis"); con->dd_printf(" prio=%d", uc->it_priority(bmPS)); con->dd_printf("\n"); diff --git a/sim/ucsim/s51.src/serialcl.h b/sim/ucsim/s51.src/serialcl.h index f4a375bd..ae6dee64 100644 --- a/sim/ucsim/s51.src/serialcl.h +++ b/sim/ucsim/s51.src/serialcl.h @@ -38,10 +38,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_serial: public cl_hw { protected: + class cl_address_space *sfr; bool there_is_t2, t2_baud; - class cl_cell *sbuf, *pcon, *scon; + class cl_memory_cell *sbuf, *pcon, *scon; struct termios saved_attributes_in; // Attributes of serial interface struct termios saved_attributes_out; + class cl_optref *serial_in_file_option; + class cl_optref *serial_out_file_option; FILE *serial_in; // Serial line input FILE *serial_out; // Serial line output uchar s_in; // Serial channel input reg @@ -66,10 +69,10 @@ public: virtual void new_hw_added(class cl_hw *new_hw); virtual void added_to_uc(void); - virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + virtual t_mem read(class cl_memory_cell *cell); + virtual void write(class cl_memory_cell *cell, t_mem *val); - //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); virtual int serial_bit_cnt(void); virtual void received(int c); diff --git a/sim/ucsim/s51.src/sim51.cc b/sim/ucsim/s51.src/sim51.cc index 658ad57b..e4c281df 100644 --- a/sim/ucsim/s51.src/sim51.cc +++ b/sim/ucsim/s51.src/sim51.cc @@ -57,12 +57,16 @@ class cl_uc * cl_sim51::mk_controller(void) { int i; + char *typ= NIL; + class cl_optref type_option(this); + type_option.init(); + type_option.use("cpu_type"); i= 0; - if (app->args->get_sarg('t', 0) == NULL) - app->args->add(new cl_prg_arg('t', 0, "C51")); + if ((typ= type_option.get_value(typ)) == NIL) + typ= "C51"; while ((cpus_51[i].type_str != NULL) && - (strcmp(app->args->get_sarg('t', 0), cpus_51[i].type_str) != 0)) + (strcmp(typ, cpus_51[i].type_str) != 0)) i++; if (cpus_51[i].type_str == NULL) { @@ -73,17 +77,17 @@ cl_sim51::mk_controller(void) switch (cpus_51[i].type) { case CPU_51: case CPU_31: - return(new t_uc51(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_51core(cpus_51[i].type, cpus_51[i].technology, this)); case CPU_52: case CPU_32: - return(new t_uc52(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_uc52(cpus_51[i].type, cpus_51[i].technology, this)); case CPU_51R: - return(new t_uc51r(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_uc51r(cpus_51[i].type, cpus_51[i].technology, this)); case CPU_89C51R: - return(new t_uc89c51r(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_uc89c51r(cpus_51[i].type, cpus_51[i].technology, this)); case CPU_251: - return(new t_uc251(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_uc251(cpus_51[i].type, cpus_51[i].technology, this)); case CPU_DS390: case CPU_DS390F: - return(new t_uc390(cpus_51[i].type, cpus_51[i].technology, this)); + return(new cl_uc390(cpus_51[i].type, cpus_51[i].technology, this)); } return(NULL); } diff --git a/sim/ucsim/s51.src/timer0.cc b/sim/ucsim/s51.src/timer0.cc index fddf0c82..281f8c18 100644 --- a/sim/ucsim/s51.src/timer0.cc +++ b/sim/ucsim/s51.src/timer0.cc @@ -81,7 +81,7 @@ cl_timer0::cl_timer0(class cl_uc *auc, int aid, char *aid_string): int cl_timer0::init(void) { - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); if (sfr) { @@ -129,7 +129,7 @@ cl_timer0::read(class cl_cell *cell) }*/ void -cl_timer0::write(class cl_cell *cell, t_mem *val) +cl_timer0::write(class cl_memory_cell *cell, t_mem *val) { if (cell == cell_tmod) { @@ -154,9 +154,9 @@ cl_timer0::write(class cl_cell *cell, t_mem *val) } /*void -cl_timer0::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_timer0::mem_cell_changed(class cl_m *mem, t_addr addr) { - //class cl_mem *sfr= uc->mem(MEM_SFR); + //class cl_m *sfr= uc->mem(MEM_SFR); //t_mem d; cl_hw::mem_cell_changed(mem, addr); @@ -375,6 +375,7 @@ cl_timer0::print_info(class cl_console *con) char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "2x8 bit" }; //t_mem tmod= cell_tmod->get(); int on; + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); con->dd_printf("%s[%d] 0x%04x", id_string, id, 256*cell_th->get()+cell_tl->get()); @@ -384,13 +385,13 @@ cl_timer0::print_info(class cl_console *con) if (/*tmod&bm*/GATE/*0*/) { con->dd_printf(" gated"); - on= /*uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & mask_*/INT/*bm_INT0*/; + on= INT; } else - on= TR/*cell_tcon->get(TCON) & mask_TR*/; + on= TR; con->dd_printf(" %s", on?"ON":"OFF"); con->dd_printf(" irq=%c", (cell_tcon->get()&mask_TF)?'1':'0'); - con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET0)?"en":"dis"); + con->dd_printf(" %s", sfr?"?":((sfr->get(IE)&bmET0)?"en":"dis")); con->dd_printf(" prio=%d", uc->it_priority(bmPT0)); con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer0cl.h b/sim/ucsim/s51.src/timer0cl.h index 950041fc..56184f9e 100644 --- a/sim/ucsim/s51.src/timer0cl.h +++ b/sim/ucsim/s51.src/timer0cl.h @@ -40,7 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_timer0: public cl_hw { protected: - class cl_cell *cell_tmod, *cell_tcon, *cell_tl, *cell_th; + class cl_memory_cell *cell_tmod, *cell_tcon, *cell_tl, *cell_th; t_mem mask_M0, mask_M1, mask_C_T, mask_GATE, mask_TR, mask_INT, mask_T, mask_TF; t_addr addr_tl, addr_th; @@ -52,7 +52,7 @@ public: virtual void added_to_uc(void); //virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + virtual void write(class cl_memory_cell *cell, t_mem *val); //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); diff --git a/sim/ucsim/s51.src/timer1.cc b/sim/ucsim/s51.src/timer1.cc index ccb0abd3..40221009 100644 --- a/sim/ucsim/s51.src/timer1.cc +++ b/sim/ucsim/s51.src/timer1.cc @@ -66,6 +66,7 @@ cl_timer1::print_info(class cl_console *con) char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "stop" }; //int tmod= cell_tmod->get(); int on; + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); con->dd_printf("%s[%d] 0x%04x", id_string, id, 256*cell_th->get()+cell_tl->get()); @@ -75,13 +76,13 @@ cl_timer1::print_info(class cl_console *con) if (/*tmod&bm*/GATE/*1*/) { con->dd_printf(" gated"); - on= /*uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & mask_*/INT/*bm_INT1*/; + on= INT; } else - on= cell_tcon->get() & mask_TR/*bmTR1*/; + on= cell_tcon->get() & mask_TR; con->dd_printf(" %s", on?"ON":"OFF"); con->dd_printf(" irq=%c", (cell_tcon->get()&mask_TF)?'1':'0'); - con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET1)?"en":"dis"); + con->dd_printf(" %s", sfr?"?":((sfr->get(IE)&bmET1)?"en":"dis")); con->dd_printf(" prio=%d", uc->it_priority(bmPT1)); con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer2.cc b/sim/ucsim/s51.src/timer2.cc index ea2ab95f..9a215c25 100644 --- a/sim/ucsim/s51.src/timer2.cc +++ b/sim/ucsim/s51.src/timer2.cc @@ -40,8 +40,12 @@ cl_timer2::cl_timer2(class cl_uc *auc, int aid, char *aid_string, mask_TCLK= bmTCLK; mask_CP_RL2= bmCP_RL2; make_partner(HW_UART, 0); + sfr= uc->address_space(MEM_SFR_ID); if (features & (t2_down|t2_clock_out)) - register_cell(uc->mem(MEM_SFR), T2MOD, &cell_t2mod, wtd_restore_write); + { + register_cell(sfr, T2MOD, &cell_t2mod, + wtd_restore_write); + } } int @@ -50,9 +54,10 @@ cl_timer2::init(void) cl_timer0::init(); //cell_rcap2l= uc->mem(MEM_SFR)->get_cell(RCAP2L); //cell_rcap2h= uc->mem(MEM_SFR)->get_cell(RCAP2H); - use_cell(uc->mem(MEM_SFR), RCAP2L, &cell_rcap2l, wtd_restore); - use_cell(uc->mem(MEM_SFR), RCAP2H, &cell_rcap2h, wtd_restore); - bit_t2ex= uc->read_mem(MEM_SFR, P1) & bmT2EX; + use_cell(sfr, RCAP2L, &cell_rcap2l, wtd_restore); + use_cell(sfr, RCAP2H, &cell_rcap2h, wtd_restore); + if (sfr) + bit_t2ex= sfr->read(P1) & bmT2EX; return(0); } @@ -102,7 +107,7 @@ cl_timer2::added(class cl_hw *new_hw) }*/ void -cl_timer2::write(class cl_cell *cell, t_mem *val) +cl_timer2::write(class cl_memory_cell *cell, t_mem *val) { int oldmode= mode; bool oldtr= TR; @@ -316,10 +321,12 @@ cl_timer2::do_t2_down(int cycles) toggle= DD_TRUE; } } - if (toggle) + if (toggle && + sfr) { - class cl_cell *p1= uc->mem(MEM_SFR)->get_cell(P1); - p1->set(p1->get() ^ bmEXF2); + class cl_memory_cell *p1= sfr->get_cell(P1); + if (p1) + p1->set(p1->get() ^ bmEXF2); } } @@ -348,11 +355,13 @@ cl_timer2::do_t2_clock_out(int cycles) cell_th->set(cell_rcap2h->get()); cell_tl->set(cell_rcap2l->get()); inform_partners(EV_OVERFLOW, 0); - if (!C_T) + if (!C_T && + sfr) { // toggle T2 on P1 - class cl_cell *p1= uc->mem(MEM_SFR)->get_cell(P1); - p1->set(p1->get() ^ bmT2); + class cl_memory_cell *p1= sfr->get_cell(P1); + if (p1) + p1->set(p1->get() ^ bmT2); } } } @@ -401,7 +410,7 @@ cl_timer2::print_info(class cl_console *con) con->dd_printf(" %s", (C_T)?"counter":"timer"); con->dd_printf(" %s", (TR)?"ON":"OFF"); con->dd_printf(" irq=%c", (t2con&bmTF2)?'1':'0'); - con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET2)?"en":"dis"); + con->dd_printf(" %s", sfr?"?":((sfr->get(IE)&bmET2)?"en":"dis")); con->dd_printf(" prio=%d", uc->it_priority(bmPT2)); con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer2cl.h b/sim/ucsim/s51.src/timer2cl.h index c5cb0cdb..57e7b4f3 100644 --- a/sim/ucsim/s51.src/timer2cl.h +++ b/sim/ucsim/s51.src/timer2cl.h @@ -54,12 +54,13 @@ enum t2_features { class cl_timer2: public cl_timer0 { protected: + class cl_address_space *sfr; int features; class cl_it_src *exf2it; t_mem mask_RCLK, mask_TCLK, mask_CP_RL2; t_mem RCLK, TCLK, CP_RL2, EXEN2; long t2ex_edge; - class cl_cell *cell_rcap2l, *cell_rcap2h, *cell_t2mod; + class cl_memory_cell *cell_rcap2l, *cell_rcap2h, *cell_t2mod; bool bit_dcen, bit_t2oe, bit_t2ex; public: cl_timer2(class cl_uc *auc, int aid, char *aid_string, int afeautres); @@ -69,7 +70,7 @@ public: //virtual void new_hw_added(class cl_hw *new_hw); //virtual ulong read(class cl_mem *mem, long addr); - virtual void write(class cl_cell *cell, t_mem *val); + virtual void write(class cl_memory_cell *cell, t_mem *val); //virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); diff --git a/sim/ucsim/s51.src/uc251.cc b/sim/ucsim/s51.src/uc251.cc index 74d21ff7..3694bac3 100644 --- a/sim/ucsim/s51.src/uc251.cc +++ b/sim/ucsim/s51.src/uc251.cc @@ -36,8 +36,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA * Making an 251 CPU object */ -t_uc251::t_uc251(int Itype, int Itech, class cl_sim *asim): - t_uc89c51r(Itype, Itech, asim) +cl_uc251::cl_uc251(int Itype, int Itech, class cl_sim *asim): + cl_uc89c51r(Itype, Itech, asim) { } diff --git a/sim/ucsim/s51.src/uc251cl.h b/sim/ucsim/s51.src/uc251cl.h index 0f710601..931e988e 100644 --- a/sim/ucsim/s51.src/uc251cl.h +++ b/sim/ucsim/s51.src/uc251cl.h @@ -33,10 +33,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "uc89c51rcl.h" -class t_uc251: public t_uc89c51r +class cl_uc251: public cl_uc89c51r { public: - t_uc251(int Itype, int Itech, class cl_sim *asim); + cl_uc251(int Itype, int Itech, class cl_sim *asim); }; diff --git a/sim/ucsim/s51.src/uc390.cc b/sim/ucsim/s51.src/uc390.cc index 623d3915..05ebe08e 100644 --- a/sim/ucsim/s51.src/uc390.cc +++ b/sim/ucsim/s51.src/uc390.cc @@ -58,8 +58,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct dis_entry disass_390f[] = { { 0x00, 0xff, ' ', 1, "NOP"}, - { 0x01, 0xff, 'A', 3, "AJMP %A"}, - { 0x02, 0xff, 'L', 4, "LJMP %l"}, + { 0x01, 0xff, 'A', 3, "AJMP %A"}, + { 0x02, 0xff, 'L', 4, "LJMP %l"}, { 0x03, 0xff, ' ', 1, "RR A"}, { 0x04, 0xff, ' ', 1, "INC A"}, { 0x05, 0xff, ' ', 2, "INC %a"}, @@ -74,8 +74,8 @@ struct dis_entry disass_390f[] = { { 0x0e, 0xff, ' ', 1, "INC R6"}, { 0x0f, 0xff, ' ', 1, "INC R7"}, { 0x10, 0xff, 'R', 3, "JBC %b,%R"}, - { 0x11, 0xff, 'a', 3, "ACALL %A"}, - { 0x12, 0xff, 'l', 4, "LCALL %l"}, + { 0x11, 0xff, 'a', 3, "ACALL %A"}, + { 0x12, 0xff, 'l', 4, "LCALL %l"}, { 0x13, 0xff, ' ', 1, "RRC A"}, { 0x14, 0xff, ' ', 1, "DEC A"}, { 0x15, 0xff, ' ', 2, "DEC %a"}, @@ -90,8 +90,8 @@ struct dis_entry disass_390f[] = { { 0x1e, 0xff, ' ', 1, "DEC R6"}, { 0x1f, 0xff, ' ', 1, "DEC R7"}, { 0x20, 0xff, 'R', 3, "JB %b,%R"}, - { 0x21, 0xff, 'A', 3, "AJMP %A"}, - { 0x22, 0xff, '_', 1, "RET"}, + { 0x21, 0xff, 'A', 3, "AJMP %A"}, + { 0x22, 0xff, '_', 1, "RET"}, { 0x23, 0xff, ' ', 1, "RL A"}, { 0x24, 0xff, ' ', 2, "ADD A,#%d"}, { 0x25, 0xff, ' ', 2, "ADD A,%a"}, @@ -106,8 +106,8 @@ struct dis_entry disass_390f[] = { { 0x2e, 0xff, ' ', 1, "ADD A,R6"}, { 0x2f, 0xff, ' ', 1, "ADD A,R7"}, { 0x30, 0xff, 'R', 3, "JNB %b,%R"}, - { 0x31, 0xff, 'a', 3, "ACALL %A"}, - { 0x32, 0xff, '_', 1, "RETI"}, + { 0x31, 0xff, 'a', 3, "ACALL %A"}, + { 0x32, 0xff, '_', 1, "RETI"}, { 0x33, 0xff, ' ', 1, "RLC A"}, { 0x34, 0xff, ' ', 2, "ADDC A,#%d"}, { 0x35, 0xff, ' ', 2, "ADDC A,%a"}, @@ -122,7 +122,7 @@ struct dis_entry disass_390f[] = { { 0x3e, 0xff, ' ', 1, "ADDC A,R6"}, { 0x3f, 0xff, ' ', 1, "ADDC A,R7"}, { 0x40, 0xff, 'r', 2, "JC %r"}, - { 0x41, 0xff, 'A', 3, "AJMP %A"}, + { 0x41, 0xff, 'A', 3, "AJMP %A"}, { 0x42, 0xff, ' ', 2, "ORL %a,A"}, { 0x43, 0xff, ' ', 3, "ORL %a,#%D"}, { 0x44, 0xff, ' ', 2, "ORL A,#%d"}, @@ -138,7 +138,7 @@ struct dis_entry disass_390f[] = { { 0x4e, 0xff, ' ', 1, "ORL A,R6"}, { 0x4f, 0xff, ' ', 1, "ORL A,R7"}, { 0x50, 0xff, 'r', 2, "JNC %r"}, - { 0x51, 0xff, 'a', 3, "ACALL %A"}, + { 0x51, 0xff, 'a', 3, "ACALL %A"}, { 0x52, 0xff, ' ', 2, "ANL %a,A"}, { 0x53, 0xff, ' ', 3, "ANL %a,#%D"}, { 0x54, 0xff, ' ', 2, "ANL A,#%d"}, @@ -154,7 +154,7 @@ struct dis_entry disass_390f[] = { { 0x5e, 0xff, ' ', 1, "ANL A,R6"}, { 0x5f, 0xff, ' ', 1, "ANL A,R7"}, { 0x60, 0xff, 'r', 2, "JZ %r"}, - { 0x61, 0xff, 'A', 3, "AJMP %A"}, + { 0x61, 0xff, 'A', 3, "AJMP %A"}, { 0x62, 0xff, ' ', 2, "XRL %a,A"}, { 0x63, 0xff, ' ', 3, "XRL %a,#%D"}, { 0x64, 0xff, ' ', 2, "XRL A,#%d"}, @@ -170,7 +170,7 @@ struct dis_entry disass_390f[] = { { 0x6e, 0xff, ' ', 1, "XRL A,R6"}, { 0x6f, 0xff, ' ', 1, "XRL A,R7"}, { 0x70, 0xff, 'r', 2, "JNZ %r"}, - { 0x71, 0xff, 'a', 3, "ACALL %A"}, + { 0x71, 0xff, 'a', 3, "ACALL %A"}, { 0x72, 0xff, ' ', 2, "ORL C,%b"}, { 0x73, 0xff, '_', 1, "JMP @A+DPTR"}, { 0x74, 0xff, ' ', 2, "MOV A,#%d"}, @@ -186,7 +186,7 @@ struct dis_entry disass_390f[] = { { 0x7e, 0xff, ' ', 2, "MOV R6,#%d"}, { 0x7f, 0xff, ' ', 2, "MOV R7,#%d"}, { 0x80, 0xff, 's', 2, "SJMP %r"}, - { 0x81, 0xff, 'A', 3, "AJMP %A"}, + { 0x81, 0xff, 'A', 3, "AJMP %A"}, { 0x82, 0xff, ' ', 2, "ANL C,%b"}, { 0x83, 0xff, ' ', 1, "MOVC A,@A+PC"}, { 0x84, 0xff, ' ', 1, "DIV AB"}, @@ -201,8 +201,8 @@ struct dis_entry disass_390f[] = { { 0x8d, 0xff, ' ', 2, "MOV %a,R5"}, { 0x8e, 0xff, ' ', 2, "MOV %a,R6"}, { 0x8f, 0xff, ' ', 2, "MOV %a,R7"}, - { 0x90, 0xff, ' ', 4, "MOV DPTR,#%l"}, - { 0x91, 0xff, 'a', 3, "ACALL %A"}, + { 0x90, 0xff, ' ', 4, "MOV DPTR,#%l"}, + { 0x91, 0xff, 'a', 3, "ACALL %A"}, { 0x92, 0xff, ' ', 2, "MOV %b,C"}, { 0x93, 0xff, ' ', 1, "MOVC A,@A+DPTR"}, { 0x94, 0xff, ' ', 2, "SUBB A,#%d"}, @@ -218,7 +218,7 @@ struct dis_entry disass_390f[] = { { 0x9e, 0xff, ' ', 1, "SUBB A,R6"}, { 0x9f, 0xff, ' ', 1, "SUBB A,R7"}, { 0xa0, 0xff, ' ', 2, "ORL C,/%b"}, - { 0xa1, 0xff, 'A', 3, "AJMP %A"}, + { 0xa1, 0xff, 'A', 3, "AJMP %A"}, { 0xa2, 0xff, ' ', 2, "MOV C,%b"}, { 0xa3, 0xff, ' ', 1, "INC DPTR"}, { 0xa4, 0xff, ' ', 1, "MUL AB"}, @@ -234,7 +234,7 @@ struct dis_entry disass_390f[] = { { 0xae, 0xff, ' ', 2, "MOV R6,%a"}, { 0xaf, 0xff, ' ', 2, "MOV R7,%a"}, { 0xb0, 0xff, ' ', 2, "ANL C,/%b"}, - { 0xb1, 0xff, 'a', 3, "ACALL %A"}, + { 0xb1, 0xff, 'a', 3, "ACALL %A"}, { 0xb2, 0xff, ' ', 2, "CPL %b"}, { 0xb3, 0xff, ' ', 1, "CPL C"}, { 0xb4, 0xff, 'R', 3, "CJNE A,#%d,%R"}, @@ -249,8 +249,8 @@ struct dis_entry disass_390f[] = { { 0xbd, 0xff, 'R', 3, "CJNE R5,#%d,%R"}, { 0xbe, 0xff, 'R', 3, "CJNE R6,#%d,%R"}, { 0xbf, 0xff, 'R', 3, "CJNE R7,#%d,%R"}, - { 0xc0, 0xff, ' ', 2, "PUSH %a"}, - { 0xc1, 0xff, 'A', 3, "AJMP %A"}, + { 0xc0, 0xff, ' ', 2, "PUSH %a"}, + { 0xc1, 0xff, 'A', 3, "AJMP %A"}, { 0xc2, 0xff, ' ', 2, "CLR %b"}, { 0xc3, 0xff, ' ', 1, "CLR C"}, { 0xc4, 0xff, ' ', 1, "SWAP A"}, @@ -265,8 +265,8 @@ struct dis_entry disass_390f[] = { { 0xcd, 0xff, ' ', 1, "XCH A,R5"}, { 0xce, 0xff, ' ', 1, "XCH A,R6"}, { 0xcf, 0xff, ' ', 1, "XCH A,R7"}, - { 0xd0, 0xff, ' ', 2, "POP %a"}, - { 0xd1, 0xff, 'a', 3, "ACALL %A"}, + { 0xd0, 0xff, ' ', 2, "POP %a"}, + { 0xd1, 0xff, 'a', 3, "ACALL %A"}, { 0xd2, 0xff, ' ', 2, "SETB %b"}, { 0xd3, 0xff, ' ', 1, "SETB C"}, { 0xd4, 0xff, ' ', 1, "DA A"}, @@ -282,7 +282,7 @@ struct dis_entry disass_390f[] = { { 0xde, 0xff, 'r', 2, "DJNZ R6,%r"}, { 0xdf, 0xff, 'r', 2, "DJNZ R7,%r"}, { 0xe0, 0xff, ' ', 1, "MOVX A,@DPTR"}, - { 0xe1, 0xff, 'A', 3, "AJMP %A"}, + { 0xe1, 0xff, 'A', 3, "AJMP %A"}, { 0xe2, 0xff, ' ', 1, "MOVX A,@R0"}, { 0xe3, 0xff, ' ', 1, "MOVX A,@R1"}, { 0xe4, 0xff, ' ', 1, "CLR A"}, @@ -298,7 +298,7 @@ struct dis_entry disass_390f[] = { { 0xee, 0xff, ' ', 1, "MOV A,R6"}, { 0xef, 0xff, ' ', 1, "MOV A,R7"}, { 0xf0, 0xff, ' ', 1, "MOVX @DPTR,A"}, - { 0xf1, 0xff, 'a', 3, "ACALL %A"}, + { 0xf1, 0xff, 'a', 3, "ACALL %A"}, { 0xf2, 0xff, ' ', 1, "MOVX @R0,A"}, { 0xf3, 0xff, ' ', 1, "MOVX @R1,A"}, { 0xf4, 0xff, ' ', 1, "CPL A"}, @@ -320,146 +320,181 @@ struct dis_entry disass_390f[] = { * Making an 390 CPU object */ -t_uc390::t_uc390 (int Itype, int Itech, class cl_sim *asim): - t_uc52 (Itype, Itech, asim) +cl_uc390::cl_uc390 (int Itype, int Itech, class cl_sim *asim): + cl_uc52 (Itype, Itech, asim) { if (Itype == CPU_DS390F) { - printf ("24-bit flat mode, warning: lots of sfr-functions not implemented!\n> "); + printf ("24-bit flat mode, warning: lots of sfr-functions not implemented!\n"); flat24_flag = 1; } // todo: add interrupt sources } void -t_uc390::mk_hw_elements (void) +cl_uc390::mk_hw_elements (void) { class cl_hw *h; - t_uc52::mk_hw_elements(); + cl_uc52::mk_hw_elements(); hws->add (h = new cl_uc390_hw (this)); h->init(); } +void +cl_uc390::make_memories(void) +{ + class cl_address_space *as; + + rom= as= new cl_address_space(MEM_ROM_ID, 0, 0x20000, 8); + as->init(); + address_spaces->add(as); + iram= as= new cl_address_space(MEM_IRAM_ID, 0, 0x100, 8); + as->init(); + address_spaces->add(as); + sfr= as= new cl_address_space(MEM_SFR_ID, 0x80, 0x80, 8); + as->init(); + address_spaces->add(as); + xram= as= new cl_address_space(MEM_XRAM_ID, 0, 0x100000+128, 8); + as->init(); + address_spaces->add(as); + as= new cl_address_space(MEM_IXRAM_ID, 0, 0x1000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x20000, 8, 0xff); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= rom, chip, 0, 0x1ffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x100, 8, 0); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= iram, chip, 0, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("xram_chip", 0x100000+128, 8, 0); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= xram, chip, 0, 0x10007f, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("ixram_chip", 0x1000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space(MEM_IXRAM_ID), + chip, 0, 0xfff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("sfr_chip", 0x80, 8, 0); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= sfr, chip, 0x80, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + acc= sfr->get_cell(ACC); + psw= sfr->get_cell(PSW); +} + + /* * Setting up SFR area to reset value */ void -t_uc390::clear_sfr(void) +cl_uc390::clear_sfr(void) { - int i; - - for (i = 0; i < SFR_SIZE; i++) - sfr->set(i, 0); - /* SFR value */ - sfr->set(0x80, 0xff); /* P4 */ - sfr->set(0x81, 0x07); /* SP */ - sfr->set(0x86, 0x04); /* DPS */ - sfr->set(0x90, 0xff); /* P1 */ - sfr->set(0x92, 0xbf); /* P4CNT */ - sfr->set(0x9b, 0xfc); /* ESP */ + cl_uc52::clear_sfr(); + /* SFR value */ + sfr->write(0x80, 0xff); /* P4 */ + sfr->write(0x81, 0x07); /* SP */ + sfr->write(0x86, 0x04); /* DPS */ + sfr->write(0x90, 0xff); /* P1 */ + sfr->write(0x92, 0xbf); /* P4CNT */ + sfr->write(0x9b, 0xfc); /* ESP */ if (flat24_flag) - sfr->set(ACON, 0xfa); /* ACON; AM1 set: 24-bit flat */ + sfr->/*write*/set(ACON, 0xfa); /* ACON; AM1 set: 24-bit flat */ else - sfr->set(ACON, 0xf8); /* ACON */ - sfr->set(0xa0, 0xff); /* P2 */ - sfr->set(0xa1, 0xff); /* P5 */ - sfr->set(0xa3, 0x09); /* COC */ - sfr->set(0xb0, 0xff); /* P3 */ - sfr->set(0xb8, 0x80); /* IP */ - sfr->set(0xc5, 0x10); /* STATUS */ - sfr->set(0xc6, 0x10); /* MCON */ - sfr->set(0xc7, 0xff); /* TA */ - sfr->set(0xc9, 0xe4); /* T2MOD */ - sfr->set(0xd2, 0x2f); /* MCNT1 */ - sfr->set(0xe3, 0x09); /* C1C */ - - sfr->/*set*/write(P0, 0xff); - sfr->/*set*/write(P1, 0xff); - sfr->/*set*/write(P2, 0xff); - sfr->/*set*/write(P3, 0xff); - sfr->/*set*/write(SP, 7); - prev_p1 = sfr->/*get*/read(P1); - prev_p3 = sfr->/*get*/read(P3); + sfr->/*write*/set(ACON, 0xf8); /* ACON */ + sfr->write(0xa0, 0xff); /* P2 */ + sfr->write(0xa1, 0xff); /* P5 */ + sfr->write(0xa3, 0x09); /* COC */ + sfr->write(0xb0, 0xff); /* P3 */ + sfr->write(0xb8, 0x80); /* IP */ + sfr->write(0xc5, 0x10); /* STATUS */ + sfr->write(0xc6, 0x10); /* MCON */ + sfr->write(0xc7, 0xff); /* TA */ + sfr->write(0xc9, 0xe4); /* T2MOD */ + sfr->write(0xd2, 0x2f); /* MCNT1 */ + sfr->write(0xe3, 0x09); /* C1C */ } -t_addr -t_uc390::get_mem_size (enum mem_class type) -{ - switch (type) - { - case MEM_ROM: - return 128*1024; // 128 kByte; 4 MByte possible - case MEM_XRAM: - /* tinibios copies 128 bytes of the Interrupt Vector Table - to 0x100000. This is exactly the minimum of memory to run ucSim - without any error. */ - return 1*1024*1024 + 128; // 1 MByte + 128 bytes; 4 Mbytes possible - case MEM_IRAM: - return 256; - case MEM_SFR: - return 256; - case MEM_IXRAM: - return 4*1024; // internal XRAM - case MEM_TYPES: - default: - return 0; - } - return 0; -} t_mem -t_uc390::read_mem(enum mem_class type, t_addr addr) +cl_uc390::read_mem(char *id/*enum mem_class type*/, t_addr addr) { - if (type == MEM_XRAM && + if (strcmp(/*type*/id,/* == */MEM_XRAM_ID)==0 && addr >= 0x400000 && (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ { addr -= 0x400000; - type = MEM_IXRAM; + id/*type*/ = MEM_IXRAM_ID; } - return t_uc51::read_mem (type, addr); /* 24 bit */ + return cl_51core::read_mem(id/*type*/, addr); /* 24 bit */ } t_mem -t_uc390::get_mem (enum mem_class type, t_addr addr) +cl_uc390::get_mem (char *id/*enum mem_class type*/, t_addr addr) { - if (type == MEM_XRAM && + if (strcmp(/*type*/id/* == */,MEM_XRAM_ID)==0 && addr >= 0x400000 && (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ { addr -= 0x400000; - type = MEM_IXRAM; + /*type*/id = MEM_IXRAM_ID; } - return t_uc51::get_mem (type, addr); + return cl_51core::get_mem (/*type*/id, addr); } void -t_uc390::write_mem (enum mem_class type, t_addr addr, t_mem val) +cl_uc390::write_mem (char *id/*enum mem_class type*/, t_addr addr, t_mem val) { - if (type == MEM_XRAM && + if (strcmp(/*type ==*/id, MEM_XRAM_ID)==0 && addr >= 0x400000 && (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ { addr -= 0x400000; - type = MEM_IXRAM; + /*type*/id = MEM_IXRAM_ID; } - t_uc51::write_mem (type, addr, val); + cl_51core::write_mem (/*type*/id, addr, val); } void -t_uc390::set_mem (enum mem_class type, t_addr addr, t_mem val) +cl_uc390::set_mem (/*enum mem_class type*/char *id, t_addr addr, t_mem val) { - if (type == MEM_XRAM && + if (/*type == */strcmp(id,MEM_XRAM_ID)==0 && addr >= 0x400000 && (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ { addr -= 0x400000; - type = MEM_IXRAM; + /*type*/id = MEM_IXRAM_ID; } - t_uc51::set_mem (type, addr, val); + cl_51core::set_mem (id/*type*/, addr, val); } /* @@ -467,7 +502,7 @@ t_uc390::set_mem (enum mem_class type, t_addr addr, t_mem val) */ void -t_uc390::push_byte (t_mem uc) +cl_uc390::push_byte (t_mem uc) { t_addr sp; @@ -477,11 +512,11 @@ t_uc390::push_byte (t_mem uc) if (sp == 0) /* overflow SP */ sfr->wadd (ESP, 1); sp += (sfr->read (ESP) & 0x3) * 256; - write_mem (MEM_IXRAM, sp, uc); // fixme + write_mem (MEM_IXRAM_ID, sp, uc); // fixme } else { - class cl_cell *stck; + class cl_memory_cell *stck; stck = iram->get_cell (sp); stck->write (uc); @@ -489,7 +524,7 @@ t_uc390::push_byte (t_mem uc) } t_mem -t_uc390::pop_byte (void) +cl_uc390::pop_byte (void) { t_mem temp; t_addr sp; @@ -498,7 +533,7 @@ t_uc390::pop_byte (void) { sp = sfr->read (SP); sp += (sfr->read (ESP) & 0x3) * 256; - temp = read_mem (MEM_IXRAM, sp); // fixme + temp = read_mem (MEM_IXRAM_ID, sp); // fixme sp = sfr->wadd (SP, -1); if (sp == 0xff) /* underflow SP */ sfr->wadd (ESP, -1); @@ -506,7 +541,7 @@ t_uc390::pop_byte (void) } else { - class cl_cell *stck; + class cl_memory_cell *stck; stck = iram->get_cell (sfr->get (SP)); temp = stck->read(); @@ -522,7 +557,7 @@ t_uc390::pop_byte (void) */ int -t_uc390::inst_inc_dptr (uchar code) +cl_uc390::inst_inc_dptr (uchar code) { ulong dptr; @@ -568,7 +603,7 @@ t_uc390::inst_inc_dptr (uchar code) */ int -t_uc390::inst_jmp_Sa_dptr (uchar code) +cl_uc390::inst_jmp_Sa_dptr (uchar code) { uchar pl, ph, px, dps; @@ -586,8 +621,8 @@ t_uc390::inst_jmp_Sa_dptr (uchar code) px = DPX; } - PC = (sfr->read (ph) * 256 + sfr->read (pl) + acc->read()) & - (EROM_SIZE - 1); + PC = rom->validate_address(sfr->read (ph) * 256 + sfr->read (pl) + + acc->read()); if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ PC += sfr->read (px) * 256*256; @@ -602,7 +637,7 @@ t_uc390::inst_jmp_Sa_dptr (uchar code) */ int -t_uc390::inst_mov_dptr_Sdata (uchar code) +cl_uc390::inst_mov_dptr_Sdata (uchar code) { uchar pl, ph, px, dps; @@ -640,7 +675,7 @@ t_uc390::inst_mov_dptr_Sdata (uchar code) */ int -t_uc390::inst_movc_a_Sa_dptr (uchar code) +cl_uc390::inst_movc_a_Sa_dptr (uchar code) { uchar pl, ph, px, dps; @@ -659,13 +694,12 @@ t_uc390::inst_movc_a_Sa_dptr (uchar code) } if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ - acc->write (read_mem (MEM_ROM, - (sfr->read (px) * 256*256 + sfr->read (ph) * 256 + sfr->read (pl) + + acc->write (rom->read ((sfr->read (px) * 256*256 + + sfr->read (ph) * 256 + sfr->read (pl) + acc->read()))); else - acc->write (read_mem (MEM_ROM, - (sfr->read (ph) * 256 + sfr->read (pl) + - acc->read()))); + acc->write (rom->read ((sfr->read (ph) * 256 + sfr->read (pl) + + acc->read()))); if (dps & 0x20) /* auto-switch dptr */ sfr->write (DPS, dps ^ 1); /* toggle dual-dptr switch */ @@ -681,12 +715,18 @@ t_uc390::inst_movc_a_Sa_dptr (uchar code) */ int -t_uc390::inst_push (uchar code) +cl_uc390::inst_push (uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; cell = get_direct(fetch()); - push_byte (cell->read()); + t_addr sp_before= sfr->get(SP); + t_mem data; + push_byte (data= cell->read()); + class cl_stack_op *so= + new cl_stack_push(instPC, data, sp_before, sfr->get(SP)); + so->init(); + stack_write(so); tick (1); return resGO; } @@ -699,12 +739,18 @@ t_uc390::inst_push (uchar code) */ int -t_uc390::inst_pop (uchar code) +cl_uc390::inst_pop (uchar code) { - class cl_cell *cell; + class cl_memory_cell *cell; + t_addr sp_before= sfr->get(SP); + t_mem data; cell = get_direct (fetch()); - cell->write (pop_byte()); + cell->write (data= pop_byte()); + class cl_stack_op *so= + new cl_stack_pop(instPC, data, sp_before, sfr->get(SP)); + so->init(); + stack_read(so); tick (1); return resGO; } @@ -717,7 +763,7 @@ t_uc390::inst_pop (uchar code) */ int -t_uc390::inst_movx_a_Sdptr (uchar code) +cl_uc390::inst_movx_a_Sdptr (uchar code) { uchar pl, ph, px, dps; @@ -736,10 +782,10 @@ t_uc390::inst_movx_a_Sdptr (uchar code) } if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ - acc->write (read_mem (MEM_XRAM, + acc->write (read_mem (MEM_XRAM_ID, sfr->read (px) * 256*256 + sfr->read (ph) * 256 + sfr->read (pl))); else - acc->write (read_mem (MEM_XRAM, + acc->write (read_mem (MEM_XRAM_ID, sfr->read (ph) * 256 + sfr->read (pl))); if (dps & 0x20) /* auto-switch dptr */ @@ -756,7 +802,7 @@ t_uc390::inst_movx_a_Sdptr (uchar code) */ int -t_uc390::inst_movx_Sdptr_a (uchar code) +cl_uc390::inst_movx_Sdptr_a (uchar code) { uchar pl, ph, px, dps; @@ -775,11 +821,11 @@ t_uc390::inst_movx_Sdptr_a (uchar code) } if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ - write_mem (MEM_XRAM, + write_mem (MEM_XRAM_ID, sfr->read (px) * 256*256 + sfr->read (ph) * 256 + sfr->read (pl), acc->read()); else - write_mem (MEM_XRAM, + write_mem (MEM_XRAM_ID, sfr->read (ph) * 256 + sfr->read (pl), acc->read()); @@ -797,7 +843,7 @@ t_uc390::inst_movx_Sdptr_a (uchar code) */ int -t_uc390::inst_ajmp_addr (uchar code) +cl_uc390::inst_ajmp_addr (uchar code) { uchar x, h, l; @@ -825,7 +871,7 @@ t_uc390::inst_ajmp_addr (uchar code) */ int -t_uc390::inst_ljmp (uchar code) +cl_uc390::inst_ljmp (uchar code) { uchar x, h, l; @@ -853,7 +899,7 @@ t_uc390::inst_ljmp (uchar code) */ int -t_uc390::inst_acall_addr (uchar code) +cl_uc390::inst_acall_addr (uchar code) { uchar x, h, l; @@ -872,7 +918,7 @@ t_uc390::inst_acall_addr (uchar code) else { /* stock mcs51 mode */ - class cl_cell *stck; + class cl_memory_cell *stck; t_mem sp; h = (code >> 5) & 0x07; @@ -892,17 +938,17 @@ t_uc390::inst_acall_addr (uchar code) /* - * 0x12 3 24 LCALL addr + * 0x12 3 24 LCALL *____________________________________________________________________________ * */ int -t_uc390::inst_lcall (uchar code, uint addr) +cl_uc390::inst_lcall (uchar code, uint addr, bool intr) { uchar x = 0, h = 0, l = 0; - if (!addr) + if (!intr) { /* this is a normal lcall */ if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ x = fetch (); @@ -911,9 +957,11 @@ t_uc390::inst_lcall (uchar code, uint addr) } /* else, this is interrupt processing */ + t_addr sp_before= sfr->get(SP); push_byte ( PC & 0xff); /* push low byte */ push_byte ((PC >> 8) & 0xff); /* push high byte */ + t_mem pushed= PC; if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ { push_byte ((PC >> 16) & 0xff); /* push x byte */ @@ -924,10 +972,19 @@ t_uc390::inst_lcall (uchar code, uint addr) } else { + class cl_stack_op *so; if (addr) - PC = addr; + { + PC = addr; + so= new cl_stack_intr(instPC, PC, pushed, sp_before, sfr->get(SP)); + } else - PC = h * 256 + l; + { + PC = h * 256 + l; + so= new cl_stack_call(instPC, PC, pushed, sp_before, sfr->get(SP)); + } + so->init(); + stack_write(so); } return resGO; } @@ -939,10 +996,11 @@ t_uc390::inst_lcall (uchar code, uint addr) */ int -t_uc390::inst_ret (uchar code) +cl_uc390::inst_ret (uchar code) { uchar x = 0, h, l; + t_addr sp_before= sfr->get(SP); if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ x = pop_byte (); h = pop_byte (); @@ -958,6 +1016,9 @@ t_uc390::inst_ret (uchar code) else PC = h * 256 + l; + class cl_stack_op *so= new cl_stack_ret(instPC, PC, sp_before, sfr->get(SP)); + so->init(); + stack_read(so); return resGO; } @@ -968,10 +1029,11 @@ t_uc390::inst_ret (uchar code) */ int -t_uc390::inst_reti (uchar code) +cl_uc390::inst_reti (uchar code) { uchar x = 0, h, l; + t_addr sp_before= sfr->get(SP); if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ x = pop_byte (); h = pop_byte (); @@ -995,6 +1057,10 @@ t_uc390::inst_reti (uchar code) delete il; } + class cl_stack_op *so= + new cl_stack_iret(instPC, PC, sp_before, sfr->get(SP)); + so->init(); + stack_read(so); return resGO; } @@ -1004,7 +1070,7 @@ t_uc390::inst_reti (uchar code) */ struct dis_entry * -t_uc390::dis_tbl (void) +cl_uc390::dis_tbl (void) { if (sfr->get (ACON) & 0x02) /* AM1 set: 24-bit flat? */ return disass_390f; @@ -1015,15 +1081,15 @@ t_uc390::dis_tbl (void) } char * -t_uc390::disass (t_addr addr, char *sep) +cl_uc390::disass (t_addr addr, char *sep) { char work[256], temp[20], c[2]; char *buf, *p, *b, *t; t_mem code; if (! (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ - return t_uc51::disass (addr, sep); - code = get_mem (MEM_ROM, addr); + return cl_51core::disass (addr, sep); + code = rom->get(addr); p = work; b = dis_tbl()[code].mnemonic; @@ -1039,32 +1105,32 @@ t_uc390::disass (t_addr addr, char *sep) // sprintf (temp, "%04lx", // (addr & 0xf800)| // (((code >> 5) & 0x07) * 256 + - // get_mem (MEM_ROM, addr + 1))); + // rom->get (addr + 1))); sprintf (temp, "%06lx", (addr & 0xf80000L) | (((code >> 5) & 0x07) * (256 * 256) + - (get_mem (MEM_ROM, addr + 1) * 256) + - get_mem (MEM_ROM, addr + 2))); + (rom->get (addr + 1) * 256) + + rom->get (addr + 2))); break; case 'l': // long address sprintf (temp, "%06lx", - get_mem (MEM_ROM, addr + 1) * (256*256L) + - get_mem (MEM_ROM, addr + 2) * 256 + - get_mem (MEM_ROM, addr + 3)); - // get_mem (MEM_ROM, addr + 1) * 256 + get_mem (MEM_ROM, addr + 2)); + rom->get (addr + 1) * (256*256L) + + rom->get (addr + 2) * 256 + + rom->get (addr + 3)); + // rom->get (addr + 1) * 256 + rom->get (addr + 2)); break; case 'a': // addr8 (direct address) at 2nd byte - if (!get_name (get_mem (MEM_ROM, addr + 1), sfr_tbl (), temp)) - sprintf (temp, "%02"_M_"x", get_mem (MEM_ROM, addr + 1)); + if (!get_name (rom->get (addr + 1), sfr_tbl (), temp)) + sprintf (temp, "%02"_M_"x", rom->get (addr + 1)); break; case '8': // addr8 (direct address) at 3rd byte - if (!get_name (get_mem (MEM_ROM, addr + 2), sfr_tbl (), temp)) - sprintf (temp, "%02"_M_"x", get_mem (MEM_ROM, addr + 2)); + if (!get_name (rom->get (addr + 2), sfr_tbl (), temp)) + sprintf (temp, "%02"_M_"x", rom->get (addr + 2)); break; case 'b': // bitaddr at 2nd byte { - t_addr ba = get_mem (MEM_ROM, addr+1); + t_addr ba = rom->get (addr+1); if (get_name (ba, bit_tbl(), temp)) break; if (get_name ((ba<128) ? ((ba/8)+32) : (ba&0xf8), sfr_tbl(), temp)) @@ -1080,17 +1146,17 @@ t_uc390::disass (t_addr addr, char *sep) } case 'r': // rel8 address at 2nd byte sprintf (temp, "%04"_A_"x", - t_addr (addr + 2 + (signed char) (get_mem (MEM_ROM, addr + 1)))); + t_addr (addr + 2 + (signed char) (rom->get (addr + 1)))); break; case 'R': // rel8 address at 3rd byte sprintf (temp, "%04"_A_"x", - t_addr (addr + 3 + (signed char) (get_mem (MEM_ROM, addr + 2)))); + t_addr (addr + 3 + (signed char) (rom->get (addr + 2)))); break; case 'd': // data8 at 2nd byte - sprintf (temp, "%02"_M_"x", get_mem (MEM_ROM, addr + 1)); + sprintf (temp, "%02"_M_"x", rom->get (addr + 1)); break; case 'D': // data8 at 3rd byte - sprintf (temp, "%02"_M_"x", get_mem (MEM_ROM, addr + 2)); + sprintf (temp, "%02"_M_"x", rom->get (addr + 2)); break; default: strcpy (temp, "?"); @@ -1129,14 +1195,14 @@ t_uc390::disass (t_addr addr, char *sep) } void -t_uc390::print_regs (class cl_console *con) +cl_uc390::print_regs (class cl_console *con) { t_addr start; t_mem data; if (! (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */ { - t_uc51::print_regs (con); + cl_51core::print_regs (con); return; } start = sfr->get (PSW) & 0x18; @@ -1151,7 +1217,7 @@ t_uc390::print_regs (class cl_console *con) isprint (sfr->get (ACC)) ? (sfr->get (ACC)) : '.', sfr->get (B)); eram2xram (); - data = get_mem (MEM_XRAM, + data = get_mem (MEM_XRAM_ID, sfr->get (DPX) * 256*256 + sfr->get (DPH) * 256 + sfr->get (DPL)); con->dd_printf (" DPTR= 0x%02x%02x%02x @DPTR= 0x%02x %3d %c\n", sfr->get (DPX), sfr->get (DPH), sfr->get (DPL), @@ -1170,7 +1236,7 @@ t_uc390::print_regs (class cl_console *con) /* SA: 10 bit stack */ con->dd_printf ("SP10 0x%03x %3d\n", (sfr->get (ESP) & 3) * 256 + sfr->get (SP), - get_mem (MEM_IXRAM, (sfr->get (ESP) & 3) * 256 + sfr->get (SP)) + get_mem (MEM_IXRAM_ID, (sfr->get (ESP) & 3) * 256 + sfr->get (SP)) ); else con->dd_printf ("SP 0x%02x %3d\n", @@ -1179,4 +1245,6 @@ t_uc390::print_regs (class cl_console *con) ); print_disass (PC, con); } + + /* End of s51.src/uc390.cc */ diff --git a/sim/ucsim/s51.src/uc390cl.h b/sim/ucsim/s51.src/uc390cl.h index a745263d..e81d4fcb 100644 --- a/sim/ucsim/s51.src/uc390cl.h +++ b/sim/ucsim/s51.src/uc390cl.h @@ -33,22 +33,23 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "uc52cl.h" -class t_uc390: public t_uc52 +class cl_uc390: public cl_uc52 { public: - t_uc390(int Itype, int Itech, class cl_sim *asim); + cl_uc390(int Itype, int Itech, class cl_sim *asim); virtual void mk_hw_elements (void); + virtual void make_memories(void); virtual void clear_sfr (void); // making objects - virtual t_addr get_mem_size (enum mem_class type); + //virtual t_addr get_mem_size (enum mem_class type); // manipulating memories - virtual t_mem read_mem (enum mem_class type, t_addr addr); - virtual t_mem get_mem (enum mem_class type, t_addr addr); - virtual void write_mem (enum mem_class type, t_addr addr, t_mem val); - virtual void set_mem (enum mem_class type, t_addr addr, t_mem val); + virtual t_mem read_mem (char *id/*enum mem_class type*/, t_addr addr); + virtual t_mem get_mem (char *id/*enum mem_class type*/, t_addr addr); + virtual void write_mem (char *id/*enum mem_class type*/, t_addr addr, t_mem val); + virtual void set_mem (char *id/*enum mem_class type*/, t_addr addr, t_mem val); /* mods for dual-dptr */ virtual int inst_inc_dptr(uchar code); @@ -62,7 +63,7 @@ public: virtual int inst_ajmp_addr(uchar code); virtual int inst_ljmp(uchar code); virtual int inst_acall_addr(uchar code); - virtual int inst_lcall(uchar code, uint addr); + virtual int inst_lcall(uchar code, uint addr, bool intr);/* 12 */ virtual int inst_ret(uchar code); virtual int inst_reti(uchar code); diff --git a/sim/ucsim/s51.src/uc390hw.cc b/sim/ucsim/s51.src/uc390hw.cc index d8bae360..d01c1722 100644 --- a/sim/ucsim/s51.src/uc390hw.cc +++ b/sim/ucsim/s51.src/uc390hw.cc @@ -39,15 +39,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA cl_uc390_hw::cl_uc390_hw (class cl_uc *auc): cl_hw (auc, HW_DUMMY, 0, "ds390hw") { - uc390 = (class t_uc390 *) uc; + uc390 = (class cl_uc390 *) uc; } int cl_uc390_hw::init(void) { - class cl_mem *sfr; - - sfr = uc->mem (MEM_SFR); + sfr = uc->address_space(MEM_SFR_ID); if (sfr) { /*cell_dps = sfr->register_hw (DPS , this, 0); @@ -89,7 +87,7 @@ cl_uc390_hw::init(void) } t_mem -cl_uc390_hw::read (class cl_cell *cell) +cl_uc390_hw::read (class cl_memory_cell *cell) { if (cell == cell_exif) { @@ -104,7 +102,7 @@ cl_uc390_hw::read (class cl_cell *cell) } void -cl_uc390_hw::write (class cl_cell *cell, t_mem *val) +cl_uc390_hw::write (class cl_memory_cell *cell, t_mem *val) { if (cell == cell_dps) *val = (*val & 0xe5) | 0x04; @@ -240,9 +238,9 @@ cl_uc390_hw::write (class cl_cell *cell, t_mem *val) } /*void -cl_uc390_hw::mem_cell_changed (class cl_mem *mem, t_addr addr) +cl_uc390_hw::mem_cell_changed (class cl_m *mem, t_addr addr) { - class cl_mem *sfr = uc->mem (MEM_SFR); + class cl_m *sfr = uc->mem (MEM_SFR); if (mem && sfr && mem == sfr) switch (addr) @@ -280,7 +278,7 @@ cl_uc390_hw::print_info(class cl_console *con) int i; long l; - i = uc->get_mem (MEM_SFR, EXIF); + i = sfr->get (EXIF); con->dd_printf ("%s" " EXIF 0x%02x: IE5 %c IE4 %c IE3 %c IE2 %c CKRDY %c RGMD %c RGSL %c BGS %c\n", id_string, @@ -293,20 +291,20 @@ cl_uc390_hw::print_info(class cl_console *con) (i & 0x04) ? '1' : '0', (i & 0x02) ? '1' : '0', (i & 0x01) ? '1' : '0'); - i = uc->get_mem (MEM_SFR, DPS); + i = sfr->get (DPS); con->dd_printf ("\tDPS 0x%02x: ID1 %c ID0 %c TSL %c SEL %c\n", i, (i & 0x80) ? '1' : '0', (i & 0x40) ? '1' : '0', (i & 0x20) ? '1' : '0', (i & 0x01) ? '1' : '0'); - l = uc->get_mem (MEM_SFR, DPX) * 256*256 + - uc->get_mem (MEM_SFR, DPH) * 256 + - uc->get_mem (MEM_SFR, DPL); + l = sfr->get (DPX) * 256*256 + + sfr->get (DPH) * 256 + + sfr->get (DPL); con->dd_printf ("\tDPTR 0x%06x\n", l); - l = uc->get_mem (MEM_SFR, DPX1) * 256*256 + - uc->get_mem (MEM_SFR, DPH1) * 256 + - uc->get_mem (MEM_SFR, DPL1); + l = sfr->get (DPX1) * 256*256 + + sfr->get (DPH1) * 256 + + sfr->get (DPL1); con->dd_printf ("\tDPTR1 0x%06x\n", l); } diff --git a/sim/ucsim/s51.src/uc390hwcl.h b/sim/ucsim/s51.src/uc390hwcl.h index e0b0ca01..a3476d17 100644 --- a/sim/ucsim/s51.src/uc390hwcl.h +++ b/sim/ucsim/s51.src/uc390hwcl.h @@ -36,11 +36,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_uc390_hw: public cl_hw { protected: - class cl_cell *cell_dps, *cell_exif, *cell_p4cnt, *cell_acon, - *cell_p5cnt, *cell_c0c, *cell_pmr, *cell_mcon, - *cell_ta, *cell_cor, *cell_mcnt0, *cell_mcnt1, - *cell_ma, *cell_mb, *cell_mc, *cell_wdcon, *cell_c1c; - class t_uc390 *uc390; + class cl_address_space *sfr; + class cl_memory_cell *cell_dps, *cell_exif, *cell_p4cnt, *cell_acon, + *cell_p5cnt, *cell_c0c, *cell_pmr, *cell_mcon, + *cell_ta, *cell_cor, *cell_mcnt0, *cell_mcnt1, + *cell_ma, *cell_mb, *cell_mc, *cell_wdcon, *cell_c1c; + class cl_uc390 *uc390; unsigned long ctm_ticks; /* mini-state-machine for "crystal multiplier" */ unsigned long timed_access_ticks; int timed_access_state; /* 0: idle; 1: $aa written; 2: $55 written */ @@ -48,8 +49,8 @@ public: cl_uc390_hw (class cl_uc *auc); virtual int init (void); - virtual t_mem read (class cl_cell *cell); - virtual void write (class cl_cell *cell, t_mem *val); + virtual t_mem read (class cl_memory_cell *cell); + virtual void write (class cl_memory_cell *cell, t_mem *val); //virtual void mem_cell_changed (class cl_mem *mem, t_addr addr); diff --git a/sim/ucsim/s51.src/uc51.cc b/sim/ucsim/s51.src/uc51.cc index d6c2c00b..a5f8dc99 100644 --- a/sim/ucsim/s51.src/uc51.cc +++ b/sim/ucsim/s51.src/uc51.cc @@ -43,10 +43,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // prj #include "utils.h" +#include "globals.h" // sim #include "optioncl.h" +//cmd.src +#include "cmduccl.h" + // local #include "uc51cl.h" #include "glob.h" @@ -59,101 +63,47 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "types51.h" +/* + * Options of uc51 + */ + +cl_irq_stop_option::cl_irq_stop_option(class cl_51core *the_uc51): + cl_optref(the_uc51) +{ + uc51= the_uc51; +} + +int +cl_irq_stop_option::init(void) +{ + cl_optref::init(); + create(uc51, bool_opt, "irq_stop", "Stop when IRQ accepted"); + return(0); +} + +void +cl_irq_stop_option::option_changed(void) +{ + if (!uc51) + return; + bool b; + option->get_value(&b); + uc51->stop_at_it= b; +} + + /* * Making a new micro-controller and reset it */ -t_uc51::t_uc51(int Itype, int Itech, class cl_sim *asim): +cl_51core::cl_51core(int Itype, int Itech, class cl_sim *asim): cl_uc(asim) { - //int i; - /* - struct termios tattr; - */ type= Itype; technology= Itech; - debug= asim->app->args->get_iarg('V', 0); + irq_stop_option= new cl_irq_stop_option(this); stop_at_it= DD_FALSE; - /*class cl_option *opt; - options->add(opt= new cl_bool_opt("verbose", "Verbose flag.")); - opt->init(); - opt->set_value((bool)debug); - options->add(opt= new cl_bool_opt("stopit", "Stop if interrupt accepted.")); - opt->init(); - opt->set_value((bool)stop_at_it); - options->add(new cl_cons_debug_opt(asim->app, "debug", - "Debug messages appears on this console."));*/ - - /* - serial_in = (FILE*)asim->app->args->get_parg(0, "Ser_in"); - serial_out= (FILE*)asim->app->args->get_parg(0, "Ser_out"); - if (serial_in) - { - // making `serial' unbuffered - if (setvbuf(serial_in, NULL, _IONBF, 0)) - perror("Unbuffer serial input channel"); - // setting O_NONBLOCK - if ((i= fcntl(fileno(serial_in), F_GETFL, 0)) < 0) - perror("Get flags of serial input"); - i|= O_NONBLOCK; - if (fcntl(fileno(serial_in), F_SETFL, i) < 0) - perror("Set flags of serial input"); - // switching terminal to noncanonical mode - if (isatty(fileno(serial_in))) - { - tcgetattr(fileno(serial_in), &saved_attributes_in); - tcgetattr(fileno(serial_in), &tattr); - tattr.c_lflag&= ~(ICANON|ECHO); - tattr.c_cc[VMIN] = 1; - tattr.c_cc[VTIME]= 0; - tcsetattr(fileno(serial_in), TCSAFLUSH, &tattr); - } - else - fprintf(stderr, "Warning: serial input interface connected to a " - "non-terminal file.\n"); - } - if (serial_out) - { - // making `serial' unbuffered - if (setvbuf(serial_out, NULL, _IONBF, 0)) - perror("Unbuffer serial output channel"); - // setting O_NONBLOCK - if ((i= fcntl(fileno(serial_out), F_GETFL, 0)) < 0) - perror("Get flags of serial output"); - i|= O_NONBLOCK; - if (fcntl(fileno(serial_out), F_SETFL, i) < 0) - perror("Set flags of serial output"); - // switching terminal to noncanonical mode - if (isatty(fileno(serial_out))) - { - tcgetattr(fileno(serial_out), &saved_attributes_out); - tcgetattr(fileno(serial_out), &tattr); - tattr.c_lflag&= ~(ICANON|ECHO); - tattr.c_cc[VMIN] = 1; - tattr.c_cc[VTIME]= 0; - tcsetattr(fileno(serial_out), TCSAFLUSH, &tattr); - } - else - fprintf(stderr, "Warning: serial output interface connected to a " - "non-terminal file.\n"); - } - */ - - /*for (i= 0; i < 4; i++) - port_pins[i]= 0xff;*/ - /*it_sources->add(new cl_it_src(bmEX0, TCON, bmIE0, 0x0003, true, - "external #0"));*/ - /*it_sources->add(new cl_it_src(bmET0, TCON, bmTF0, 0x000b, true, - "timer #0"));*/ - /*it_sources->add(new cl_it_src(bmEX1, TCON, bmIE1, 0x0013, true, - "external #1"));*/ - /*it_sources->add(new cl_it_src(bmET1, TCON, bmTF1, 0x001b, true, - "timer #1"));*/ - /*it_sources->add(new cl_it_src(bmES , SCON, bmTI , 0x0023, false, - "serial transmit")); - it_sources->add(new cl_it_src(bmES , SCON, bmRI , 0x0023, false, - "serial receive"));*/ } @@ -163,9 +113,11 @@ t_uc51::t_uc51(int Itype, int Itech, class cl_sim *asim): */ int -t_uc51::init(void) +cl_51core::init(void) { + irq_stop_option->init(); cl_uc::init(); + set_name("mcs51_controller"); reset(); return(0); } @@ -173,7 +125,7 @@ t_uc51::init(void) static char id_string_51[100]; char * -t_uc51::id_string(void) +cl_51core::id_string(void) { int i; @@ -185,7 +137,7 @@ t_uc51::id_string(void) } void -t_uc51::mk_hw_elements(void) +cl_51core::mk_hw_elements(void) { class cl_hw *h; @@ -216,23 +168,111 @@ t_uc51::mk_hw_elements(void) */ } -class cl_mem * -t_uc51::mk_mem(enum mem_class type, char *class_name) +void +cl_51core::build_cmdset(class cl_cmdset *cmdset) { - class cl_mem *m= cl_uc::mk_mem(type, class_name); + class cl_cmd *cmd; + //class cl_super_cmd *super_cmd; + //class cl_cmdset *cset; + + cl_uc::build_cmdset(cmdset); + + cmdset->add(cmd= new cl_di_cmd("di", DD_TRUE, +"di [start [stop]] Dump Internal RAM", +"long help of di")); + cmd->init(); + + cmdset->add(cmd= new cl_dx_cmd("dx", DD_TRUE, +"dx [start [stop]] Dump External RAM", +"long help of dx")); + cmd->init(); + + cmdset->add(cmd= new cl_ds_cmd("ds", DD_TRUE, +"ds [start [stop]] Dump SFR", +"long help of ds")); + cmd->init(); +} + +/* +class cl_m * +cl_51core::mk_mem(enum mem_class type, char *class_name) +{ + class cl_address_space *m= cl_uc::mk_mem(type, class_name); if (type == MEM_SFR) sfr= m; if (type == MEM_IRAM) iram= m; return(m); } +*/ + +void +cl_51core::make_memories(void) +{ + class cl_address_space *as; + + rom= as= new cl_address_space(MEM_ROM_ID/*"rom"*/, 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + iram= as= new cl_address_space(MEM_IRAM_ID/*"iram"*/, 0, 0x80, 8); + as->init(); + address_spaces->add(as); + sfr= as= new cl_address_space(MEM_SFR_ID/*"sfr"*/, 0x80, 0x80, 8); + as->init(); + address_spaces->add(as); + xram= as= new cl_address_space(MEM_XRAM_ID/*"xram"*/, 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8, 0xff); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= rom/*address_space(MEM_ROM_ID)*/, + chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x80, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= iram/*address_space(MEM_IRAM_ID)*/, + chip, 0, 0x7f, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("xram_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= xram/*address_space(MEM_XRAM_ID)*/, + chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("sfr_chip", 0x80, 8, 0); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= sfr/*address_space(MEM_SFR_ID)*/, + chip, 0x80, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + acc= sfr->get_cell(ACC); + psw= sfr->get_cell(PSW); +} /* * Destroying the micro-controller object */ -t_uc51::~t_uc51(void) +cl_51core::~cl_51core(void) { /* if (serial_out) @@ -248,18 +288,7 @@ t_uc51::~t_uc51(void) fclose(serial_in); } */ -} - - -/* - * Writing data to EROM - */ - -void -t_uc51::write_rom(t_addr addr, ulong data) -{ - if (addr < EROM_SIZE) - set_mem(MEM_ROM, addr, data); + delete irq_stop_option; } @@ -268,29 +297,29 @@ t_uc51::write_rom(t_addr addr, ulong data) */ struct dis_entry * -t_uc51::dis_tbl(void) +cl_51core::dis_tbl(void) { return(disass_51); } struct name_entry * -t_uc51::sfr_tbl(void) +cl_51core::sfr_tbl(void) { return(sfr_tab51); } struct name_entry * -t_uc51::bit_tbl(void) +cl_51core::bit_tbl(void) { return(bit_tab51); } char * -t_uc51::disass(t_addr addr, char *sep) +cl_51core::disass(t_addr addr, char *sep) { char work[256], temp[20], c[2]; char *buf, *p, *b, *t; - t_mem code= get_mem(MEM_ROM, addr); + t_mem code= rom->get(addr); p= work; b= dis_tbl()[code].mnemonic; @@ -305,25 +334,25 @@ t_uc51::disass(t_addr addr, char *sep) sprintf(temp, "%04"_A_"x", t_addr((addr&0xf800)| (((code>>5)&0x07)*256 + - get_mem(MEM_ROM, addr+1)))); + rom->get(addr+1)))); break; case 'l': // long address sprintf(temp, "%04"_A_"x", - t_addr(get_mem(MEM_ROM, addr+1)*256 + - get_mem(MEM_ROM, addr+2))); + t_addr(rom->get(addr+1)*256 + + rom->get(addr+2))); break; case 'a': // addr8 (direct address) at 2nd byte - if (!get_name(get_mem(MEM_ROM, addr+1), sfr_tbl(), temp)) - sprintf(temp, "%02"_M_"x", get_mem(MEM_ROM, addr+1)); + if (!get_name(rom->get(addr+1), sfr_tbl(), temp)) + sprintf(temp, "%02"_M_"x", rom->get(addr+1)); break; case '8': // addr8 (direct address) at 3rd byte - if (!get_name(get_mem(MEM_ROM, addr+2), sfr_tbl(), temp)) - sprintf(temp, "%02"_M_"x", get_mem(MEM_ROM, addr+2)); - //sprintf(temp, "%02"_M_"x", get_mem(MEM_ROM, addr+2)); + if (!get_name(rom->get(addr+2), sfr_tbl(), temp)) + sprintf(temp, "%02"_M_"x", rom->get(addr+2)); + //sprintf(temp, "%02"_M_"x", rom->get(addr+2)); break; case 'b': // bitaddr at 2nd byte { - t_addr ba= get_mem(MEM_ROM, addr+1); + t_addr ba= rom->get(addr+1); if (get_name(ba, bit_tbl(), temp)) break; if (get_name((ba<128)?((ba/8)+32):(ba&0xf8), sfr_tbl(), temp)) @@ -339,22 +368,22 @@ t_uc51::disass(t_addr addr, char *sep) } case 'r': // rel8 address at 2nd byte sprintf(temp, "%04"_A_"x", - t_addr(addr+2+(signed char)(get_mem(MEM_ROM, addr+1)))); + t_addr(addr+2+(signed char)(rom->get(addr+1)))); break; case 'R': // rel8 address at 3rd byte sprintf(temp, "%04"_A_"x", - t_addr(addr+3+(signed char)(get_mem(MEM_ROM, addr+2)))); + t_addr(addr+3+(signed char)(rom->get(addr+2)))); break; case 'd': // data8 at 2nd byte - sprintf(temp, "%02"_M_"x", get_mem(MEM_ROM, addr+1)); + sprintf(temp, "%02"_M_"x", rom->get(addr+1)); break; case 'D': // data8 at 3rd byte - sprintf(temp, "%02"_M_"x", get_mem(MEM_ROM, addr+2)); + sprintf(temp, "%02"_M_"x", rom->get(addr+2)); break; case '6': // data16 at 2nd(H)-3rd(L) byte sprintf(temp, "%04"_A_"x", - t_addr(get_mem(MEM_ROM, addr+1)*256 + - get_mem(MEM_ROM, addr+2))); + t_addr(rom->get(addr+1)*256 + + rom->get(addr+2))); break; default: strcpy(temp, "?"); @@ -396,7 +425,7 @@ t_uc51::disass(t_addr addr, char *sep) void -t_uc51::print_regs(class cl_console *con) +cl_51core::print_regs(class cl_console *con) { t_addr start; uchar data; @@ -411,8 +440,8 @@ t_uc51::print_regs(class cl_console *con) con->dd_printf(" ACC= 0x%02x %3d %c B= 0x%02x", sfr->get(ACC), sfr->get(ACC), isprint(sfr->get(ACC))?(sfr->get(ACC)):'.', sfr->get(B)); - eram2xram(); - data= get_mem(MEM_XRAM, sfr->get(DPH)*256+sfr->get(DPL)); + //eram2xram(); + data= xram->get(sfr->get(DPH)*256+sfr->get(DPL)); con->dd_printf(" DPTR= 0x%02x%02x @DPTR= 0x%02x %3d %c\n", sfr->get(DPH), sfr->get(DPL), data, data, isprint(data)?data:'.'); @@ -432,10 +461,10 @@ t_uc51::print_regs(class cl_console *con) * Converting bit address into real memory */ -class cl_mem * -t_uc51::bit2mem(t_addr bitaddr, t_addr *memaddr, t_mem *bitmask) +class cl_address_space * +cl_51core::bit2mem(t_addr bitaddr, t_addr *memaddr, t_mem *bitmask) { - class cl_mem *m; + class cl_address_space *m; t_addr ma; bitaddr&= 0xff; @@ -456,13 +485,45 @@ t_uc51::bit2mem(t_addr bitaddr, t_addr *memaddr, t_mem *bitmask) return(m); } +t_addr +cl_51core::bit_address(class cl_memory *mem, + t_addr mem_address, int bit_number) +{ + if (bit_number < 0 || + bit_number > 7 || + mem_address < 0) + return(-1); + class cl_memory *sfrchip= memory("sfr_chip"); + if (mem == sfrchip) + { + mem= sfr; + mem_address+= sfr->start_address; + } + if (mem == sfr) + { + if (mem_address < 128 || + mem_address % 8 != 0 || + mem_address > 255) + return(-1); + return(128 + (mem_address-128) + bit_number); + } + if (mem == iram) + { + if (mem_address < 0x20 || + mem_address >= 0x20+32) + return(-1); + return((mem_address-0x20)*8 + bit_number); + } + return(-1); +} + /* * Resetting the micro-controller */ void -t_uc51::reset(void) +cl_51core::reset(void) { cl_uc::reset(); @@ -479,19 +540,35 @@ t_uc51::reset(void) */ void -t_uc51::clear_sfr(void) +cl_51core::clear_sfr(void) { int i; - for (i= 0; i < SFR_SIZE; i++) + for (i= 0x80; i <= 0xff; i++) sfr->set(i, 0); sfr->/*set*/write(P0, 0xff); sfr->/*set*/write(P1, 0xff); sfr->/*set*/write(P2, 0xff); sfr->/*set*/write(P3, 0xff); - sfr->/*set*/write(SP, 7); prev_p1= /*port_pins[1] &*/ sfr->/*get*/read(P1); prev_p3= /*port_pins[3] &*/ sfr->/*get*/read(P3); + sfr->write(ACC, 0); + sfr->write(B, 0); + sfr->write(PSW, 0); + sfr->write(SP, 7); + sfr->write(DPL, 0); + sfr->write(DPH, 0); + sfr->write(IP, 0); + sfr->write(IE, 0); + sfr->write(TMOD, 0); + sfr->write(TCON, 0); + sfr->write(TH0, 0); + sfr->write(TL0, 0); + sfr->write(TH1, 0); + sfr->write(TL1, 0); + sfr->write(SCON, 0); + sfr->write(PCON, 0); + sfr->set_nuof_writes(0); sfr->set_nuof_reads(0); } @@ -502,12 +579,12 @@ t_uc51::clear_sfr(void) */ void -t_uc51::analyze(t_addr addr) +cl_51core::analyze(t_addr addr) { uint code; struct dis_entry *tabl; - code= get_mem(MEM_ROM, addr); + code= rom->get(addr); tabl= &(dis_tbl()[code]); while (!inst_at(addr) && code != 0xa5 /* break point */) @@ -517,46 +594,44 @@ t_uc51::analyze(t_addr addr) { case 'a': // acall analyze((addr & 0xf800)| - ((get_mem(MEM_ROM, addr+1)&0x07)*256+ - get_mem(MEM_ROM, addr+2))); + ((rom->get(addr+1)&0x07)*256+ + rom->get(addr+2))); analyze(addr+tabl->length); break; case 'A': // ajmp addr= (addr & 0xf800)| - ((get_mem(MEM_ROM, addr+1) & 0x07)*256 + get_mem(MEM_ROM, addr+2)); + ((rom->get(addr+1) & 0x07)*256 + rom->get(addr+2)); break; case 'l': // lcall - analyze(get_mem(MEM_ROM, addr+1)*256 + get_mem(MEM_ROM, addr+2)); + analyze(rom->get(addr+1)*256 + rom->get(addr+2)); analyze(addr+tabl->length); break; case 'L': // ljmp - addr= get_mem(MEM_ROM, addr+1)*256 + get_mem(MEM_ROM, addr+2); + addr= rom->get(addr+1)*256 + rom->get(addr+2); break; case 'r': // reljmp (2nd byte) - analyze((addr + (signed char)(get_mem(MEM_ROM, addr+1))) & - (EROM_SIZE - 1)); + analyze(rom->validate_address(addr+(signed char)(rom->get(addr+1)))); analyze(addr+tabl->length); break; case 'R': // reljmp (3rd byte) - analyze((addr+ - (signed char)(get_mem(MEM_ROM, addr+2)))&(EROM_SIZE-1)); + analyze(rom->validate_address(addr+(signed char)(rom->get(addr+2)))); analyze(addr+tabl->length); break; case 's': // sjmp { signed char target; - target= get_mem(MEM_ROM, addr+1); + target= rom->get(addr+1); addr+= 2; - addr= (addr+target)&(EROM_SIZE-1); + addr= rom->validate_address(addr+target); break; } case '_': return; default: - addr= (addr+tabl->length) & (EROM_SIZE - 1); + addr= rom->validate_address(addr+tabl->length); break; } - code= get_mem(MEM_ROM, addr); + code= rom->get(addr); tabl= &(dis_tbl()[code]); } } @@ -567,7 +642,7 @@ t_uc51::analyze(t_addr addr) */ /*int -t_uc51::tick_hw(int cycles) +cl_51core::tick_hw(int cycles) { cl_uc::tick_hw(cycles); //do_hardware(cycles); @@ -575,7 +650,7 @@ t_uc51::tick_hw(int cycles) }*/ /*int -t_uc51::tick(int cycles) +cl_51core::tick(int cycles) { cl_uc::tick(cycles); //do_hardware(cycles); @@ -590,10 +665,10 @@ t_uc51::tick(int cycles) * or an SFR. */ -class cl_cell * -t_uc51::get_direct(t_mem addr) +class cl_memory_cell * +cl_51core::get_direct(t_mem addr) { - if (addr < SFR_START) + if (addr < sfr->start_address) return(iram->get_cell(addr)); else return(sfr->get_cell(addr)); @@ -604,8 +679,8 @@ t_uc51::get_direct(t_mem addr) * Calculating address of specified register cell in IRAM */ -class cl_cell * -t_uc51::get_reg(uchar regnum) +class cl_memory_cell * +cl_51core::get_reg(uchar regnum) { t_addr a= (psw->get() & (bmRS0|bmRS1)) | (regnum & 0x07); return(iram->get_cell(a)); @@ -617,10 +692,10 @@ t_uc51::get_reg(uchar regnum) */ int -t_uc51::exec_inst(void) +cl_51core::exec_inst(void) { t_mem code; - int res; + int res= resGO; //pr_inst(); instPC= PC; @@ -643,7 +718,7 @@ t_uc51::exec_inst(void) case 0x10: res= inst_jbc_bit_addr(code); break; case 0x11: case 0x31: case 0x51: case 0x71: case 0x91: case 0xb1: case 0xd1: case 0xf1:res=inst_acall_addr(code);break; - case 0x12: res= inst_lcall(code, 0); break; + case 0x12: res= inst_lcall(code, 0, DD_FALSE); break; case 0x13: res= inst_rrc(code); break; case 0x14: res= inst_dec_a(code); break; case 0x15: res= inst_dec_addr(code); break; @@ -714,10 +789,11 @@ t_uc51::exec_inst(void) case 0x96: case 0x97: res= inst_subb_a_Sri(code); break; case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:res= inst_subb_a_rn(code);break; + case 0xa0: res= inst_orl_c_Sbit(code); break; case 0xa2: res= inst_mov_c_bit(code); break; case 0xa3: res= inst_inc_dptr(code); break; case 0xa4: res= inst_mul_ab(code); break; - case 0xa5: res= inst_unknown(code); break; + case 0xa5: res= inst_unknown(); break; case 0xa6: case 0xa7: res= inst_mov_Sri_addr(code); break; case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:res=inst_mov_rn_addr(code);break; @@ -760,7 +836,7 @@ t_uc51::exec_inst(void) case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: res= inst_mov_rn_a(code);break; default: - res= inst_unknown(code); + res= inst_unknown(); break; } //post_inst(); @@ -780,9 +856,9 @@ t_uc51::exec_inst(void) * (inp_avail will be TRUE if ENTER is pressed) and it can confuse * command interepter. */ - +//static class cl_console *c= NULL; int -t_uc51::do_inst(int step) +cl_51core::do_inst(int step) { result= resGO; while ((result == resGO) && @@ -797,12 +873,33 @@ t_uc51::do_inst(int step) pre_inst(); result= exec_inst(); post_inst(); + /* + { + if (c) + print_regs(c); + else + { + if (sim->app->get_commander()==NULL) + printf("no commander PC=0x%x\n",PC); + else + if (sim->app->get_commander()->frozen_console==NULL) + printf("no frozen console PC=0x%x\n",PC); + else + c= sim->app->get_commander()->frozen_console; + if (c) + print_regs(c); + else + printf("no console PC=0x%x\n",PC); + } + } + */ /*if (result == resGO) result= check_events();*/ } else { // tick hw in idle state + inst_ticks= 1; post_inst(); tick(1); } @@ -847,7 +944,7 @@ t_uc51::do_inst(int step) } /*void -t_uc51::post_inst(void) +cl_51core::post_inst(void) {*/ //uint tcon= sfr->get(TCON); //uint p3= sfr->read(P3); @@ -905,7 +1002,7 @@ t_uc51::post_inst(void) */ /*int -t_uc51::do_wdt(int cycles) +cl_51core::do_wdt(int cycles) { return(resGO); }*/ @@ -916,7 +1013,7 @@ t_uc51::do_wdt(int cycles) */ int -t_uc51::do_interrupt(void) +cl_51core::do_interrupt(void) { int i, ie= 0; @@ -959,7 +1056,7 @@ t_uc51::do_interrupt(void) } int -t_uc51::it_priority(uchar ie_mask) +cl_51core::it_priority(uchar ie_mask) { if (sfr->get(IP) & ie_mask) return(1); @@ -972,13 +1069,13 @@ t_uc51::it_priority(uchar ie_mask) */ int -t_uc51::accept_it(class it_level *il) +cl_51core::accept_it(class it_level *il) { state= stGO; sfr->set_bit0(PCON, bmIDL); it_levels->push(il); tick(1); - int res= inst_lcall(0, il->addr); + int res= inst_lcall(0, il->addr, DD_TRUE); if (res != resGO) return(res); else @@ -991,7 +1088,7 @@ t_uc51::accept_it(class it_level *il) */ int -t_uc51::idle_pd(void) +cl_51core::idle_pd(void) { uint pcon= sfr->get(PCON); @@ -1001,8 +1098,8 @@ t_uc51::idle_pd(void) { if (state != stIDLE) sim->app->get_commander()-> - debug("%g sec (%d clks): CPU in Idle mode\n", - get_rtime(), ticks->ticks); + debug("%g sec (%d clks): CPU in Idle mode (PC=0x%x, PCON=0x%x)\n", + get_rtime(), ticks->ticks, PC, pcon); state= stIDLE; //was_reti= 1; } @@ -1023,7 +1120,7 @@ t_uc51::idle_pd(void) */ /*int -t_uc51::check_events(void) +cl_51core::check_events(void) { int i; class cl_ev_brk *eb; @@ -1043,8 +1140,9 @@ t_uc51::check_events(void) /* */ +/* void -t_uc51::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_51core::mem_cell_changed(class cl_m *mem, t_addr addr) { if (mem == sfr) switch (addr) @@ -1054,6 +1152,7 @@ t_uc51::mem_cell_changed(class cl_mem *mem, t_addr addr) } cl_uc::mem_cell_changed(mem, addr); } +*/ /* @@ -1064,13 +1163,12 @@ t_uc51::mem_cell_changed(class cl_mem *mem, t_addr addr) */ int -t_uc51::inst_unknown(uchar code) +cl_51core::inst_unknown(void) { - PC--; - if (1)//debug)// && sim->cmd_out()) - sim->app->get_commander()-> - debug("Unknown instruction %02x at %06x\n", code, PC); - return(resHALT); + //PC--; + class cl_error_unknown_code *e= new cl_error_unknown_code(this); + error(e); + return(resGO); } @@ -1079,7 +1177,7 @@ t_uc51::inst_unknown(uchar code) */ int -t_uc51::inst_nop(uchar code) +cl_51core::inst_nop(uchar code) { return(resGO); } @@ -1090,7 +1188,7 @@ t_uc51::inst_nop(uchar code) */ int -t_uc51::inst_clr_a(uchar code) +cl_51core::inst_clr_a(uchar code) { acc->write(0); return(resGO); @@ -1102,7 +1200,7 @@ t_uc51::inst_clr_a(uchar code) */ int -t_uc51::inst_swap(uchar code) +cl_51core::inst_swap(uchar code) { uchar temp; @@ -1118,13 +1216,13 @@ t_uc51::inst_swap(uchar code) cl_uc51_dummy_hw::cl_uc51_dummy_hw(class cl_uc *auc): cl_hw(auc, HW_DUMMY, 0, "_51_dummy") { - //uc51= (class t_uc51 *)uc; + //uc51= (class cl_51core *)uc; } int cl_uc51_dummy_hw::init(void) { - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); if (!sfr) { fprintf(stderr, "No SFR to register %s[%d] into\n", id_string, id); @@ -1134,11 +1232,12 @@ cl_uc51_dummy_hw::init(void) use_cell(sfr, PSW, &cell_psw, wtd_restore); register_cell(sfr, ACC, &cell_acc, wtd_restore_write); register_cell(sfr, SP , &cell_sp , wtd_restore); + //register_cell(sfr, PCON, &cell_pcon, wtd_restore); return(0); } void -cl_uc51_dummy_hw::write(class cl_cell *cell, t_mem *val) +cl_uc51_dummy_hw::write(class cl_memory_cell *cell, t_mem *val) { if (cell == cell_acc) { @@ -1165,6 +1264,11 @@ cl_uc51_dummy_hw::write(class cl_cell *cell, t_mem *val) uc->sp_max= *val; uc->sp_avg= (uc->sp_avg+(*val))/2; } + /*else if (cell == cell_pcon) + { + printf("PCON write 0x%x (PC=0x%x)\n", *val, uc->PC); + uc->sim->stop(0); + }*/ } /*void diff --git a/sim/ucsim/s51.src/uc51cl.h b/sim/ucsim/s51.src/uc51cl.h index 17f8bea3..30818e7c 100644 --- a/sim/ucsim/s51.src/uc51cl.h +++ b/sim/ucsim/s51.src/uc51cl.h @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #ifndef UC51CL_HEADER @@ -43,16 +45,29 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "interruptcl.h" -class t_uc51: public cl_uc +class t_uc51; + +class cl_irq_stop_option: public cl_optref +{ +protected: + class cl_51core *uc51; +public: + cl_irq_stop_option(class cl_51core *the_uc51); + virtual int init(void); + virtual void option_changed(void); +}; + +class cl_51core: public cl_uc { public: // Options - bool debug; + //bool debug; + class cl_irq_stop_option *irq_stop_option; bool stop_at_it; // memories and cells for faster access - class cl_mem *sfr, *iram; - class cl_cell *acc, *psw; + class cl_address_space *sfr, *iram, *xram; + class cl_memory_cell *acc, *psw; public: // Help to detect external it requests (falling edge) @@ -68,23 +83,26 @@ public: public: int result; // result of instruction execution - t_uc51(int Itype, int Itech, - class cl_sim *asim); - virtual ~t_uc51(void); + cl_51core(int Itype, int Itech, class cl_sim *asim); + virtual ~cl_51core(void); virtual int init(void); virtual char *id_string(void); virtual void mk_hw_elements(void); - virtual class cl_mem *mk_mem(enum mem_class type, char *class_name); + virtual void build_cmdset(class cl_cmdset *cmdset); + //virtual class cl_m *mk_mem(enum mem_class type, char *class_name); + virtual void make_memories(void); - void write_rom(t_addr addr, ulong data); virtual int clock_per_cycle(void) { return(12); } virtual struct dis_entry *dis_tbl(void); virtual struct name_entry *sfr_tbl(void); virtual struct name_entry *bit_tbl(void); virtual char *disass(t_addr addr, char *sep); virtual void print_regs(class cl_console *con); - virtual class cl_mem *bit2mem(t_addr bitaddr, - t_addr *memaddr, t_mem *bitmask); + virtual class cl_address_space *bit2mem(t_addr bitaddr, + t_addr *memaddr, t_mem *bitmask); + virtual t_addr bit_address(class cl_memory *mem, + t_addr mem_address, + int bit_number); virtual void reset(void); virtual void clear_sfr(void); virtual void analyze(t_addr addr); @@ -92,7 +110,7 @@ public: virtual int do_inst(int step); - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_m *mem, t_addr addr); protected: virtual int do_interrupt(void); @@ -100,13 +118,13 @@ protected: protected: virtual int idle_pd(void); - virtual class cl_cell *get_direct(t_mem addr); - virtual class cl_cell *get_reg(uchar regnum); + virtual class cl_memory_cell *get_direct(t_mem addr); + virtual class cl_memory_cell *get_reg(uchar regnum); virtual int exec_inst(void); //virtual void post_inst(void); - virtual int inst_unknown(uchar code); + virtual int inst_unknown(void); virtual int inst_nop(uchar code); /* 00 */ virtual int inst_ajmp_addr(uchar code); /* [02468ace]1 */ virtual int inst_ljmp(uchar code); /* 02 */ @@ -117,7 +135,7 @@ protected: virtual int inst_inc_rn(uchar code); /* 08-0f */ virtual int inst_jbc_bit_addr(uchar code); /* 10 */ virtual int inst_acall_addr(uchar code); /* [13579bdf]1 */ - virtual int inst_lcall(uchar code, uint addr); /* 12 */ + virtual int inst_lcall(uchar code, uint addr, bool intr);/* 12 */ virtual int inst_rrc(uchar code); /* 13 */ virtual int inst_dec_a(uchar code); /* 14 */ virtual int inst_dec_addr(uchar code); /* 15 */ @@ -179,6 +197,7 @@ protected: virtual int inst_subb_a_addr(uchar code); /* 95 */ virtual int inst_subb_a_Sri(uchar code); /* 96,97 */ virtual int inst_subb_a_rn(uchar code); /* 98-9f */ + virtual int inst_orl_c_Sbit(uchar code); /* a0 */ virtual int inst_mov_c_bit(uchar code); /* a2 */ virtual int inst_inc_dptr(uchar code); /* a3 */ virtual int inst_mul_ab(uchar code); /* a4 */ @@ -224,12 +243,12 @@ class cl_uc51_dummy_hw: public cl_hw { protected: //class t_uc51 *uc51; - class cl_cell *cell_acc, *cell_sp, *cell_psw; + class cl_memory_cell *cell_acc, *cell_sp, *cell_psw/*, *cell_pcon*/; public: cl_uc51_dummy_hw(class cl_uc *auc); virtual int init(void); - virtual void write(class cl_cell *cell, t_mem *val); + virtual void write(class cl_memory_cell *cell, t_mem *val); //virtual void happen(class cl_hw *where, enum hw_event he, void *params); }; diff --git a/sim/ucsim/s51.src/uc51r.cc b/sim/ucsim/s51.src/uc51r.cc index 117c455e..cecb2469 100644 --- a/sim/ucsim/s51.src/uc51r.cc +++ b/sim/ucsim/s51.src/uc51r.cc @@ -40,71 +40,118 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA * Making an 8051r CPU object */ -t_uc51r::t_uc51r(int Itype, int Itech, class cl_sim *asim): - t_uc52(Itype, Itech, asim) +cl_uc51r::cl_uc51r(int Itype, int Itech, class cl_sim *asim): + cl_uc52(Itype, Itech, asim) { - int i; - + /* int i; for (i= 0; i < ERAM_SIZE; i++) - ERAM[i]= 0; + ERAM[i]= 0;*/ clock_out= 0; } void -t_uc51r::mk_hw_elements(void) +cl_uc51r::mk_hw_elements(void) { class cl_hw *h; - t_uc52::mk_hw_elements(); + cl_uc52::mk_hw_elements(); hws->add(h= new cl_wdt(this, 0x3fff)); h->init(); + hws->add(h= new cl_uc51r_dummy_hw(this)); + h->init(); } -/* - * Resetting of the microcontroller - * - * Original method is extended with handling of WDT. - */ - void -t_uc51r::reset(void) +cl_uc51r::make_memories(void) { - t_uc52::reset(); - sfr->set(SADDR, 0); - sfr->set(SADEN, 0); + class cl_address_space *as; + + rom= as= new cl_address_space("rom", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + iram= as= new cl_address_space("iram", 0, 0x100, 8); + as->init(); + address_spaces->add(as); + sfr= as= new cl_address_space("sfr", 0x80, 0x80, 8); + as->init(); + address_spaces->add(as); + xram= as= new cl_address_space("xram", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x100, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("iram"), chip, 0, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("xram_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("xram"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + chip= new cl_memory_chip("eram_chip", 0x100, 8); + chip->init(); + memchips->add(chip); + + chip= new cl_memory_chip("sfr_chip", 0x80, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("sfr"), chip, 0x80, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + acc= sfr->get_cell(ACC); + psw= sfr->get_cell(PSW); } /* - * Copying ERAM to XRAM and vice versa + * Resetting of the microcontroller * - * This two methods are used by command interpreter to make ERAM and - * beginning of XRAM to be equivalent. + * Original method is extended with handling of WDT. */ void -t_uc51r::eram2xram(void) +cl_uc51r::reset(void) { - int i; - - for (i= 0; i < ERAM_SIZE; i++) - set_mem(MEM_XRAM, i, ERAM[i]); + cl_uc52::reset(); + sfr->write(SADDR, 0); + sfr->write(SADEN, 0); + sfr->write(AUXR, 0); } void -t_uc51r::xram2eram(void) +cl_uc51r::clear_sfr(void) { - int i; - - for (i= 0; i < ERAM_SIZE; i++) - ERAM[i]= get_mem(MEM_XRAM, i); + cl_uc52::clear_sfr(); + sfr->write(SADDR, 0); + sfr->write(SADEN, 0); + sfr->write(AUXR, 0); + sfr->write(IPH, 0); } void -t_uc51r::received(int c) +cl_uc51r::received(int c) { t_mem br= sfr->get(SADDR) | sfr->get(SADEN); int scon= sfr->get(SCON); @@ -125,88 +172,72 @@ t_uc51r::received(int c) /* - * 0xe0 1 24 MOVX A,@DPTR - *____________________________________________________________________________ - * */ -int -t_uc51r::inst_movx_a_Sdptr(uchar code) -{ - if ((sfr->get(AUXR) & bmEXTRAM) || - sfr->get(DPH)) - acc->write(read_mem(MEM_XRAM, - sfr->read(DPH)*256+ - sfr->read(DPL))); - else - acc->write(ERAM[sfr->read(DPL)]); - tick(1); - return(resGO); -} - - -/* - * 0xe2-0xe3 1 24 MOVX A,@Ri - *____________________________________________________________________________ - * - */ +cl_uc51r_dummy_hw::cl_uc51r_dummy_hw(class cl_uc *auc): + cl_hw(auc, HW_DUMMY, 0, "_51r_dummy") +{} int -t_uc51r::inst_movx_a_Sri(uchar code) +cl_uc51r_dummy_hw::init(void) { - class cl_cell *cell; - t_mem d= 0; - - cell= iram->get_cell(get_reg(code & 0x01)->read()); - d= cell->read(); - if (sfr->get(AUXR) & bmEXTRAM) - acc->write(read_mem(MEM_XRAM, sfr->read(P2)*256+d)); - else - acc->write(ERAM[d]); - tick(1); - return(resGO); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); + if (!sfr) + { + fprintf(stderr, "No SFR to register %s[%d] into\n", id_string, id); + } + //use_cell(sfr, PSW, &cell_psw, wtd_restore); + register_cell(sfr, AUXR, &cell_auxr, wtd_restore); + return(0); } - -/* - * 0xf0 1 24 MOVX @DPTR,A - *____________________________________________________________________________ - * - */ - -int -t_uc51r::inst_movx_Sdptr_a(uchar code) +void +cl_uc51r_dummy_hw::write(class cl_memory_cell *cell, t_mem *val) { - if ((sfr->get(AUXR) & bmEXTRAM) || - sfr->get(DPH)) - write_mem(MEM_XRAM, sfr->read(DPH)*256 + sfr->read(DPL), acc->read()); - else - ERAM[sfr->read(DPL)]= acc->read(); - return(resGO); + if (cell == cell_auxr) + { + class cl_address_space *xram= uc->address_space(MEM_XRAM_ID); + class cl_memory_chip *eram= + dynamic_cast(uc->memory("eram_chip")); + class cl_address_decoder *d; + if (eram && + xram) + { + if (*val & bmEXTRAM) + d= new cl_address_decoder(xram, uc->memory("xram_chip"), 0,0xff,0); + else + d= new cl_address_decoder(xram, eram, 0, 0xff, 0); + d->init(); + xram->decoders->add(d); + d->activate(0); + } + } + /*else if (cell == cell_pcon) + { + printf("PCON write 0x%x (PC=0x%x)\n", *val, uc->PC); + uc->sim->stop(0); + }*/ } - -/* - * 0xf2-0xf3 1 24 MOVX @Ri,A - *____________________________________________________________________________ - * - */ - -int -t_uc51r::inst_movx_Sri_a(uchar code) +/*void +cl_uc51r_dummy_hw::happen(class cl_hw *where, enum hw_event he, void *params) { - class cl_cell *cell; - t_mem d= 0; - - cell= iram->get_cell(get_reg(code & 0x01)->read()); - d= cell->read(); - if (sfr->get(AUXR) & bmEXTRAM) - write_mem(MEM_XRAM, sfr->read(P2)*256 + d, acc->read()); - else - ERAM[d]= acc->read(); - tick(1); - return(resGO); -} + struct ev_port_changed *ep= (struct ev_port_changed *)params; + + if (where->cathegory == HW_PORT && + he == EV_PORT_CHANGED && + ep->id == 3) + { + t_mem p3o= ep->pins & ep->prev_value; + t_mem p3n= ep->new_pins & ep->new_value; + if ((p3o & bm_INT0) && + !(p3n & bm_INT0)) + uc51->p3_int0_edge++; + if ((p3o & bm_INT1) && + !(p3n & bm_INT1)) + uc51->p3_int1_edge++; + } +}*/ /* End of s51.src/uc51r.cc */ diff --git a/sim/ucsim/s51.src/uc51rcl.h b/sim/ucsim/s51.src/uc51rcl.h index 9fa378d8..1518bfce 100644 --- a/sim/ucsim/s51.src/uc51rcl.h +++ b/sim/ucsim/s51.src/uc51rcl.h @@ -34,31 +34,46 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "itsrccl.h" -class t_uc51r: public t_uc52 +class cl_uc51r: public cl_uc52 { public: int clock_out; public: - uchar ERAM[ERAM_SIZE]; + //uchar ERAM[ERAM_SIZE]; public: - t_uc51r(int Itype, int Itech, class cl_sim *asim); + cl_uc51r(int Itype, int Itech, class cl_sim *asim); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual void reset(void); + virtual void clear_sfr(void); - virtual void eram2xram(void); - virtual void xram2eram(void); + //virtual void eram2xram(void); + //virtual void xram2eram(void); //virtual void proc_write(t_addr addr); virtual void received(int c); - virtual int inst_movx_a_Sdptr(uchar code); /* e0 */ - virtual int inst_movx_a_Sri(uchar code); /* e2,e3 */ - virtual int inst_movx_Sdptr_a(uchar code); /* f0 */ - virtual int inst_movx_Sri_a(uchar code); /* f2,f3 */ + //virtual int inst_movx_a_Sdptr(uchar code); /* e0 */ + //virtual int inst_movx_a_Sri(uchar code); /* e2,e3 */ + //virtual int inst_movx_Sdptr_a(uchar code); /* f0 */ + //virtual int inst_movx_Sri_a(uchar code); /* f2,f3 */ +}; + + +class cl_uc51r_dummy_hw: public cl_hw +{ +protected: + class cl_memory_cell *cell_auxr; +public: + cl_uc51r_dummy_hw(class cl_uc *auc); + virtual int init(void); + + virtual void write(class cl_memory_cell *cell, t_mem *val); + //virtual void happen(class cl_hw *where, enum hw_event he, void *params); }; diff --git a/sim/ucsim/s51.src/uc52.cc b/sim/ucsim/s51.src/uc52.cc index 122164d3..41053953 100644 --- a/sim/ucsim/s51.src/uc52.cc +++ b/sim/ucsim/s51.src/uc52.cc @@ -39,280 +39,103 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA * Making an 8052 CPU object */ -t_uc52::t_uc52(int Itype, int Itech, class cl_sim *asim): - t_uc51(Itype, Itech, asim) +cl_uc52::cl_uc52(int Itype, int Itech, class cl_sim *asim): + cl_51core(Itype, Itech, asim) { - /*it_sources->add(new cl_it_src(bmET2, T2CON, bmTF2, 0x002b, false, - "timer #2 TF2"));*/ - /*exf2it= new cl_it_src(bmET2, T2CON, bmEXF2, 0x002b, false, - "timer #2 EXF2"); - it_sources->add(exf2it);*/ } void -t_uc52::mk_hw_elements(void) +cl_uc52::mk_hw_elements(void) { class cl_hw *h; - t_uc51::mk_hw_elements(); + cl_51core::mk_hw_elements(); hws->add(h= new cl_timer2(this, 2, "timer2", t2_default|t2_down)); h->init(); } +void +cl_uc52::make_memories(void) +{ + class cl_address_space *as; + + rom= as= new cl_address_space("rom", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + iram= as= new cl_address_space("iram", 0, 0x100, 8); + as->init(); + address_spaces->add(as); + sfr= as= new cl_address_space("sfr", 0x80, 0x80, 8); + as->init(); + address_spaces->add(as); + xram= as= new cl_address_space("xram", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x100, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("iram"), chip, 0, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("xram_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("xram"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("sfr_chip", 0x80, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("sfr"), chip, 0x80, 0xff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + acc= sfr->get_cell(ACC); + psw= sfr->get_cell(PSW); +} + -t_addr -t_uc52::get_mem_size(enum mem_class type) +void +cl_uc52::clear_sfr(void) { - switch (type) - { - case MEM_IRAM: return(0x100); - default: return(t_uc51::get_mem_size(type)); - } - return(0); + cl_51core::clear_sfr(); + sfr->write(T2CON, 0); + sfr->write(TH2, 0); + sfr->write(TL2, 0); + sfr->write(RCAP2L, 0); + sfr->write(RCAP2H, 0); } /* * Calculating address of indirectly addressed IRAM cell * - * If CPU is 8051 and addr is over 127, it must be illegal! But in 52 - * it is legal. - * */ -class cl_cell * -t_uc52::get_indirect(uchar addr, int *res) +class cl_memory_cell * +cl_uc52::get_indirect(uchar addr, int *res) { *res= resGO; return(iram->get_cell(addr)); } -/* - * Simulating timers - * - * Calling inherited method to simulate timer #0 and #1 and then - * simulating timer #2. - * - */ - -/*void -t_uc52::do_extra_hw(int cycles) -{ - do_timer2(cycles); -}*/ - - -/* - * Simulating timer 2 - */ - -/*int -t_uc52::do_timer2(int cycles) -{ - bool nocount= DD_FALSE; - uint t2con= get_mem(MEM_SFR, T2CON); - - exf2it->activate(); - if (!(t2con & bmTR2)) - // Timer OFF - return(resGO); - - if (t2con & (bmRCLK | bmTCLK)) - return(do_t2_baud(cycles)); - - // Determining nr of input clocks - if (!(t2con & bmTR2)) - nocount= DD_TRUE; // Timer OFF - else - if (t2con & bmC_T2) - { - // Counter mode, falling edge on P1.0 (T2) - if ((prev_p1 & bmT2) && - !(sfr->read(P1) & bmT2)) - cycles= 1; - else - nocount= DD_TRUE; - } - // Counting - while (cycles--) - { - if (t2con & bmCP_RL2) - do_t2_capture(&cycles, nocount); - else - do_t2_reload(&cycles, nocount); - }// while cycles - - return(resGO); -}*/ - - -/* - * Baud rate generator mode of Timer #2 - */ - -/*int -t_uc52::do_t2_baud(int cycles) -{ - t_mem t2con= sfr->get(T2CON); - //uint p1= get_mem(MEM_SFR, P1); - - // Baud Rate Generator - if ((prev_p1 & bmT2EX) && - !(sfr->read(P1) & bmT2EX) && - (t2con & bmEXEN2)) - mem(MEM_SFR)->set_bit1(T2CON, bmEXF2); - if (t2con & bmC_T2) - { - if ((prev_p1 & bmT2) && - !(sfr->read(P1) & bmT2)) - cycles= 1; - else - cycles= 0; - } - else - cycles*= 6; - if (t2con & bmTR2) - while (cycles--) - { - if (!sfr->add(TL2, 1)) - if (!sfr->add(TH2, 1)) - { - sfr->set(TH2, sfr->get(RCAP2H)); - sfr->set(TL2, sfr->get(RCAP2L)); - s_rec_t2++; - s_tr_t2++; - } - } - return(resGO); -}*/ - - -/* - * Capture function of Timer #2 - */ - -/*void -t_uc52::do_t2_capture(int *cycles, bool nocount) -{ - //uint p1= get_mem(MEM_SFR, P1); - t_mem t2con= sfr->get(T2CON); - - // Capture mode - if (nocount) - *cycles= 0; - else - { - if (!sfr->add(TL2, 1)) - { - if (!sfr->add(TH2, 1)) - mem(MEM_SFR)->set_bit1(T2CON, bmTF2); - } - } - // capture - if ((prev_p1 & bmT2EX) && - !(sfr->read(P1) & bmT2EX) && - (t2con & bmEXEN2)) - { - sfr->set(RCAP2H, sfr->get(TH2)); - sfr->set(RCAP2L, sfr->get(TL2)); - mem(MEM_SFR)->set_bit1(T2CON, bmEXF2); - prev_p1&= ~bmT2EX; // Falling edge has been handled - } -}*/ - - -/* - * Auto Reload mode of Timer #2, counting UP - */ - -/*void -t_uc52::do_t2_reload(int *cycles, bool nocount) -{ - int overflow; - bool ext2= 0; - - // Auto-Relode mode - overflow= 0; - if (nocount) - *cycles= 0; - else - { - if (!sfr->add(TL2, 1)) - { - if (!sfr->add(TH2, 1)) - { - sfr->set_bit1(T2CON, bmTF2); - overflow++; - } - } - } - // reload - if ((prev_p1 & bmT2EX) && - !(sfr->read(P1) & bmT2EX) && - (sfr->get(T2CON) & bmEXEN2)) - { - ext2= DD_TRUE; - sfr->set_bit1(T2CON, bmEXF2); - prev_p1&= ~bmT2EX; // Falling edge has been handled - } - if (overflow || - ext2) - { - sfr->set(TH2, sfr->get(RCAP2H)); - sfr->set(TL2, sfr->get(RCAP2L)); - } -}*/ - - -/* - * - */ - -/*int -t_uc52::serial_bit_cnt(int mode) -{ - int divby= 12; - int *tr_src= 0, *rec_src= 0; - - switch (mode) - { - case 0: - divby = 12; - tr_src = &s_tr_tick; - rec_src= &s_rec_tick; - break; - case 1: - case 3: - divby = (get_mem(MEM_SFR, PCON)&bmSMOD)?16:32; - tr_src = (get_mem(MEM_SFR, T2CON)&bmTCLK)?(&s_tr_t2):(&s_tr_t1); - rec_src= (get_mem(MEM_SFR, T2CON)&bmTCLK)?(&s_rec_t2):(&s_rec_t1); - break; - case 2: - divby = (get_mem(MEM_SFR, PCON)&bmSMOD)?16:32; - tr_src = &s_tr_tick; - rec_src= &s_rec_tick; - break; - } - if (s_sending) - { - while (*tr_src >= divby) - { - (*tr_src)-= divby; - s_tr_bit++; - } - } - if (s_receiving) - { - while (*rec_src >= divby) - { - (*rec_src)-= divby; - s_rec_bit++; - } - } - return(0); -}*/ - - /* End of s51.src/uc52.cc */ diff --git a/sim/ucsim/s51.src/uc52cl.h b/sim/ucsim/s51.src/uc52cl.h index ff153785..b0890a88 100644 --- a/sim/ucsim/s51.src/uc52cl.h +++ b/sim/ucsim/s51.src/uc52cl.h @@ -34,7 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "itsrccl.h" -class t_uc52: public t_uc51 +class cl_uc52: public cl_51core { protected: //class cl_it_src *exf2it; @@ -42,11 +42,14 @@ protected: //int s_tr_t2; // T2 overflows for sending public: - t_uc52(int Itype, int Itech, class cl_sim *asim); + cl_uc52(int Itype, int Itech, class cl_sim *asim); virtual void mk_hw_elements(void); + virtual void make_memories(void); - virtual class cl_cell *get_indirect(uchar addr, int *res); - virtual t_addr get_mem_size(enum mem_class type); + virtual void clear_sfr(void); + + virtual class cl_memory_cell *get_indirect(uchar addr, int *res); + //virtual t_addr get_mem_size(enum mem_class type); /*virtual void do_extra_hw(int cycles); virtual int do_timer2(int cycles); diff --git a/sim/ucsim/s51.src/uc89c51r.cc b/sim/ucsim/s51.src/uc89c51r.cc index 7a137da4..f29e51d6 100644 --- a/sim/ucsim/s51.src/uc89c51r.cc +++ b/sim/ucsim/s51.src/uc89c51r.cc @@ -33,51 +33,40 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "uc89c51rcl.h" #include "regs51.h" #include "pcacl.h" +#include "wdtcl.h" -t_uc89c51r::t_uc89c51r(int Itype, int Itech, class cl_sim *asim): - t_uc51r(Itype, Itech, asim) +cl_uc89c51r::cl_uc89c51r(int Itype, int Itech, class cl_sim *asim): + cl_uc51r(Itype, Itech, asim) { - /*it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF4, 0x0033, false, - "PCA module #4")); - it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF3, 0x0033, false, - "PCA module #3")); - it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF2, 0x0033, false, - "PCA module #2")); - it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF1, 0x0033, false, - "PCA module #1")); - it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCCF0, 0x0033, false, - "PCA module #0")); - it_sources->add_at(4, new cl_it_src(bmEC, CCON, bmCF, 0x0033, false, - "PCA counter"));*/ } void -t_uc89c51r::mk_hw_elements(void) +cl_uc89c51r::mk_hw_elements(void) { class cl_hw *h; - t_uc51r::mk_hw_elements(); - hws->add(h= new cl_pca(this, 0)); - h->init(); - /*hws->add(h= new cl_pca(this, 1)); + cl_uc52::mk_hw_elements(); + hws->add(h= new cl_wdt(this, 0x3fff)); h->init(); - hws->add(h= new cl_pca(this, 2)); - h->init(); - hws->add(h= new cl_pca(this, 3)); + hws->add(h= new cl_pca(this, 0)); h->init(); - hws->add(h= new cl_pca(this, 4)); - h->init();*/ hws->add(h= new cl_89c51r_dummy_hw(this)); h->init(); } +void +cl_uc89c51r::make_memories(void) +{ + cl_uc52::make_memories(); +} + void -t_uc89c51r::reset(void) +cl_uc89c51r::reset(void) { - t_uc51r::reset(); + cl_uc51r::reset(); sfr->set_bit1(CCAPM0, bmECOM); sfr->set_bit1(CCAPM1, bmECOM); sfr->set_bit1(CCAPM2, bmECOM); @@ -85,11 +74,11 @@ t_uc89c51r::reset(void) sfr->set_bit1(CCAPM4, bmECOM); //t0_overflows= 0; dpl0= dph0= dpl1= dph1= 0; - sfr->set(IPH, 0); + sfr->write(IPH, 0); } int -t_uc89c51r::it_priority(uchar ie_mask) +cl_uc89c51r::it_priority(uchar ie_mask) { uchar l, h; @@ -107,7 +96,7 @@ t_uc89c51r::it_priority(uchar ie_mask) } void -t_uc89c51r::pre_inst(void) +cl_uc89c51r::pre_inst(void) { if (sfr->get(AUXR1) & bmDPS) { @@ -119,11 +108,11 @@ t_uc89c51r::pre_inst(void) sfr->set(DPL, dpl0); sfr->set(DPH, dph0); } - t_uc51r::pre_inst(); + cl_uc51r::pre_inst(); } void -t_uc89c51r::post_inst(void) +cl_uc89c51r::post_inst(void) { if (sfr->get(AUXR1) & bmDPS) { @@ -135,7 +124,7 @@ t_uc89c51r::post_inst(void) dpl0= sfr->get(DPL); dph0= sfr->get(DPH); } - t_uc51r::post_inst(); + cl_uc51r::post_inst(); } @@ -149,7 +138,7 @@ cl_89c51r_dummy_hw::cl_89c51r_dummy_hw(class cl_uc *auc): int cl_89c51r_dummy_hw::init(void) { - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); if (!sfr) { fprintf(stderr, "No SFR to register %s[%d] into\n", id_string, id); @@ -160,7 +149,7 @@ cl_89c51r_dummy_hw::init(void) } void -cl_89c51r_dummy_hw::write(class cl_cell *cell, t_mem *val) +cl_89c51r_dummy_hw::write(class cl_memory_cell *cell, t_mem *val) { if (cell == auxr) auxr->set_bit0(0x04); diff --git a/sim/ucsim/s51.src/uc89c51rcl.h b/sim/ucsim/s51.src/uc89c51rcl.h index 02936ee3..28075631 100644 --- a/sim/ucsim/s51.src/uc89c51rcl.h +++ b/sim/ucsim/s51.src/uc89c51rcl.h @@ -33,7 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "uc51rcl.h" -class t_uc89c51r: public t_uc51r +class cl_uc89c51r: public cl_uc51r { public: //int t0_overflows; @@ -41,8 +41,9 @@ public: uchar dpl1, dph1; public: - t_uc89c51r(int Itype, int Itech, class cl_sim *asim); + cl_uc89c51r(int Itype, int Itech, class cl_sim *asim); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual void reset(void); virtual void pre_inst(void); @@ -59,12 +60,12 @@ public: class cl_89c51r_dummy_hw: public cl_hw { protected: - class cl_cell *auxr; + class cl_memory_cell *auxr; public: cl_89c51r_dummy_hw(class cl_uc *auc); virtual int init(void); - virtual void write(class cl_cell *cell, t_mem *val); + virtual void write(class cl_memory_cell *cell, t_mem *val); }; #endif diff --git a/sim/ucsim/s51.src/wdt.cc b/sim/ucsim/s51.src/wdt.cc index 7e7141e0..d4b10cd6 100644 --- a/sim/ucsim/s51.src/wdt.cc +++ b/sim/ucsim/s51.src/wdt.cc @@ -43,7 +43,7 @@ cl_wdt::cl_wdt(class cl_uc *auc, long resetvalue): int cl_wdt::init(void) { - class cl_mem *sfr= uc->mem(MEM_SFR); + class cl_address_space *sfr= uc->address_space(MEM_SFR_ID); if (!sfr) { @@ -55,7 +55,7 @@ cl_wdt::init(void) } void -cl_wdt::write(class cl_cell *cell, t_mem *val) +cl_wdt::write(class cl_memory_cell *cell, t_mem *val) { if (cell == wdtrst && (((*val)&0xff) == 0xe1) && diff --git a/sim/ucsim/s51.src/wdtcl.h b/sim/ucsim/s51.src/wdtcl.h index 88ff39a1..be1d57a5 100644 --- a/sim/ucsim/s51.src/wdtcl.h +++ b/sim/ucsim/s51.src/wdtcl.h @@ -42,14 +42,14 @@ class cl_wdt: public cl_hw { protected: long wdt, reset_value; - class cl_cell *wdtrst; + class cl_memory_cell *wdtrst; bool written_since_reset; public: cl_wdt(class cl_uc *auc, long resetvalue); virtual int init(void); - //virtual t_mem read(class cl_cell *cell); - virtual void write(class cl_cell *cell, t_mem *val); + //virtual t_mem read(class cl_memory_cell *cell); + virtual void write(class cl_memory_cell *cell, t_mem *val); //virtual t_mem set_cmd(t_mem value); diff --git a/sim/ucsim/sim.src/(c).1 b/sim/ucsim/sim.src/(c).1 index d673f9fd..ce02b92f 100644 --- a/sim/ucsim/sim.src/(c).1 +++ b/sim/ucsim/sim.src/(c).1 @@ -1,5 +1,5 @@ /* - * Simulator of microcontrollers (@@F@@) + * Simulator of microcontrollers (sim.src/@@F@@) * * Copyright (C) @@S@@,@@Y@@ Drotos Daniel, Talker Bt. * @@ -7,19 +7,21 @@ * */ -/* This file is part of microcontroller simulator: ucsim. +/* + This file is part of microcontroller simulator: ucsim. -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ diff --git a/sim/ucsim/sim.src/Makefile.in b/sim/ucsim/sim.src/Makefile.in index 77ce47da..50a17eea 100644 --- a/sim/ucsim/sim.src/Makefile.in +++ b/sim/ucsim/sim.src/Makefile.in @@ -34,7 +34,7 @@ man2dir = $(mandir)/man2 infodir = @infodir@ srcdir = @srcdir@ -OBJECTS = mem.o sim.o itsrc.o brk.o arg.o stack.o \ +OBJECTS = stack.o mem.o sim.o itsrc.o brk.o arg.o \ guiobj.o uc.o hw.o @@ -43,7 +43,7 @@ OBJECTS = mem.o sim.o itsrc.o brk.o arg.o stack.o \ all: checkconf sim_lib test_mem_speed: $(PRJDIR)/lib*.a test_mem_speed.o - $(CC) -o $@ test_mem_speed.o -L$(PRJDIR) -lsim -lutil -lcmd -lsim + $(CXX) -o $@ test_mem_speed.o -L$(PRJDIR) -Wl,--start-group -lsim -lutil -lcmd -Wl,--end-group sim.src: all diff --git a/sim/ucsim/sim.src/arg.cc b/sim/ucsim/sim.src/arg.cc index 8777353c..e38ae65d 100644 --- a/sim/ucsim/sim.src/arg.cc +++ b/sim/ucsim/sim.src/arg.cc @@ -130,8 +130,7 @@ cl_cmd_arg::~cl_cmd_arg(void) bool cl_cmd_arg::as_address(class cl_uc *uc) { - bool b= get_address(uc, &(value.address)); - return(b); + return(get_address(uc, &(value.address))); } bool @@ -152,8 +151,19 @@ cl_cmd_arg::as_data(void) bool cl_cmd_arg::as_memory(class cl_uc *uc) { - value.memory= uc->mem(s_value); - return(value.memory != 0); + value.memory.memory= uc->memory(s_value); + value.memory.address_space= 0; + value.memory.memchip= 0; + if (value.memory.memory) + { + if (value.memory.memory->is_chip()) + value.memory.memchip= + dynamic_cast(value.memory.memory); + if (value.memory.memory->is_address_space()) + value.memory.address_space= + dynamic_cast(value.memory.memory); + } + return(value.memory.memory != 0); } bool @@ -207,7 +217,7 @@ cl_cmd_int_arg::get_address(class cl_uc *uc, t_addr *addr) bool cl_cmd_int_arg::get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask) { @@ -266,15 +276,14 @@ cl_cmd_sym_arg::get_address(class cl_uc *uc, t_addr *addr) bool cl_cmd_sym_arg::get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask) { struct name_entry *ne; - if ((ne= get_name_entry(uc->bit_tbl(), - get_svalue(), - uc)) == NULL) + ne= get_name_entry(uc->bit_tbl(), get_svalue(), uc); + if (ne == NULL) return(DD_FALSE); if (mem) *mem= uc->bit2mem(ne->addr, mem_addr, bit_mask); @@ -316,7 +325,8 @@ cl_cmd_sym_arg::as_hw(class cl_uc *uc) cl_cmd_str_arg::cl_cmd_str_arg(/*class cl_uc *iuc,*/ char *str): cl_cmd_arg(/*iuc,*/ str) -{} +{ +} /* Bit */ @@ -347,12 +357,16 @@ cl_cmd_bit_arg::get_address(class cl_uc *uc, t_addr *addr) bool cl_cmd_bit_arg::get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask) { if (mem) - *mem= uc->mem(MEM_SFR); + { + *mem= uc->address_space(MEM_SFR_ID); + if (!*mem) + return(DD_FALSE); + } if (mem_addr) { if (!sfr || @@ -413,7 +427,7 @@ cl_cmd_array_arg::as_hw(class cl_uc *uc) * Program arguments *---------------------------------------------------------------------------- */ - +/* cl_prg_arg::cl_prg_arg(char sn, char *ln, long lv): cl_arg(lv) { @@ -447,13 +461,13 @@ cl_prg_arg::~cl_prg_arg(void) if (long_name) free(long_name); } - +*/ /* * List of arguments *---------------------------------------------------------------------------- */ - +/* int cl_arguments::arg_avail(char nam) { @@ -556,6 +570,6 @@ cl_arguments::get_parg(char sname, char *lname) } return(0); } - +*/ /* End of arg.cc */ diff --git a/sim/ucsim/sim.src/argcl.h b/sim/ucsim/sim.src/argcl.h index acf7be14..c829d92e 100644 --- a/sim/ucsim/sim.src/argcl.h +++ b/sim/ucsim/sim.src/argcl.h @@ -59,7 +59,7 @@ public: virtual double get_fvalue(void); virtual void *get_pvalue(void); virtual bool get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask) { return(DD_FALSE); } }; @@ -73,13 +73,16 @@ class cl_cmd_arg: public cl_arg { public: //class cl_uc *uc; - bool interpreted_as_string; union { long number; t_addr address; t_mem data; - class cl_mem *memory; + struct { + class cl_memory *memory; + class cl_address_space *address_space; + class cl_memory_chip *memchip; + } memory; class cl_hw *hw; struct { int len; @@ -90,7 +93,7 @@ public: int len; } data_list; struct { - class cl_mem *mem; + class cl_address_space *mem; t_addr mem_address; t_mem mask; } bit; @@ -121,7 +124,7 @@ public: virtual bool get_address(class cl_uc *uc, t_addr *addr); virtual bool get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask); virtual bool as_string(void); @@ -134,10 +137,11 @@ public: virtual bool get_address(class cl_uc *uc, t_addr *addr); virtual bool get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask); virtual bool as_address(class cl_uc *uc); + virtual bool as_number(void) { return(DD_FALSE); } virtual bool as_string(void); virtual bool as_hw(class cl_uc *uc); }; @@ -148,6 +152,7 @@ public: cl_cmd_str_arg(/*class cl_uc *iuc,*/ char *str); virtual int is_string(void) { return(1); } + virtual bool as_number(void) { return(DD_FALSE); } }; class cl_cmd_bit_arg: public cl_cmd_arg @@ -162,7 +167,7 @@ public: virtual bool get_address(class cl_uc *uc, t_addr *addr); virtual bool get_bit_address(class cl_uc *uc, // input - class cl_mem **mem, // outputs + class cl_address_space **mem, // outputs t_addr *mem_addr, t_mem *bit_mask); }; @@ -184,7 +189,7 @@ public: * Program arguments */ -class cl_prg_arg: public cl_arg +/*class cl_prg_arg: public cl_arg { public: char short_name; @@ -196,14 +201,14 @@ public: cl_prg_arg(char sn, char *ln, double fv); cl_prg_arg(char sn, char *ln, void *pv); virtual ~cl_prg_arg(void); -}; +};*/ /* * List of arguments */ -class cl_arguments: public cl_list +/*class cl_arguments: public cl_list { public: cl_arguments(void): cl_list(5, 5) {} @@ -214,7 +219,7 @@ public: virtual char *get_sarg(char sname, char *lname); virtual double get_farg(char sname, char *lname); virtual void *get_parg(char sname, char *lname); -}; +};*/ #endif diff --git a/sim/ucsim/sim.src/brk.cc b/sim/ucsim/sim.src/brk.cc index b18b89f3..f28ccc62 100644 --- a/sim/ucsim/sim.src/brk.cc +++ b/sim/ucsim/sim.src/brk.cc @@ -38,7 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA * Base object of breakpoints */ -cl_brk::cl_brk(class cl_mem *imem, int inr, t_addr iaddr, +cl_brk::cl_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit): cl_base() { @@ -84,7 +84,7 @@ cl_brk::do_hit(void) * FETCH type of breakpoint */ -cl_fetch_brk::cl_fetch_brk(class cl_mem *imem, int inr, t_addr iaddr, +cl_fetch_brk::cl_fetch_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit): cl_brk(imem, inr, iaddr, iperm, ihit) { @@ -102,7 +102,7 @@ cl_fetch_brk::type(void) * Base of EVENT type of breakpoints */ -cl_ev_brk::cl_ev_brk(class cl_mem *imem, int inr, t_addr iaddr, +cl_ev_brk::cl_ev_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit, enum brk_event ievent, const char *iid): cl_brk(imem, inr, iaddr, iperm, ihit) @@ -112,7 +112,7 @@ cl_ev_brk::cl_ev_brk(class cl_mem *imem, int inr, t_addr iaddr, mem = imem; } -cl_ev_brk::cl_ev_brk(class cl_mem *imem, int inr, t_addr iaddr, +cl_ev_brk::cl_ev_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit, char op): cl_brk(imem, inr, iaddr, iperm, ihit) { @@ -147,126 +147,15 @@ cl_ev_brk::match(struct event_rec *ev) } -/* - * WRITE IRAM type of EVENT breakpoints - */ - -/*cl_wi_brk::cl_wi_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkWIRAM, "wi") -{} - -bool -cl_wi_brk::match(struct event_rec *ev) -{ - return(ev->wi == addr); -}*/ - - -/* - * READ IRAM type of EVENT breakpoints - */ - -/*cl_ri_brk::cl_ri_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkRIRAM, "ri") -{} - -bool -cl_ri_brk::match(struct event_rec *ev) -{ - return(ev->ri == addr); -}*/ - - -/* - * WRITE XRAM type of EVENT breakpoints - */ - -/*cl_wx_brk::cl_wx_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkWXRAM, "wx") -{} - -bool -cl_wx_brk::match(struct event_rec *ev) -{ - return(ev->wx == addr); -}*/ - - -/* - * READ XRAM type of EVENT breakpoints - */ - -/*cl_rx_brk::cl_rx_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkRXRAM, "rx") -{} - -bool -cl_rx_brk::match(struct event_rec *ev) -{ - return(ev->rx == addr); -}*/ - - -/* - * WRITE SFR type of EVENT breakpoints - */ - -/*cl_ws_brk::cl_ws_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkWSFR, "ws") -{} - -bool -cl_ws_brk::match(struct event_rec *ev) -{ - return(ev->ws == addr); -}*/ - - -/* - * READ SFR type of EVENT breakpoints - */ - -/*cl_rs_brk::cl_rs_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkRSFR, "rs") -{} - -bool -cl_rs_brk::match(struct event_rec *ev) -{ - return(ev->rs == addr); -}*/ - - -/* - * READ CODE type of EVENT breakpoints - */ - -/*cl_rc_brk::cl_rc_brk(class cl_mem *imem, int inr, t_addr iaddr, - enum brk_perm iperm, int ihit): - cl_ev_brk(imem, inr, iaddr, iperm, ihit, brkRCODE, "rc") -{} - -bool -cl_rc_brk::match(struct event_rec *ev) -{ - return(ev->rc == addr); -}*/ - - /* * Collection of break-points * * This is a sorted collection, sorted by nr field of brk items. */ -brk_coll::brk_coll(t_index alimit, t_index adelta, class cl_mem *arom): - cl_sorted_list(alimit, adelta) +brk_coll::brk_coll(t_index alimit, t_index adelta, + class cl_address_space *arom): + cl_sorted_list(alimit, adelta, "breakpoints") { rom= arom; } @@ -374,9 +263,8 @@ class cl_brk * brk_coll::get_bp(t_addr addr, int *idx) { if (rom && - addr < rom->size && - /*rom->bp_map->get(addr)*/ - rom->get_cell_flag(addr, CELL_FETCH_BRK)) + rom->valid_address(addr) && + rom->get_cell_flag(addr, CELL_FETCH_BRK)) { for (*idx= 0; *idx < count; (*idx)++) { @@ -406,8 +294,7 @@ bool brk_coll::bp_at(t_addr addr) { return(rom && - addr < rom->size && - /*rom->bp_map->get(addr)*/ + rom->valid_address(addr) && rom->get_cell_flag(addr, CELL_FETCH_BRK)); } diff --git a/sim/ucsim/sim.src/brkcl.h b/sim/ucsim/sim.src/brkcl.h index b5ed8a80..0b93c725 100644 --- a/sim/ucsim/sim.src/brkcl.h +++ b/sim/ucsim/sim.src/brkcl.h @@ -45,7 +45,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_brk: public cl_base { protected: - class cl_mem *mem; + class cl_address_space *mem; public: int nr; t_addr addr; @@ -53,10 +53,12 @@ public: int hit; int cnt; - cl_brk(class cl_mem *imem, int inr, t_addr iaddr, + cl_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit); virtual ~cl_brk(void); + class cl_address_space *get_mem(void) { return(mem); } + virtual void activate(void); virtual void inactivate(void); virtual enum brk_type type(void)= 0; @@ -74,7 +76,7 @@ class cl_fetch_brk: public cl_brk public: uchar code; - cl_fetch_brk(class cl_mem *imem, int inr, t_addr iaddr, + cl_fetch_brk(class cl_address_space *imem, int inr, t_addr iaddr, enum brk_perm iperm, int ihit); virtual enum brk_type type(void); @@ -89,9 +91,11 @@ public: class cl_ev_brk: public cl_brk { public: - cl_ev_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, + cl_ev_brk(class cl_address_space *imem, int inr, t_addr iaddr, + enum brk_perm iperm, int ihit, enum brk_event ievent, const char *iid); - cl_ev_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, + cl_ev_brk(class cl_address_space *imem, int inr, t_addr iaddr, + enum brk_perm iperm, int ihit, char op); enum brk_event event; const char *id; @@ -102,104 +106,6 @@ public: }; -/* - * WRITE IRAM - */ - -/*class cl_wi_brk: public cl_ev_brk -{ -public: - cl_wi_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * READ IRAM - */ - -/*class cl_ri_brk: public cl_ev_brk -{ -public: - cl_ri_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * WRITE XRAM - */ - -/*class cl_wx_brk: public cl_ev_brk -{ -public: - cl_wx_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * READ XRAM - */ - -/*class cl_rx_brk: public cl_ev_brk -{ -public: - cl_rx_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * WRITE SFR - */ - -/*class cl_ws_brk: public cl_ev_brk -{ -public: - cl_ws_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * READ SFR - */ - -/*class cl_rs_brk: public cl_ev_brk -{ -public: - cl_rs_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - -/* - * READ CODE - */ - -/*class cl_rc_brk: public cl_ev_brk -{ -public: - cl_rc_brk(class cl_mem *imem, int inr, t_addr iaddr, enum brk_perm iperm, - int ihit); - - virtual bool match(struct event_rec *ev); -};*/ - - /* * Collection of breakpoint sorted by address */ @@ -207,9 +113,9 @@ public: class brk_coll: public cl_sorted_list { public: - class cl_mem/*rom*/ *rom; + class cl_address_space/*rom*/ *rom; public: - brk_coll(t_index alimit, t_index adelta, class cl_mem/*rom*/ *arom); + brk_coll(t_index alimit, t_index adelta, class cl_address_space/*rom*/*arom); virtual void *key_of(void *item); virtual int compare(void *key1, void *key2); diff --git a/sim/ucsim/sim.src/hw.cc b/sim/ucsim/sim.src/hw.cc index 167c1cad..45fa7059 100644 --- a/sim/ucsim/sim.src/hw.cc +++ b/sim/ucsim/sim.src/hw.cc @@ -38,8 +38,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA *____________________________________________________________________________ */ -cl_watched_cell::cl_watched_cell(class cl_mem *amem, t_addr aaddr, - class cl_cell **astore, +cl_watched_cell::cl_watched_cell(class cl_address_space *amem, t_addr aaddr, + class cl_memory_cell **astore, enum what_to_do_on_cell_change awtd) { mem= amem; @@ -55,7 +55,7 @@ cl_watched_cell::cl_watched_cell(class cl_mem *amem, t_addr aaddr, } void -cl_watched_cell::mem_cell_changed(class cl_mem *amem, t_addr aaddr, +cl_watched_cell::mem_cell_changed(class cl_address_space *amem, t_addr aaddr, class cl_hw *hw) { if (mem && @@ -74,8 +74,14 @@ cl_watched_cell::mem_cell_changed(class cl_mem *amem, t_addr aaddr, } } -/*void -cl_used_cell::mem_cell_changed(class cl_mem *amem, t_addr aaddr, +void +cl_watched_cell::address_space_added(class cl_address_space *amem, + class cl_hw *hw) +{ +} + +void +cl_used_cell::mem_cell_changed(class cl_address_space *amem, t_addr aaddr, class cl_hw *hw) { if (mem && @@ -92,7 +98,13 @@ class cl_hw *hw) hw->write(cell, &d); } } -}*/ +} + +void +cl_used_cell::address_space_added(class cl_address_space *amem, + class cl_hw *hw) +{ +} /* @@ -111,8 +123,12 @@ cl_hw::cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, char *aid_string): id_string= strdup(aid_string); else id_string= strdup("unknown hw element"); - partners= new cl_list(2, 2); - watched_cells= new cl_list(2, 2); + char *s= (char*)malloc(strlen(get_name("hw"))+100); + sprintf(s, "partners of %s", get_name("hw")); + partners= new cl_list(2, 2, s); + sprintf(s, "watched cells of %s", get_name("hw")); + watched_cells= new cl_list(2, 2, s); + free(s); } cl_hw::~cl_hw(void) @@ -159,43 +175,52 @@ cl_hw::make_partner(enum hw_cath cath, int id) */ /*t_mem -cl_hw::read(class cl_mem *mem, t_addr addr) +cl_hw::read(class cl_m *mem, t_addr addr) { // Simply return the value return(mem->get(addr)); }*/ /*void -cl_hw::write(class cl_mem *mem, t_addr addr, t_mem *val) +cl_hw::write(class cl_m *mem, t_addr addr, t_mem *val) { // Do not change *val by default }*/ +void +cl_hw::set_cmd(class cl_cmdline *cmdline, class cl_console *con) +{ + con->dd_printf("Nothing to do\n"); +} -class cl_cell * -cl_hw::register_cell(class cl_mem *mem, t_addr addr, class cl_cell **store, +class cl_memory_cell * +cl_hw::register_cell(class cl_address_space *mem, t_addr addr, + class cl_memory_cell **store, enum what_to_do_on_cell_change awtd) { class cl_watched_cell *wc; - class cl_cell *cell; + class cl_memory_cell *cell; if (mem) mem->register_hw(addr, this, (int*)0, DD_FALSE); + else + printf("regcell JAJ no mem\n"); wc= new cl_watched_cell(mem, addr, &cell, awtd); if (store) *store= cell; watched_cells->add(wc); // announce - uc->sim->mem_cell_changed(mem, addr); + //uc->sim->mem_cell_changed(mem, addr); return(cell); } -class cl_cell * -cl_hw::use_cell(class cl_mem *mem, t_addr addr, class cl_cell **store, +class cl_memory_cell * +cl_hw::use_cell(class cl_address_space *mem, t_addr addr, + class cl_memory_cell **store, enum what_to_do_on_cell_change awtd) { class cl_watched_cell *wc; - class cl_cell *cell; + class cl_memory_cell *cell; wc= new cl_used_cell(mem, addr, &cell, awtd); if (store) @@ -205,7 +230,7 @@ cl_hw::use_cell(class cl_mem *mem, t_addr addr, class cl_cell **store, } void -cl_hw::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_hw::mem_cell_changed(class cl_address_space *mem, t_addr addr) { int i; @@ -217,6 +242,19 @@ cl_hw::mem_cell_changed(class cl_mem *mem, t_addr addr) } } +void +cl_hw::address_space_added(class cl_address_space *as) +{ + int i; + + for (i= 0; i < watched_cells->count; i++) + { + class cl_watched_cell *wc= + dynamic_cast(watched_cells->object_at(i)); + wc->address_space_added(as, this); + } +} + /* * Simulating `cycles' number of machine cycle @@ -274,7 +312,7 @@ cl_hws::add(void *item) void -cl_hws::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_hws::mem_cell_changed(class cl_address_space *mem, t_addr addr) { int i; @@ -285,6 +323,18 @@ cl_hws::mem_cell_changed(class cl_mem *mem, t_addr addr) } } +void +cl_hws::address_space_added(class cl_address_space *mem) +{ + int i; + + for (i= 0; i < count; i++) + { + class cl_hw *hw= (class cl_hw *)(at(i)); + hw->address_space_added(mem); + } +} + /* *____________________________________________________________________________ diff --git a/sim/ucsim/sim.src/hwcl.h b/sim/ucsim/sim.src/hwcl.h index a67921e0..3024011f 100644 --- a/sim/ucsim/sim.src/hwcl.h +++ b/sim/ucsim/sim.src/hwcl.h @@ -57,29 +57,35 @@ class cl_hw; // forward class cl_watched_cell: public cl_base { protected: - class cl_mem *mem; + class cl_address_space *mem; t_addr addr; - class cl_cell *cell; - class cl_cell **store; + class cl_memory_cell *cell; + class cl_memory_cell **store; public: enum what_to_do_on_cell_change wtd; public: - cl_watched_cell(class cl_mem *amem, t_addr aaddr, class cl_cell **astore, + cl_watched_cell(class cl_address_space *amem, t_addr aaddr, + class cl_memory_cell **astore, enum what_to_do_on_cell_change awtd); - virtual void mem_cell_changed(class cl_mem *amem, t_addr aaddr, + virtual void mem_cell_changed(class cl_address_space *amem, t_addr aaddr, class cl_hw *hw); + virtual void address_space_added(class cl_address_space *amem, + class cl_hw *hw); }; class cl_used_cell: public cl_watched_cell { public: - cl_used_cell(class cl_mem *amem, t_addr aaddr, class cl_cell **astore, + cl_used_cell(class cl_address_space *amem, t_addr aaddr, + class cl_memory_cell **astore, enum what_to_do_on_cell_change awtd): cl_watched_cell(amem, aaddr, astore, awtd) {} - /*virtual void mem_cell_changed(class cl_mem *amem, t_addr aaddr, - class cl_hw *hw);*/ + virtual void mem_cell_changed(class cl_address_space *amem, t_addr aaddr, + class cl_hw *hw); + virtual void address_space_added(class cl_address_space *amem, + class cl_hw *hw); }; class cl_hw: public cl_guiobj @@ -102,17 +108,21 @@ public: virtual void added_to_uc(void) {} virtual class cl_hw *make_partner(enum hw_cath cath, int id); - virtual t_mem read(class cl_cell *cell) { return(cell->get()); } - virtual void write(class cl_cell */*cell*/, t_mem */*val*/) {} - - virtual void set_cmd(class cl_cmdline *cmdline, class cl_console *con) {} - virtual class cl_cell *register_cell(class cl_mem *mem, t_addr addr, - class cl_cell **store, - enum what_to_do_on_cell_change awtd); - virtual class cl_cell *use_cell(class cl_mem *mem, t_addr addr, - class cl_cell **store, - enum what_to_do_on_cell_change awtd); - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + virtual t_mem read(class cl_memory_cell *cell) { return(cell->get()); } + virtual void write(class cl_memory_cell */*cell*/, t_mem */*val*/) {} + + virtual void set_cmd(class cl_cmdline *cmdline, class cl_console *con); + virtual class cl_memory_cell *register_cell(class cl_address_space *mem, + t_addr addr, + class cl_memory_cell **store, + enum what_to_do_on_cell_change + awtd); + virtual class cl_memory_cell *use_cell(class cl_address_space *mem, + t_addr addr, + class cl_memory_cell **store, + enum what_to_do_on_cell_change awtd); + virtual void mem_cell_changed(class cl_address_space *mem, t_addr addr); + virtual void address_space_added(class cl_address_space *as); virtual int tick(int cycles); virtual void reset(void) {} @@ -126,9 +136,10 @@ public: class cl_hws: public cl_list { public: - cl_hws(void): cl_list(2, 2) {} + cl_hws(void): cl_list(2, 2, "hws") {} virtual t_index add(void *item); - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + virtual void mem_cell_changed(class cl_address_space *mem, t_addr addr); + virtual void address_space_added(class cl_address_space *as); }; diff --git a/sim/ucsim/sim.src/itsrc.cc b/sim/ucsim/sim.src/itsrc.cc index aec8c97f..ad17146d 100644 --- a/sim/ucsim/sim.src/itsrc.cc +++ b/sim/ucsim/sim.src/itsrc.cc @@ -94,7 +94,7 @@ cl_it_src::deactivate(void) */ cl_irqs::cl_irqs(t_index alimit, t_index adelta): - cl_sorted_list(alimit, adelta) + cl_sorted_list(alimit, adelta, "irqs") { Duplicates= DD_TRUE; } diff --git a/sim/ucsim/sim.src/mem.cc b/sim/ucsim/sim.src/mem.cc index f47137aa..7d9a780f 100644 --- a/sim/ucsim/sim.src/mem.cc +++ b/sim/ucsim/sim.src/mem.cc @@ -7,22 +7,24 @@ * */ -/* This file is part of microcontroller simulator: ucsim. - -UCSIM is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -UCSIM is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with UCSIM; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +/* + This file is part of microcontroller simulator: ucsim. + + UCSIM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + UCSIM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with UCSIM; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ /*@1@*/ #include @@ -46,141 +48,31 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* - * Memory location handled specially by a hw element + * 3rd version of memory system */ -/*cl_memloc::cl_memloc(t_addr addr): +cl_memory::cl_memory(char *id, t_addr asize, int awidth): cl_base() { - address= addr; - hws= new cl_list(2, 2); - hws->init(); -}*/ - -/*cl_memloc::~cl_memloc(void) -{ - hws->disconn_all(); - delete hws; -}*/ - -/*ulong -cl_memloc::read(class cl_mem *mem) -{ - uchar ret= 0; - class cl_hw *hw; - - if (!hws || - hws->count == 0) - return(ret); - if ((hw= (class cl_hw *)(hws->at(0)))) - ret= hw->read(mem, address); - return(ret); -}*/ - -/*void -cl_memloc::write(class cl_mem *mem, t_addr addr, t_mem *val) -{ - class cl_hw *hw; - int i; - - if (!hws) - return; - for (i= 0; i < hws->count; i++) - { - hw= (class cl_hw *)hws->at(0); - hw->write(mem, addr, val); - } -}*/ - - -/* Sorted collection of memory locations */ - -/*cl_memloc_coll::cl_memloc_coll(void): - cl_sorted_list(2, 2) -{ - Duplicates= DD_FALSE; -}*/ - -/*void * -cl_memloc_coll::key_of(void *item) -{ - return(&(((class cl_memloc *)item)->address)); -}*/ - -/*int -cl_memloc_coll::compare(void *key1, void *key2) -{ - if (*(long*)key1 > *(long*)key2) - return(1); - else - if (*(long*)key1 < *(long*)key2) - return(-1); - else - return(0); -}*/ - -/*class cl_memloc * -cl_memloc_coll::get_loc(t_addr address) -{ - t_index i; - - if (search(&address, i)) - return((class cl_memloc*)(at(i))); - return(0); -}*/ - - -/* - * Memory - ****************************************************************************** - */ - -cl_mem::cl_mem(enum mem_class atype, char *aclass_name, - t_addr asize, int awidth, class cl_uc *auc): - cl_guiobj() -{ - int i; - - uc= auc; - type= atype; - class_name= aclass_name; - width= awidth; size= asize; - mem= 0; - for (i= width, mask= 0; i; i--) - mask= (mask<<1) | 1; - if (width == 0 || - size == 0) - mem= 0; - else if (width <= 8) - mem= (TYPE_UBYTE *)malloc(size); - else if (width <= 16) - mem= (TYPE_UWORD *)malloc(size*sizeof(TYPE_WORD)); - else - mem= (TYPE_UDWORD *)malloc(size*sizeof(TYPE_DWORD)); - //read_locs= new cl_memloc_coll(); - //write_locs= new cl_memloc_coll(); - dump_finished= 0; + set_name(id); addr_format= data_format= 0; + width= awidth; + start_address= 0; + uc= 0; } -cl_mem::~cl_mem(void) +cl_memory::~cl_memory(void) { - if (mem) - free(mem); if (addr_format) free(addr_format); if (data_format) free(data_format); - //delete read_locs; - //delete write_locs; } int -cl_mem::init(void) +cl_memory::init(void) { - t_addr i; - addr_format= (char *)malloc(10); sprintf(addr_format, "0x%%0%dx", size-1<=0xf?1: @@ -191,160 +83,101 @@ cl_mem::init(void) (size-1<=0xffffff?6:12)))))); data_format= (char *)malloc(10); sprintf(data_format, "%%0%dx", width/4+((width%4)?1:0)); - - for (i= 0; i < size; i++) - set(i, (type==MEM_ROM)?(-1):0); + data_mask= 1; + int w= width; + for (--w; w; w--) + { + data_mask<<= 1; + data_mask|= 1; + } + dump_finished= start_address; return(0); } -char * -cl_mem::id_string(void) -{ - char *s= get_id_string(mem_ids, type); - - return(s?s:(char*)"NONE"); -} -t_mem -cl_mem::read(t_addr addr) +bool +cl_memory::valid_address(t_addr addr) { - //class cl_memloc *loc; - - if (addr >= size) - { - //FIXME - fprintf(stderr, "Address 0x%06"_A_"x is over 0x%06"_A_"x\n", addr, size); - return(0); - } - /*if ((loc= read_locs->get_loc(addr))) - return(loc->read(this));*/ - if (width <= 8) - return((((TYPE_UBYTE*)mem)[addr])&mask); - else if (width <= 16) - return((((TYPE_UWORD*)mem)[addr])&mask); - else - return((((TYPE_UDWORD*)mem)[addr])&mask); + return(addr >= start_address && + addr < start_address+size); } -t_mem -cl_mem::get(t_addr addr) +t_addr +cl_memory::inc_address(t_addr addr, int val) { - if (addr >= size) - return(0); - if (width <= 8) - return((((TYPE_UBYTE*)mem)[addr])&mask); - else if (width <= 16) - return((((TYPE_UWORD*)mem)[addr])&mask); - else - return((((TYPE_UDWORD*)mem)[addr])&mask); + if (!start_address) + return(((signed)addr+val)%size); + addr-= start_address; + addr+= val; + addr%= size; + addr+= start_address; + return(addr); } - -/* - * Modify memory location - */ - -/* Write calls callbacks of HW elements */ - -t_mem -cl_mem::write(t_addr addr, t_mem val) +t_addr +cl_memory::inc_address(t_addr addr) { - /* class cl_memloc *loc; - - if (addr >= size) - return; - if ((loc= write_locs->get_loc(addr))) - loc->write(this, addr, val); - if (width <= 8) - ((TYPE_UBYTE*)mem)[addr]= (*val)&mask; - else if (width <= 16) - ((TYPE_UWORD*)mem)[addr]= (*val)&mask; - else - ((TYPE_UDWORD*)mem)[addr]= (*val)&mask;*/ - fprintf(stderr, "FIXME cl_mem::write(0x%06"_A_"x, 0x%04"_M_"x)\n", - addr, val); - return(0); + if (!start_address) + return(((signed)addr+1)%size); + addr-= start_address; + addr++; + addr%= size; + addr+= start_address; + return(addr); } -/* Set doesn't call callbacks */ - -void -cl_mem::set(t_addr addr, t_mem val) +t_addr +cl_memory::validate_address(t_addr addr) { - if (addr >= size) - return; - if (width <= 8) - ((TYPE_UBYTE*)mem)[addr]= val&mask; - else if (width <= 16) - ((TYPE_UWORD*)mem)[addr]= val&mask; - else - ((TYPE_UDWORD*)mem)[addr]= val&mask; + while (addr < start_address) + addr+= size; + if (addr > start_address+size) + { + addr-= start_address; + addr%= size; + addr+= start_address; + } + return(addr); } -/* Set or clear bits, without callbacks */ void -cl_mem::set_bit1(t_addr addr, t_mem bits) +cl_memory::err_inv_addr(t_addr addr) { - if (addr >= size) + if (!uc) return; - bits&= mask; - if (width <= 8) - ((TYPE_UBYTE*)mem)[addr]|= bits; - else if (width <= 16) - ((TYPE_UWORD*)mem)[addr]|= bits; - else - ((TYPE_UDWORD*)mem)[addr]|= bits; + class cl_error *e= new cl_error_mem_invalid_address(this, addr); + uc->error(e); } void -cl_mem::set_bit0(t_addr addr, t_mem bits) +cl_memory::err_non_decoded(t_addr addr) { - if (addr >= size) + if (!uc) return; - bits&= mask; - if (width <= 8) - ((TYPE_UBYTE*)mem)[addr]&= ~bits; - else if (width <= 16) - ((TYPE_UWORD*)mem)[addr]&= ~bits; - else - ((TYPE_UDWORD*)mem)[addr]&= ~bits; + class cl_error *e= new cl_error_mem_non_decoded(this, addr); + uc->error(e); } -t_mem -cl_mem::add(t_addr addr, long what) -{ - if (addr >= size) - return(0); - if (width <= 8) - { - ((TYPE_UBYTE*)mem)[addr]= ((TYPE_UBYTE*)mem)[addr] + what; - return(((TYPE_UBYTE*)mem)[addr]); - } - else if (width <= 16) - { - ((TYPE_UWORD*)mem)[addr]= ((TYPE_UWORD*)mem)[addr] + what; - return(((TYPE_UWORD*)mem)[addr]); - } - else - { - ((TYPE_UDWORD*)mem)[addr]= ((TYPE_UDWORD*)mem)[addr] + what; - return(((TYPE_UDWORD*)mem)[addr]); - } -} t_addr -cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) +cl_memory::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) { int i; + t_addr lva= lowest_valid_address(); + t_addr hva= highest_valid_address(); + if (start < lva) + start= lva; + if (stop > hva) + stop= hva; while ((start <= stop) && - (start < size)) + (start < hva)) { con->dd_printf(addr_format, start); con->dd_printf(" "); for (i= 0; (i < bpl) && - (start+i < size) && + (start+i < hva) && (start+i <= stop); i++) { @@ -362,11 +195,11 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) i++; } for (i= 0; (i < bpl) && - (start+i < size) && + (start+i < hva) && (start+i <= stop); i++) { - long c= get(start+i); + long c= read(start+i); con->dd_printf("%c", isprint(255&c)?(255&c):'.'); if (width > 8) con->dd_printf("%c", isprint(255&(c>>8))?(255&(c>>8)):'.'); @@ -383,13 +216,14 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) } t_addr -cl_mem::dump(class cl_console *con) +cl_memory::dump(class cl_console *con) { return(dump(dump_finished, dump_finished+10*8-1, 8, con)); } bool -cl_mem::search_next(bool case_sensitive, t_mem *array, int len, t_addr *addr) +cl_memory::search_next(bool case_sensitive, + t_mem *array, int len, t_addr *addr) { t_addr a; int i; @@ -434,1056 +268,1169 @@ cl_mem::search_next(bool case_sensitive, t_mem *array, int len, t_addr *addr) /* - * Bitmap + * Memory operators */ -/*cl_bitmap::cl_bitmap(t_addr asize): +cl_memory_operator::cl_memory_operator(class cl_memory_cell *acell, + t_addr addr): cl_base() { - map= (uchar*)malloc(size= asize/(8*SIZEOF_CHAR)); - memset(map, 0, size); + cell= acell; + data= 0; + mask= ~0; + next_operator= 0; + address= addr; } -cl_bitmap::~cl_bitmap(void) +cl_memory_operator::cl_memory_operator(class cl_memory_cell *acell, + t_addr addr, + t_mem *data_place, t_mem the_mask): + cl_base() { - free(map); + cell= acell; + data= data_place; + mask= the_mask; + next_operator= 0; + address= addr; } void -cl_bitmap::set(t_addr pos) +cl_memory_operator::set_data(t_mem *data_place, t_mem the_mask) { - int i; + data= data_place; + mask= the_mask; +} - if ((i= pos/(8*SIZEOF_CHAR)) < size) - map[i]|= (1 << (pos & ((8*SIZEOF_CHAR)-1))); + +t_mem +cl_memory_operator::read(void) +{ + if (next_operator) + return(next_operator->read()); + else + return(*data); } -void -cl_bitmap::clear(t_addr pos) +t_mem +cl_memory_operator::write(t_mem val) { - int i; + if (next_operator) + return(next_operator->write(val)); + else + return(*data= (val & mask)); +} + - if ((i= pos/(8*SIZEOF_CHAR)) < size) - map[i]&= ~(1 << (pos & ((8*SIZEOF_CHAR)-1))); +/* Memory operator for hw callbacks */ + +cl_hw_operator::cl_hw_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_hw *ahw): + cl_memory_operator(acell, addr, data_place, the_mask) +{ + hw= ahw; } -bool -cl_bitmap::get(t_addr pos) + +t_mem +cl_hw_operator::read(void) +{ + t_mem d= 0; + + if (hw) + d= hw->read(cell); + + if (next_operator) + next_operator->read(); + + return(d); +} + +t_mem +cl_hw_operator::read(enum hw_cath skip) { - return(map[pos/(8*SIZEOF_CHAR)] & (1 << (pos & ((8*SIZEOF_CHAR)-1)))); + t_mem d= *data; + + if (hw && + hw->cathegory != skip) + d= hw->read(cell); + + if (next_operator) + next_operator->read(); + + return(d); } -bool -cl_bitmap::empty(void) +t_mem +cl_hw_operator::write(t_mem val) { - int i; + if (hw) + hw->write(cell, &val); + if (next_operator) + val= next_operator->write(val); + return(*data= (val & mask)); +} - for (i= 0; i < size && map[i] == 0; i++) ; - return(i == size); -}*/ -/* - * Special memory for code (ROM) - */ +/* Write event break on cell */ + +cl_write_operator::cl_write_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_uc *auc, class cl_brk *the_bp): + cl_event_break_operator(acell, addr, data_place, the_mask, auc, the_bp) +{ + uc= auc; + bp= the_bp; +} -/*cl_rom::cl_rom(t_addr asize, int awidth, class cl_uc *auc): - cl_mem(MEM_ROM, get_id_string(mem_classes, MEM_ROM), asize, awidth, auc) +t_mem +cl_write_operator::write(t_mem val) { - bp_map= new cl_bitmap(asize); - inst_map= new cl_bitmap(asize); + //printf("write event at 0x%x bp=%p\n",address,bp); + uc->events->add(bp); + if (next_operator) + return(next_operator->write(val)); + else + return(*data= (val & mask)); } -cl_rom::~cl_rom(void) + +/* Read event break on cell */ + +cl_read_operator::cl_read_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_uc *auc, class cl_brk *the_bp): + cl_event_break_operator(acell, addr, data_place, the_mask, auc, the_bp) { - delete bp_map; - delete inst_map; -}*/ + uc= auc; + bp= the_bp; +} + +t_mem +cl_read_operator::read(void) +{ + //printf("read event at 0x%x bp=%p\n",address,bp); + uc->events->add(bp); + if (next_operator) + return(next_operator->read()); + else + return(*data); +} /* - * New type of memory simulation + * Memory cell */ -cl_cell::cl_cell(void): +cl_memory_cell::cl_memory_cell(void): cl_base() { + data= (t_mem *)malloc(sizeof(t_mem)); + flags= CELL_NON_DECODED; + width= 8; + *data= 0; + #ifdef STATISTIC nuof_writes= nuof_reads= 0; #endif -} - -cl_normal_cell::cl_normal_cell(uchar awidth): - cl_cell() -{ - type= CELL_NORMAL; - data= 0; mask= 1; - width= awidth; - for (--awidth; awidth; awidth--) + int w= width; + for (--w; w; w--) { mask<<= 1; mask|= 1; } } -t_mem -cl_normal_cell::add(long what) +cl_memory_cell::~cl_memory_cell(void) { - t_mem d; - - if (width <= 8) - d= TYPE_BYTE(data) + what; - else if (width <= 16) - d= TYPE_WORD(data) + what; - else - d= TYPE_DWORD(data) + what; - return(data= d & mask); + if ((flags & CELL_NON_DECODED) && + data) + free(data); } -t_mem -cl_normal_cell::wadd(long what) +int +cl_memory_cell::init(void) { - t_mem d; - - if (width <= 8) - d= TYPE_BYTE(data) + what; - else if (width <= 16) - d= TYPE_WORD(data) + what; - else - d= TYPE_DWORD(data) + what; - return(write(d)); + cl_base::init(); + set(0/*rand()*/); + return(0); } -void -cl_normal_cell::set_bit1(t_mem bits) + +TYPE_UBYTE +cl_memory_cell::get_flags(void) { - bits&= mask; - data|= bits; + return(flags); +} + +bool +cl_memory_cell::get_flag(enum cell_flag flag) +{ + return(flags & flag); } void -cl_normal_cell::set_bit0(t_mem bits) +cl_memory_cell::set_flags(TYPE_UBYTE what) { - bits&= mask; - data&= ~bits; + flags= what; } +void +cl_memory_cell::set_flag(enum cell_flag flag, bool val) +{ + if (val) + flags|= flag; + else + flags&= ~(flag); +} -/* - */ -cl_registered_cell::cl_registered_cell(uchar awidth): - cl_normal_cell(awidth) +void +cl_memory_cell::un_decode(void) { - type= CELL_HW_READ | CELL_HW_WRITE; - //hws= new cl_list(1, 1); - hardwares= 0; - nuof_hws= 0; + if ((flags & CELL_NON_DECODED) == 0) + { + data= (t_mem *)malloc(sizeof(t_mem)); + flags|= CELL_NON_DECODED; + } } -cl_registered_cell::~cl_registered_cell(void) +void +cl_memory_cell::decode(class cl_memory_chip *chip, t_addr addr) { - if (hardwares) - free(hardwares); + if (flags & CELL_NON_DECODED) + free(data); + data= chip->get_slot(addr); + if (!data) + { + data= (t_mem *)malloc(sizeof(t_mem)); + flags|= CELL_NON_DECODED; + } + else + flags&= ~(CELL_NON_DECODED); } -/*void -cl_registered_cell::destroy(void) -{ - hardwares= 0; - nuof_hws= 0; -}*/ t_mem -cl_registered_cell::read(void) +cl_memory_cell::read(void) { - int i; - t_mem d= data; - - if (nuof_hws) - for (i= 0; i < nuof_hws; i++) - { - d= hardwares[i]->read(this); - ; - } #ifdef STATISTIC nuof_reads++; #endif - return(d & mask); + if (operators) + return(operators->read()); + return(*data); } t_mem -cl_registered_cell::read(enum hw_cath skip) +cl_memory_cell::read(enum hw_cath skip) { - int i; - t_mem d= data; - - if (nuof_hws) - for (i= 0; i < nuof_hws; i++) - { - if ((skip & hardwares[i]->cathegory) == 0) - d= hardwares[i]->read(this); - ; - } #ifdef STATISTIC nuof_reads++; #endif - return(d & mask); + if (operators) + return(operators->read(skip)); + return(*data); } - + t_mem -cl_registered_cell::write(t_mem val) +cl_memory_cell::get(void) { - int i; + return(*data); +} - val&= mask; - if (nuof_hws) - for (i= 0; i < nuof_hws; i++) - { - hardwares[i]->write(this, &val); - ; - } +t_mem +cl_memory_cell::write(t_mem val) +{ #ifdef STATISTIC nuof_writes++; #endif - return(data= val & mask); -} - -class cl_cell * -cl_registered_cell::add_hw(class cl_hw *hw, int *ith) -{ - if (!hw) - { - /* Whatta hell!? */ - return(0); - } - if (!hardwares) - hardwares= (class cl_hw **)malloc(sizeof(class cl_hw *)); - else - hardwares= (class cl_hw **)realloc(hardwares, - sizeof(class c_hw *) * (nuof_hws+1)); - hardwares[nuof_hws]= hw; - nuof_hws++; - if (ith) - *ith= nuof_hws-1; - return(this); + if (operators) + return(operators->write(val)); + *data= val & mask; + return(*data); } -class cl_hw * -cl_registered_cell::get_hw(int ith) +t_mem +cl_memory_cell::set(t_mem val) { - if (ith >= nuof_hws) - return(0); - return(hardwares[ith]); + *data= val & mask; + return(*data); } -/* - */ -cl_event_handler::cl_event_handler(class cl_uc *auc): - cl_base() +t_mem +cl_memory_cell::add(long what) { - uc= auc; - read_bps= new cl_list(1, 1); - write_bps= new cl_list(1, 1); + *data= (*data + what) & mask; + return(*data); } -cl_event_handler::~cl_event_handler(void) +t_mem +cl_memory_cell::wadd(long what) { - read_bps->disconn_all(); - write_bps->disconn_all(); - delete read_bps; - delete write_bps; + t_mem d= (*data + what) & mask; + return(write(d)); } void -cl_event_handler::write(void) +cl_memory_cell::set_bit1(t_mem bits) { - int i; - - for (i= 0; i < write_bps->count; i++) - { - class cl_brk *bp= (class cl_brk *)(write_bps->at(i)); - uc->events->add(bp); - } + bits&= mask; + (*data)|= bits; } void -cl_event_handler::read(void) +cl_memory_cell::set_bit0(t_mem bits) { - int i; + bits&= mask; + (*data)&= ~bits; +} + - for (i= 0; i < read_bps->count; i++) +void +cl_memory_cell::append_operator(class cl_memory_operator *op) +{ + if (!operators) + operators= op; + else { - class cl_brk *bp= (class cl_brk *)(read_bps->at(i)); - uc->events->add(bp); + class cl_memory_operator *o= operators, *n; + n= o->get_next(); + while (n) + { + o= n; + n= o->get_next(); + } + o->set_next(op); } } -int -cl_event_handler::add_bp(class cl_brk *bp) +void +cl_memory_cell::prepend_operator(class cl_memory_operator *op) { - int t= CELL_NORMAL; - - if (!bp) - return(CELL_NORMAL); - switch (bp->get_event()) + if (op) { - case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: - t|= CELL_WRITE_BRK; - write_bps->add(bp); - break; - case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR: - t|= CELL_READ_BRK; - read_bps->add(bp); - break; - default: - t|= CELL_READ_BRK | CELL_WRITE_BRK; - read_bps->add(bp); - write_bps->add(bp); - break; + op->set_next(operators); + operators= op; } - return(t); } -int -cl_event_handler::copy_from(class cl_event_handler *eh) +void +cl_memory_cell::del_operator(class cl_brk *brk) { - int i, t= CELL_NORMAL; - - if (!eh) - return(t); - for (i= 0; i < eh->read_bps->count; i++) + if (!operators) + return; + class cl_memory_operator *op= operators; + if (operators->match(brk)) { - class cl_brk *bp= (class cl_brk *)(eh->read_bps->at(i)); - t|= add_bp(bp); + operators= op->get_next(); + delete op; } - for (i= 0; i < eh->write_bps->count; i++) + else { - class cl_brk *bp= (class cl_brk *)(eh->write_bps->at(i)); - t|= add_bp(bp); + while (op->get_next() && + !op->get_next()->match(brk)) + op= op->get_next(); + if (op->get_next()) + { + class cl_memory_operator *m= op->get_next(); + op->set_next(m->get_next());; + delete m; + } } - return(t); } -int -cl_event_handler::del_bp(class cl_brk *bp) -{ - int t= CELL_NORMAL; - write_bps->disconn(bp); - read_bps->disconn(bp); - if (write_bps->count) - t|= CELL_WRITE_BRK; - if (read_bps->count) - t|= CELL_READ_BRK; - return(t); +class cl_memory_cell * +cl_memory_cell::add_hw(class cl_hw *hw, int *ith, t_addr addr) +{ + class cl_hw_operator *o= new cl_hw_operator(this, addr, data, mask, hw); + append_operator(o); + return(this); } +/*class cl_hw * +cl_memory_cell::get_hw(int ith) +{ + return(0); +}*/ -/* - */ - -cl_event_cell::cl_event_cell(uchar awidth, class cl_uc *auc): - cl_normal_cell(awidth) -{ - eh= new cl_event_handler(auc); -} - -cl_event_cell::~cl_event_cell(void) -{ - delete eh; -} - -t_mem -cl_event_cell::read(void) -{ - if (type & CELL_READ_BRK) - eh->read(); - return(cl_normal_cell::read()); -} - -t_mem -cl_event_cell::write(t_mem val) +class cl_event_handler * +cl_memory_cell::get_event_handler(void) { - if (type & CELL_WRITE_BRK) - eh->write(); - return(cl_normal_cell::write(val)); + return(0); } /* + * Dummy cell for non-existent addresses */ -cl_ev_reg_cell::cl_ev_reg_cell(uchar awidth, class cl_uc *auc): - cl_registered_cell(awidth) -{ - eh= new cl_event_handler(auc); -} - -cl_ev_reg_cell::~cl_ev_reg_cell(void) -{} - t_mem -cl_ev_reg_cell::read(void) +cl_dummy_cell::write(t_mem val) { - if (type & CELL_READ_BRK) - eh->read(); - return(cl_registered_cell::read()); +#ifdef STATISTIC + nuof_writes++; +#endif + *data= rand() & mask; + return(*data); } t_mem -cl_ev_reg_cell::write(t_mem val) +cl_dummy_cell::set(t_mem val) { - if (type & CELL_WRITE_BRK) - eh->write(); - return(cl_registered_cell::write(val)); + *data= rand() & mask; + return(*data); } /* + * Address space */ -cl_mapped_cell::cl_mapped_cell(class cl_cell *realcell) +cl_address_space::cl_address_space(char *id, + t_addr astart, t_addr asize, int awidth): + cl_memory(id, asize, awidth) { - real_cell= realcell; + start_address= astart; + decoders= new cl_decoder_list(2, 2, DD_FALSE); + cells= (class cl_memory_cell **)malloc(size * sizeof(class cl_memory_cell*)); + int i; + for (i= 0; i < size; i++) + { + cells[i]= new cl_memory_cell(); + cells[i]->init(); + } + dummy= new cl_dummy_cell(); } -cl_mapped_cell::~cl_mapped_cell(void) -{} - -t_mem -cl_mapped_cell::read(void) +cl_address_space::~cl_address_space(void) { - return(real_cell->read()); + delete decoders; + int i; + for (i= 0; i < size; i++) + if (cells[i]) + delete cells[i]; + delete dummy; } + t_mem -cl_mapped_cell::read(enum hw_cath skip) +cl_address_space::read(t_addr addr) { - return(real_cell->read(skip)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + return(dummy->read()); + } + return(cells[idx]->read()); } t_mem -cl_mapped_cell::get(void) +cl_address_space::read(t_addr addr, enum hw_cath skip) { - return(real_cell->get()); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + return(dummy->read()); + } + return(cells[idx]->read(skip)); } t_mem -cl_mapped_cell::write(t_mem val) +cl_address_space::get(t_addr addr) { - return(real_cell->write(val)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + return(dummy->get()); + } + return(cells[idx]->get()); } t_mem -cl_mapped_cell::set(t_mem val) +cl_address_space::write(t_addr addr, t_mem val) { - return(real_cell->set(val)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + return(dummy->write(val)); + } + return(cells[idx]->write(val)); } -t_mem -cl_mapped_cell::add(long what) +void +cl_address_space::set(t_addr addr, t_mem val) { - return(real_cell->add(what)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + dummy->set(val); + return; + } + cells[idx]->set(val); } t_mem -cl_mapped_cell::wadd(long what) +cl_address_space::wadd(t_addr addr, long what) { - return(real_cell->wadd(what)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + { + err_inv_addr(addr); + } + return(cells[idx]->wadd(what)); } -void -cl_mapped_cell::set_bit1(t_mem bits) -{ - return(real_cell->set_bit1(bits)); -} +/* Set or clear bits, without callbacks */ void -cl_mapped_cell::set_bit0(t_mem bits) -{ - return(real_cell->set_bit0(bits)); -} - -class cl_cell * -cl_mapped_cell::add_hw(class cl_hw *hw, int *ith) -{ - return(real_cell->add_hw(hw, ith)); -} - -class cl_hw * -cl_mapped_cell::get_hw(int ith) +cl_address_space::set_bit1(t_addr addr, t_mem bits) { - return(real_cell->get_hw(ith)); -} - -class cl_event_handler * -cl_mapped_cell::get_event_handler(void) -{ - return(real_cell->get_event_handler()); -} - - -/* - */ - -cl_m::cl_m(enum mem_class atype, char *aclass_name, t_addr asize, int awidth, - class cl_uc *auc): - cl_mem(atype, aclass_name, 0, awidth, auc) -{ - t_addr a; - - size= asize; - width= awidth; - array= (class cl_cell **)calloc(size, sizeof(class cl_cell *)); - for (a= 0; a < size; a++) - array[a]= new cl_normal_cell(width); - bus_mask= 0; - t_addr i; - for (i= 1; i < size; i<<=1) - bus_mask= (bus_mask<<1)|1; - dummy= new cl_normal_cell(width); - //mk_cell(size, 0); -} - -cl_m::~cl_m(void) -{ - t_addr a; - - for (a= 0; a < size; a++) - delete array[a]; - free(array); - delete dummy; + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return; + class cl_memory_cell *cell= cells[idx]; + cell->set_bit1(bits); } void -cl_m::err_inv_addr(t_addr addr) +cl_address_space::set_bit0(t_addr addr, t_mem bits) { - if (!uc) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) return; - class cl_error *e= new cl_err_inv_addr(this, addr); - uc->error(e); + class cl_memory_cell *cell= cells[idx]; + cell->set_bit0(bits); } -/*void -cl_m::mk_cell(t_addr addr, class cl_cell *cell) + +class cl_memory_cell * +cl_address_space::get_cell(t_addr addr) { - if (!cell) - cell= new cl_cell(width); - class cl_cell *p; - if (addr >= size) - p= dummy; - else - p= array[addr]; - if (p == 0) - { - p= (class cl_cell *)calloc(1, sizeof(*cell)); - } - else + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) { - p->destroy(); - p= (class cl_cell *)realloc(p, sizeof(cell)); + err_inv_addr(addr); + return(dummy); } - memcpy(p, cell, sizeof(*cell)); - cell->destroy(); - delete cell; -}*/ + return(cells[idx]); +} + int -cl_m::get_cell_flag(t_addr addr) +cl_address_space::get_cell_flag(t_addr addr) { - if (addr >= size) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) { - return(dummy->get_type()); + return(dummy->get_flags()); } - return(array[addr]->get_type()); + return(cells[addr]->get_flags()); } bool -cl_m::get_cell_flag(t_addr addr, int flag) +cl_address_space::get_cell_flag(t_addr addr, enum cell_flag flag) { - if (addr >= size) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) { - return(dummy->get_type() & flag); + return(dummy->get_flag(flag)); } - return(array[addr]->get_type() & flag); + return(cells[addr]->get_flag(flag)); } void -cl_m::set_cell_flag(t_addr addr, bool set_to, int flag) +cl_address_space::set_cell_flag(t_addr addr, bool set_to, enum cell_flag flag) { - class cl_cell *cell; + t_addr idx= addr-start_address; + class cl_memory_cell *cell; - if (addr >= size) + if (idx >= size || + addr < start_address) { cell= dummy; } else - cell= array[addr]; - if (set_to) - cell->set_type(cell->get_type() | flag); - else - cell->set_type(cell->get_type() & ~flag); + cell= cells[addr]; + cell->set_flag(flag, set_to); } -t_mem -cl_m::read(t_addr addr) + +bool +cl_address_space::decode_cell(t_addr addr, + class cl_memory_chip *chip, t_addr chipaddr) { - //addr&= bus_mask; - if (addr >= size) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return(DD_FALSE); + class cl_memory_cell *cell= cells[idx]; + + if (!cell->get_flag(CELL_NON_DECODED)) { - err_inv_addr(addr); - return(dummy->read()); + // un-decode first! + cell->un_decode(); } - return(array[addr]->read()); + cell->decode(chip, chipaddr); + + return(!cell->get_flag(CELL_NON_DECODED)); } -t_mem -cl_m::read(t_addr addr, enum hw_cath skip) +void +cl_address_space::undecode_cell(t_addr addr) { - //addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - return(dummy->read(skip)); - } - return(array[addr]->read(skip)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return; + class cl_memory_cell *cell= cells[idx]; + + cell->un_decode(); } -t_mem -cl_m::get(t_addr addr) +void +cl_address_space::undecode_area(class cl_address_decoder *skip, + t_addr begin, t_addr end,class cl_console *con) { - addr&= bus_mask; - if (addr >= size) +#define D if (con) con->debug + D("Undecoding area 0x%x-0x%x of %s\n", begin, end, get_name()); + int i; + for (i= 0; i < decoders->count; i++) { - err_inv_addr(addr); - return(dummy->get()); + class cl_address_decoder *d= + dynamic_cast(decoders->object_at(i)); + if (!d || + d == skip) + continue; + D(" Checking decoder 0x%x-0x%x -> %s[0x%x]\n", + d->as_begin, d->as_end, d->memchip->get_name(), d->chip_begin); + if (d->fully_covered_by(begin, end)) + { + // decoder can be removed + D(" Can be removed\n"); + decoders->disconn(d); + i--; + delete d; + if (decoders->count == 0) + break; + } + else if (d->covers(begin, end)) + { + // decoder must be split + D(" Must be split\n"); + class cl_address_decoder *nd= d->split(begin, end); + D(" After split:\n"); + D(" 0x%x-0x%x -> %s[0x%x]\n", + d->as_begin, d->as_end, d->memchip->get_name(), d->chip_begin); + if (nd) + { + decoders->add(nd); + D(" 0x%x-0x%x -> %s[0x%x]\n", + nd->as_begin, nd->as_end, nd->memchip->get_name(), nd->chip_begin); + nd->activate(con); + } + } + else if (d->is_in(begin, end)) + { + // decoder sould shrink + D(" Sould shrink\n"); + if (d->shrink_out_of(begin, end)) + { + D(" Can be removed after shrink\n"); + decoders->disconn(d); + i--; + delete d; + if (decoders->count == 0) + break; + } + else + { + D(" Shrinked to 0x%x-0x%x -> %s[0x%x]\n", + d->as_begin, d->as_end, d->memchip->get_name(), d->chip_begin); + } + } } - return(array[addr]->get()); +#undef D } -t_mem -cl_m::write(t_addr addr, t_mem val) + +class cl_memory_cell * +cl_address_space::register_hw(t_addr addr, class cl_hw *hw, + int *ith, + bool announce) { - //addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - return(dummy->write(val)); - } - return(array[addr]->write(val)); + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return(0); + class cl_memory_cell *cell= cells[idx]; + cell->add_hw(hw, ith, addr); + //printf("adding hw %s to cell 0x%x(%d) of %s\n", hw->id_string, addr, idx, get_name("as")); + if (announce) + ;//uc->sim->/*app->*/mem_cell_changed(this, addr);//FIXME + return(cell); } + void -cl_m::set(t_addr addr, t_mem val) +cl_address_space::set_brk(t_addr addr, class cl_brk *brk) { - if (addr >= size) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return; + class cl_memory_cell *cell= cells[idx]; + class cl_memory_operator *op; + + switch (brk->get_event()) { - err_inv_addr(addr); - //addr&= bus_mask; - dummy->set(val); + case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: + //e= 'W'; + op= new cl_write_operator(cell, addr, cell->get_data(), cell->get_mask(), + uc, brk); + break; + case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR: + //e= 'R'; + op= new cl_read_operator(cell, addr, cell->get_data(), cell->get_mask(), + uc, brk); + break; + case brkNONE: + set_cell_flag(addr, DD_TRUE, CELL_FETCH_BRK); return; + break; + default: + //e= '.'; + op= 0; + break; } - //addr&= bus_mask; - array[addr]->set(val); + if (op) + cell->append_operator(op); } -class cl_cell * -cl_m::get_cell(t_addr addr) +void +cl_address_space::del_brk(t_addr addr, class cl_brk *brk) { - //addr&= bus_mask; - if (addr >= size) + t_addr idx= addr-start_address; + if (idx >= size || + addr < start_address) + return; + class cl_memory_cell *cell= cells[idx]; + + switch (brk->get_event()) { - err_inv_addr(addr); - return(dummy); + case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: + case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR: + cell->del_operator(brk); + break; + case brkNONE: + set_cell_flag(addr, DD_FALSE, CELL_FETCH_BRK); + return; + break; + default: + break; } - return(array[addr]); } -/* Set or clear bits, without callbacks */ +/* + * List of address spaces + */ -void -cl_m::set_bit1(t_addr addr, t_mem bits) +cl_address_space_list::cl_address_space_list(class cl_uc *the_uc): + cl_list(2, 2, "address spaces") { - class cl_cell *cell; - - addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - cell= dummy; - } - else - cell= array[addr]; - bits&= cell->get_mask(); - cell->set(cell->get() | bits); + uc= the_uc; } -void -cl_m::write_bit1(t_addr addr, t_mem bits) +t_index +cl_address_space_list::add(class cl_address_space *mem) { - class cl_cell *cell; - - addr&= bus_mask; - if (addr >= size) + mem->set_uc(uc); + t_index ret= cl_list::add(mem); + if (uc) { - err_inv_addr(addr); - cell= dummy; + class cl_event_address_space_added e(mem); + uc->handle_event(e); } - else - cell= array[addr]; - bits&= cell->get_mask(); - cell->write(cell->get() | bits); + return(ret); } -void -cl_m::set_bit0(t_addr addr, t_mem bits) + +/* + * Memory chip + */ + +cl_memory_chip::cl_memory_chip(char *id, int asize, int awidth, int initial): + cl_memory(id, asize, awidth) { - class cl_cell *cell; + array= (t_mem *)malloc(size * sizeof(t_mem)); + init_value= initial; +} - addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - cell= dummy; - } - else - cell= array[addr]; - bits&= cell->get_mask(); - cell->set(cell->get() & ~bits); +cl_memory_chip::~cl_memory_chip(void) +{ + if (array) + free(array); } -void -cl_m::write_bit0(t_addr addr, t_mem bits) +int +cl_memory_chip::init(void) { - class cl_cell *cell; + cl_memory::init(); + int i; + for (i= 0; i < size; i++) + set(i, + (init_value<0)?rand():(init_value)); + return(0); +} - addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - cell =dummy; - } - else - cell= array[addr]; - bits&= cell->get_mask(); - cell->write(cell->get() & ~bits); + +t_mem * +cl_memory_chip::get_slot(t_addr addr) +{ + if (!array || + size <= addr) + return(0); + return(&array[addr]); } + t_mem -cl_m::add(t_addr addr, long what) +cl_memory_chip::get(t_addr addr) { - addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - return(dummy->add(what)); - } - return(array[addr]->add(what)); + if (!array || + size <= addr) + return(0); + return(array[addr]); } -t_mem -cl_m::wadd(t_addr addr, long what) +void +cl_memory_chip::set(t_addr addr, t_mem val) { - addr&= bus_mask; - if (addr >= size) - { - err_inv_addr(addr); - return(dummy->wadd(what)); - } - return(array[addr]->wadd(what)); + if (!array || + size <= addr) + return; + array[addr]= val & data_mask; } -class cl_cell * -cl_m::register_hw(t_addr addr, class cl_hw *hw, int *ith, bool announce) +void +cl_memory_chip::set_bit1(t_addr addr, t_mem bits) { - class cl_cell *cell, *nc; + if (!array || + size <= addr) + return; + array[addr]|= (bits & data_mask); +} - addr&= bus_mask; - if (addr >= size) - cell= dummy; - else - cell= array[addr]; +void +cl_memory_chip::set_bit0(t_addr addr, t_mem bits) +{ + if (!array || + size <= addr) + return; + array[addr]&= ((~bits) & data_mask); +} - if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE)) - { - /* Already registered */ - return(cell->add_hw(hw, ith)); - } - else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK)) - { - /* Event break is set on it, now register hw */ - nc= new cl_ev_reg_cell(width, uc); - nc->set(cell->get()); - nc->set_type(nc->get_type() & - ~(CELL_GENERAL|CELL_READ_BRK|CELL_WRITE_BRK)); - nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL)); - class cl_event_handler *eh= nc->get_event_handler(); - if (eh) - nc->set_type(nc->get_type() | eh->copy_from(cell->get_event_handler())); - nc->add_hw(hw, ith); - } - else - { - /* Normal cell, register hw */ - nc= new cl_registered_cell(width); - nc->set(cell->get()); - nc->set_type(nc->get_type() & ~CELL_GENERAL); - nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL)); - nc->add_hw(hw, ith); - } - if (addr >= size) - { - delete dummy; - dummy= nc; - } +/* + * Address decoder + */ + +cl_address_decoder::cl_address_decoder(class cl_memory *as, + class cl_memory *chip, + t_addr asb, t_addr ase, t_addr cb) +{ + if (as->is_address_space()) + address_space= (class cl_address_space *)as; else - { - delete array[addr]; - array[addr]= nc; - } - if (announce) - uc->sim->/*app->*/mem_cell_changed(this, addr); - return(nc); + address_space= 0; + if (chip->is_chip()) + memchip= (class cl_memory_chip *)chip; + else + memchip= 0; + as_begin= asb; + as_end= ase; + chip_begin= cb; + activated= DD_FALSE; } -void -cl_m::set_brk(t_addr addr, class cl_brk *brk) +cl_address_decoder::~cl_address_decoder(void) { - class cl_cell *cell, *nc; - char e= '_'; + t_addr a; + if (address_space) + for (a= as_begin; a <= as_end; a++) + address_space->undecode_cell(a); +} - addr&= bus_mask; - if (addr >= size) - cell= dummy; - else - cell= array[addr]; +int +cl_address_decoder::init(void) +{ + return(0); +} - switch (brk->get_event()) + +bool +cl_address_decoder::activate(class cl_console *con) +{ +#define D if (con) con->debug + D("Activation of an address decoder\n"); + if (activated) { - case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: - e= 'W'; - break; - case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR: - e= 'R'; - break; - case brkNONE: - set_cell_flag(addr, DD_TRUE, CELL_FETCH_BRK); - return; - break; - default: e= '.'; break; + D("Already activated\n"); + return(DD_FALSE); } - - if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE)) + if (!address_space || + !address_space->is_address_space()) { - /* Hw is registered on it, now set event break */ - nc= new cl_ev_reg_cell(width, uc); - nc->set(cell->get()); - nc->set_type(nc->get_type() & ~CELL_GENERAL); - nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL)); - int i= 0; - class cl_hw *hw; - while ((hw= cell->get_hw(i)) != 0) - { - nc->add_hw(hw, 0); - i++; - } - if (((class cl_registered_cell *)cell)->hardwares) - { - free(((class cl_registered_cell *)cell)->hardwares); - ((class cl_registered_cell *)cell)->hardwares= 0; - } - class cl_event_handler *eh; - if ((eh= nc->get_event_handler())) - nc->set_type(nc->get_type() | eh->add_bp(brk)); + D("No or non address space\n"); + return(DD_FALSE); } - else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK)) + if (!memchip || + !memchip->is_chip()) { - /* Break is already set on it */ - class cl_event_handler *eh; - if ((eh= cell->get_event_handler())) - cell->set_type(cell->get_type() | eh->add_bp(brk)); - return; + D("No or non memory chip\n"); + return(DD_FALSE); } - else + if (as_begin > as_end) { - /* Normal cell, set event break */ - nc= new cl_event_cell(width, uc); - nc->set(cell->get()); - nc->set_type(nc->get_type() & ~CELL_GENERAL); - nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL)); - class cl_event_handler *eh; - if ((eh= nc->get_event_handler())) - nc->set_type(nc->get_type() | eh->add_bp(brk)); + D("Wrong address area specification\n"); + return(DD_FALSE); } - - if (addr >= size) + if (chip_begin >= memchip->get_size()) { - delete dummy; - dummy= nc; + D("Wrong chip area specification\n"); + return(DD_FALSE); } - else + if (as_begin < address_space->start_address || + as_end >= address_space->start_address + address_space->get_size()) { - delete array[addr]; - array[addr]= nc; + D("Specified area is out of address space\n"); + return(DD_FALSE); } - uc->sim->/*app->*/mem_cell_changed(this, addr); -} - -void -cl_m::del_brk(t_addr addr, class cl_brk *brk) -{ - class cl_cell *cell, *nc; - char e= '_'; - - addr&= bus_mask; - if (addr >= size) - cell= dummy; - else - cell= array[addr]; - - switch (brk->get_event()) + if (as_end-as_begin > memchip->get_size()-chip_begin) { - case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: e= 'W'; break; - case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR: - e= 'R'; - break; - case brkNONE: - set_cell_flag(addr, DD_FALSE, CELL_FETCH_BRK); - return; - break; - default: e= '.'; break; + D("Specified area is out of chip size\n"); + return(DD_FALSE); } - - if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE)) + + address_space->undecode_area(this, as_begin, as_end, con); + + t_addr asa, ca; + for (asa= as_begin, ca= chip_begin; + asa <= as_end; + asa++, ca++) { - /* Hw is registered on it, delete event break */ - class cl_event_handler *eh; - int t= CELL_NORMAL; - if ((eh= cell->get_event_handler())) - t= eh->del_bp(brk); - if (t & (CELL_READ_BRK|CELL_WRITE_BRK)) + if (!address_space->decode_cell(asa, memchip, ca)) { - cell->set_type(cell->get_type() & ~(CELL_READ_BRK|CELL_WRITE_BRK)); - cell->set_type(cell->get_type() | t); - return; + D("Decoding 0x%06x->0x%06x failed\n", asa, ca); } - nc= new cl_registered_cell(width); - nc->set(cell->get()); - nc->set_type(cell->get_type() & ~CELL_GENERAL); - nc->set_type(cell->get_type() | (cell->get_type() & CELL_GENERAL)); - int i= 0; - class cl_hw *hw; - while ((hw= cell->get_hw(i)) != 0) - { - nc->add_hw(hw, 0); - i++; - } - if (((class cl_registered_cell *)cell)->hardwares) - free(((class cl_registered_cell *)cell)->hardwares); } - else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK)) + activated= DD_TRUE; + +#undef D + return(activated); +} + + +bool +cl_address_decoder::fully_covered_by(t_addr begin, t_addr end) +{ + if (begin <= as_begin && + end >= as_end) + return(DD_TRUE); + return(DD_FALSE); +} + +bool +cl_address_decoder::is_in(t_addr begin, t_addr end) +{ + if (begin >= as_begin && + begin <= as_end) + return(DD_TRUE); + if (end >= as_begin && + end <= as_end) + return(DD_TRUE); + return(DD_FALSE); +} + +bool +cl_address_decoder::covers(t_addr begin, t_addr end) +{ + if (begin > as_begin && + end < as_end) + return(DD_TRUE); + return(DD_FALSE); +} + + +/* Returns TRUE if shrunken decoder is unnecessary */ + +bool +cl_address_decoder::shrink_out_of(t_addr begin, t_addr end) +{ + t_addr a= as_begin; + + if (!address_space) + return(DD_TRUE); + if (begin > a) + a= begin; + while (a <= end && + a <= as_end) { - /* Break already set on it, delete brk */ - class cl_event_handler *eh; - int t= CELL_NORMAL; - if ((eh= cell->get_event_handler())) - t= eh->del_bp(brk); - if (t & (CELL_READ_BRK|CELL_WRITE_BRK)) - { - cell->set_type(cell->get_type() & ~(CELL_READ_BRK|CELL_WRITE_BRK)); - cell->set_type(cell->get_type() | t); - return; - } - nc= new cl_normal_cell(width); - nc->set(cell->get()); - nc->set_type(cell->get_type() & ~CELL_GENERAL); - nc->set_type(cell->get_type() | (cell->get_type() & CELL_GENERAL)); - return; + address_space->undecode_cell(a); + a++; } - else + if (begin > as_begin) + as_end= begin-1; + if (as_end > end) { - /* Normal cell */ - return; + chip_begin+= (end-as_begin+1); + as_begin= end+1; } + if (as_end < as_begin) + return(DD_TRUE); + return(DD_FALSE); +} - if (addr >= size) +class cl_address_decoder * +cl_address_decoder::split(t_addr begin, t_addr end) +{ + class cl_address_decoder *nd= 0; + if (begin > as_begin) { - delete dummy; - dummy= nc; + if (as_end > end) + nd= new cl_address_decoder(address_space, memchip, + end+1, as_end, chip_begin+(end-as_begin)+1); + shrink_out_of(begin, as_end); } - else + else if (end < as_end) { - delete array[addr]; - array[addr]= nc; + if (as_begin < begin) + nd= new cl_address_decoder(address_space, memchip, + as_begin, begin-1, chip_begin); + shrink_out_of(end+1, as_end); } - uc->sim->/*app->*/mem_cell_changed(this, addr); + if (nd) + nd->init(); + return(nd); } -#ifdef STATISTIC -unsigned long -cl_m::get_nuof_reads(void) -{ - unsigned long res= 0; - t_addr i; - for (i= 0; i < size; i++) - res+= array[i]->nuof_reads; - return(res); -} +/* + * List of address decoders + */ -unsigned long -cl_m::get_nuof_writes(void) +cl_decoder_list::cl_decoder_list(t_index alimit, t_index adelta, bool bychip): + cl_sorted_list(alimit, adelta, "decoder list") { - unsigned long res= 0; - t_addr i; - for (i= 0; i < size; i++) - res+= array[i]->nuof_writes; - return(res); + Duplicates= DD_TRUE; + by_chip= bychip; } -void -cl_m::set_nuof_reads(unsigned long value) +void * +cl_decoder_list::key_of(void *item) { - t_addr i; - for (i= 0; i < size; i++) - array[i]->nuof_reads= value; - dummy->nuof_reads= value; + class cl_address_decoder *d= (class cl_address_decoder *)item; + if (by_chip) + return(&(d->chip_begin)); + else + return(&(d->as_begin)); } -void -cl_m::set_nuof_writes(unsigned long value) +int +cl_decoder_list::compare(void *key1, void *key2) { - t_addr i; - for (i= 0; i < size; i++) - array[i]->nuof_writes= value; - dummy->nuof_writes= value; + t_addr k1= *((t_addr*)key1), k2= *((t_addr*)key2); + if (k1 == k2) + return(0); + else if (k1 > k2) + return(1); + return(-1); } -#endif /* * Errors in memory handling */ -cl_err_inv_addr::cl_err_inv_addr(class cl_mem *amem, t_addr aaddr): - cl_error() +/* All of memory errors */ +ERROR_CLASS_DEF_PARENT_ON(err_error, mem, "memory", + error_class_base, ERROR_ON); + +cl_error_mem::cl_error_mem(class cl_memory *amem, t_addr aaddr) { mem= amem; addr= aaddr; + classification= &error_mem_class; +} + +/* Invalid address in memory access */ +ERROR_CLASS_DEF_PARENT(err_error, + mem_invalid_address, + "invalid_address", + error_mem_class); + +cl_error_mem_invalid_address:: +cl_error_mem_invalid_address(class cl_memory *amem, t_addr aaddr): + cl_error_mem(amem, aaddr) +{ + classification= &error_mem_invalid_address_class; +} + +void +cl_error_mem_invalid_address::print(class cl_commander *c) +{ + c->dd_printf(get_type_name()); + c->dd_printf(": invalid address ", get_type_name()); + c->dd_printf(mem->addr_format, addr); + c->dd_printf(" in memory "); + c->dd_printf(mem->get_name()); + c->dd_printf(".\n"); +} + +/* Non-decoded address space access */ +ERROR_CLASS_DEF_PARENT(err_error, + mem_non_decoded, + "non_decoded", + error_mem_class); + +cl_error_mem_non_decoded:: +cl_error_mem_non_decoded(class cl_memory *amem, t_addr aaddr): + cl_error_mem(amem, aaddr) +{ + classification= &error_mem_non_decoded_class; } void -cl_err_inv_addr::print(class cl_commander *c) +cl_error_mem_non_decoded::print(class cl_commander *c) { - c->dd_printf("Error: invalid address "); + c->dd_printf(get_type_name()); + c->dd_printf(": access of non-decoded address "); c->dd_printf(mem->addr_format, addr); - c->dd_printf(" in memory %s.\n", mem->class_name); + c->dd_printf(" in memory "); + c->dd_printf(mem->get_name()); + c->dd_printf(".\n"); } diff --git a/sim/ucsim/sim.src/memcl.h b/sim/ucsim/sim.src/memcl.h index d2044fb3..223fa443 100644 --- a/sim/ucsim/sim.src/memcl.h +++ b/sim/ucsim/sim.src/memcl.h @@ -28,9 +28,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef SIM_MEMCL_HEADER #define SIM_MEMCL_HEADER +#include "ddconfig.h" // prj -#include "ddconfig.h" #include "stypes.h" #include "pobjcl.h" @@ -38,7 +38,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "guiobjcl.h" -class cl_mem; class cl_event_handler; @@ -46,361 +45,403 @@ class cl_event_handler; #define CELL_NORMAL 0x00 /* Nothing special */ #define CELL_HW_READ 0x01 /* Hw handles read */ #define CELL_HW_WRITE 0x02 /* Hw catches write */ -#define CELL_INST 0x04 /* Marked as instruction */ -#define CELL_FETCH_BRK 0x08 /* Fetch breakpoint */ +//#define CELL_INST 0x04 /* Marked as instruction */ +//#define CELL_FETCH_BRK 0x08 /* Fetch breakpoint */ #define CELL_READ_BRK 0x10 /* Read event breakpoint */ #define CELL_WRITE_BRK 0x20 /* Write event breakpoint */ -#define CELL_GENERAL (CELL_NORMAL|CELL_INST|CELL_FETCH_BRK) - - -class cl_cell: public cl_base -{ -#ifdef STATISTIC -public: - unsigned long nuof_writes, nuof_reads; -#endif -public: - cl_cell(void); -public: - virtual TYPE_UBYTE get_type(void)= 0; - virtual void set_type(TYPE_UBYTE what)= 0; - virtual t_mem get_mask(void)= 0; - - virtual t_mem read(void)=0 ; - virtual t_mem read(enum hw_cath /*skip*/)=0; - virtual t_mem get(void)=0; - virtual t_mem write(t_mem val)=0; - virtual t_mem set(t_mem val)=0; - virtual t_mem add(long what)=0; - virtual t_mem wadd(long what)=0; - - virtual void set_bit1(t_mem bits)=0; - virtual void set_bit0(t_mem bits)=0; - - virtual class cl_cell *add_hw(class cl_hw */*hw*/, int */*ith*/)=0; - virtual class cl_hw *get_hw(int ith)=0; - virtual class cl_event_handler *get_event_handler(void)=0; -}; - -class cl_normal_cell: public cl_cell -{ -public: - t_mem data; - TYPE_UBYTE type; // See CELL_XXXX - //protected: - t_mem mask; - uchar width; - -public: - cl_normal_cell(uchar awidth); - //virtual void destroy(void) {} - - virtual TYPE_UBYTE get_type(void) { return(type); } - virtual void set_type(TYPE_UBYTE what) { type= what; } - virtual t_mem get_mask(void) { return(mask); } - - virtual t_mem read(void) { -#ifdef STATISTIC - nuof_reads++; -#endif - return(data); - } - virtual t_mem read(enum hw_cath /*skip*/) { return(data); } - virtual t_mem get(void) { return(data); } - virtual t_mem write(t_mem val) { - data= val & mask; -#ifdef STATISTIC - nuof_writes++; -#endif - return(data); - } - virtual t_mem set(t_mem val) { return(data= val & mask); } - virtual t_mem add(long what); - virtual t_mem wadd(long what); - - virtual void set_bit1(t_mem bits); - virtual void set_bit0(t_mem bits); - - virtual class cl_cell *add_hw(class cl_hw */*hw*/, int */*ith*/) - { return(0); } - virtual class cl_hw *get_hw(int ith) { return(0); } - //virtual class cl_brk *get_brk(void) { return(0); } - virtual class cl_event_handler *get_event_handler(void) { return(0); } +// Cell flags +enum cell_flag { + CELL_NONE = 0x00, + CELL_INST = 0x04, /* Marked as instruction */ + CELL_FETCH_BRK = 0x08, /* Fetch breakpoint */ + CELL_NON_DECODED = 0x40 /* Cell is not decoded (yet) */ }; +#define CELL_GENERAL (CELL_NORMAL|CELL_INST|CELL_FETCH_BRK) -/* Memory location handled specially by a hw element */ -/*class cl_memloc: public cl_base -{ -public: - t_addr address; - class cl_list *hws; - -public: - cl_memloc(t_addr addr); - virtual ~cl_memloc(void); - - virtual ulong read(class cl_mem *mem); - virtual void write(class cl_mem *mem, t_addr addr, t_mem *val); -};*/ +/* + * 3rd version of memory system + */ -/*class cl_memloc_coll: public cl_sorted_list +class cl_memory: public cl_base { public: - cl_memloc_coll(void); - - virtual void *key_of(void *item); - virtual int compare(void *key1, void *key2); - - class cl_memloc *get_loc(t_addr address); -};*/ - -/* Memory */ - -class cl_mem: public cl_guiobj -{ + t_addr start_address; +protected: + class cl_uc *uc; + t_addr size; public: - enum mem_class type; - char *class_name; char *addr_format, *data_format; - t_addr size; - ulong mask; int width; // in bits - union { - void *mem; - uchar *umem8; - }; - //class cl_memloc_coll *read_locs, *write_locs; - class cl_uc *uc; - t_addr dump_finished; + t_mem data_mask; + //char *class_name; // used by cl_m!! +protected: + t_addr dump_finished; public: - cl_mem(enum mem_class atype, char *aclass_name, t_addr asize, int awidth, - class cl_uc *auc); - virtual ~cl_mem(void); + cl_memory(char *id, t_addr asize, int awidth); + virtual ~cl_memory(void); virtual int init(void); - virtual char *id_string(void); - virtual int get_cell_flag(t_addr /*addr*/) { return(CELL_NORMAL); } - virtual bool get_cell_flag(t_addr /*addr*/, int /*flag*/) - { return(DD_FALSE); } - virtual void set_cell_flag(t_addr addr, bool set_to, int flag) {} - virtual t_mem read(t_addr addr); - virtual t_mem read(t_addr addr, enum hw_cath /*skip*/) {return(read(addr));} - virtual t_mem get(t_addr addr); - virtual t_mem write(t_addr addr, t_mem val); - virtual void set(t_addr addr, t_mem val); - virtual void set_bit1(t_addr addr, t_mem bits); - virtual void set_bit0(t_addr addr, t_mem bits); - virtual void write_bit1(t_addr addr, t_mem bits) { set_bit1(addr, bits); } - virtual void write_bit0(t_addr addr, t_mem bits) { set_bit0(addr, bits); } - virtual t_mem add(t_addr addr, long what); - virtual t_mem wadd(t_addr addr, long what) { return(add(addr, what)); } + t_addr get_start_address(void) { return(start_address); } + t_addr get_size(void) { return(size); } + virtual void set_uc(class cl_uc *auc) { uc= auc; } + virtual bool valid_address(t_addr addr); + virtual t_addr inc_address(t_addr addr, int val); + virtual t_addr inc_address(t_addr addr); + virtual t_addr validate_address(t_addr addr); + + virtual bool is_chip(void) { return(DD_FALSE); } + virtual bool is_address_space(void) { return(DD_FALSE); } + + virtual void err_inv_addr(t_addr addr); + virtual void err_non_decoded(t_addr addr); + virtual t_addr dump(t_addr start, t_addr stop, int bpl, class cl_console *con); virtual t_addr dump(class cl_console *con); virtual bool search_next(bool case_sensitive, t_mem *array, int len, t_addr *addr); - virtual class cl_cell *get_cell(t_addr addr) {return(0);} - virtual class cl_cell *register_hw(t_addr addr, class cl_hw *hw, int *ith, - bool announce) - { return(0); } - virtual void set_brk(t_addr /*addr*/, class cl_brk */*brk*/) {} - virtual void del_brk(t_addr addr, class cl_brk *brk) {} -#ifdef STATISTIC - virtual unsigned long get_nuof_reads(void) {return(0);} - virtual unsigned long get_nuof_writes(void) {return(0);} - virtual void set_nuof_reads(unsigned long value) {} - virtual void set_nuof_writes(unsigned long value) {} -#endif -}; -/* Spec for CODE */ + virtual t_addr lowest_valid_address(void) { return(start_address); } + virtual t_addr highest_valid_address(void) { return(start_address+size-1); } -/*class cl_bitmap: public cl_base -{ -public: - uchar *map; - int size; -public: - cl_bitmap(t_addr asize); - virtual ~cl_bitmap(void); - virtual void set(t_addr pos); - virtual void clear(t_addr pos); - virtual bool get(t_addr pos); - virtual bool empty(void); + + virtual t_mem read(t_addr addr)=0; + virtual t_mem read(t_addr addr, enum hw_cath skip)=0; + virtual t_mem get(t_addr addr)=0; + virtual t_mem write(t_addr addr, t_mem val)=0; + virtual void set(t_addr addr, t_mem val)=0; + virtual void set_bit1(t_addr addr, t_mem bits)=0; + virtual void set_bit0(t_addr addr, t_mem bits)=0; }; -class cl_rom: public cl_mem -{ -public: - class cl_bitmap *bp_map; - class cl_bitmap *inst_map; -public: - cl_rom(t_addr asize, int awidth, class cl_uc *auc); - virtual ~cl_rom(void); -};*/ /* - * New type of memory simulation + * Operators for memory cells */ -class cl_registered_cell: public cl_normal_cell +class cl_memory_operator: public cl_base { +protected: + t_addr address; + t_mem *data; + t_mem mask; + class cl_memory_operator *next_operator; + class cl_memory_cell *cell; public: - //class cl_list *hws; - class cl_hw **hardwares; - int nuof_hws; + cl_memory_operator(class cl_memory_cell *acell, t_addr addr); + cl_memory_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask); + + virtual void set_data(t_mem *data_place, t_mem the_mask); + virtual class cl_memory_operator *get_next(void) { return(next_operator); } + virtual void set_next(class cl_memory_operator *next) { next_operator= next;} + + virtual bool match(class cl_hw *the_hw) { return(DD_FALSE); } + virtual bool match(class cl_brk *brk) { return(DD_FALSE); } + + virtual t_mem read(void); + virtual t_mem read(enum hw_cath skip) { return(read()); } + virtual t_mem write(t_mem val); +}; + +class cl_hw_operator: public cl_memory_operator +{ +protected: + class cl_hw *hw; public: - cl_registered_cell(uchar awidth); - virtual ~cl_registered_cell(void); - //virtual void destroy(void); + cl_hw_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, class cl_hw *ahw); + + virtual bool match(class cl_hw *the_hw) { return(hw == the_hw); } virtual t_mem read(void); virtual t_mem read(enum hw_cath skip); virtual t_mem write(t_mem val); - - virtual class cl_cell *add_hw(class cl_hw *hw, int *ith); - virtual class cl_hw *get_hw(int ith); }; -class cl_event_handler: public cl_base +class cl_event_break_operator: public cl_memory_operator { -public: - class cl_list *read_bps, *write_bps; +protected: class cl_uc *uc; + class cl_brk *bp; public: - cl_event_handler(class cl_uc *auc); - virtual ~cl_event_handler(void); - - virtual void write(void); - virtual void read(void); + cl_event_break_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_uc *auc, class cl_brk *the_bp): + cl_memory_operator(acell, addr, data_place, the_mask) + { + uc= auc; + bp= the_bp; + } - virtual int add_bp(class cl_brk *bp); - virtual int copy_from(class cl_event_handler *eh); - virtual bool del_bp(class cl_brk *bp); + virtual bool match(class cl_brk *brk) { return(bp == brk); } }; -class cl_event_cell: public cl_normal_cell +class cl_write_operator: public cl_event_break_operator { -protected: - class cl_event_handler *eh; public: - cl_event_cell(uchar awidth, class cl_uc *auc); - virtual ~cl_event_cell(void); + cl_write_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_uc *auc, class cl_brk *the_bp); - virtual t_mem read(void); virtual t_mem write(t_mem val); - //virtual void event(void); - - //virtual class cl_brk *get_brk(void) { return(brk); } - virtual class cl_event_handler *get_event_handler(void) { return(eh); } }; -class cl_ev_reg_cell: public cl_registered_cell +class cl_read_operator: public cl_event_break_operator { -protected: - class cl_event_handler *eh; public: - cl_ev_reg_cell(uchar awidth, class cl_uc *auc); - virtual ~cl_ev_reg_cell(void); - + cl_read_operator(class cl_memory_cell *acell, t_addr addr, + t_mem *data_place, t_mem the_mask, + class cl_uc *auc, class cl_brk *the_bp); + virtual t_mem read(void); - virtual t_mem write(t_mem val); - //virtual void event(void); - - //virtual class cl_brk *get_brk(void) { return(brk); } - virtual class cl_event_handler *get_event_handler(void) { return(eh); } }; -class cl_mapped_cell: public cl_cell + +/* + * version 3 of cell + */ + +class cl_memory_cell: public cl_base { +#ifdef STATISTIC +public: + unsigned long nuof_writes, nuof_reads; +#endif protected: - class cl_cell *real_cell; + t_mem *data; + t_mem mask; + uchar width; + TYPE_UBYTE flags; + class cl_memory_operator *operators; public: - cl_mapped_cell(class cl_cell *realcell); - virtual ~cl_mapped_cell(void); + cl_memory_cell(void); + virtual ~cl_memory_cell(void); + virtual int init(void); + + virtual t_mem *get_data(void) { return(data); } + virtual t_mem get_mask(void) { return(mask); } + virtual TYPE_UBYTE get_flags(void); + virtual bool get_flag(enum cell_flag flag); + virtual void set_flags(TYPE_UBYTE what); + virtual void set_flag(enum cell_flag flag, bool val); + + virtual void un_decode(void); + virtual void decode(class cl_memory_chip *chip, t_addr addr); virtual t_mem read(void); virtual t_mem read(enum hw_cath skip); virtual t_mem get(void); virtual t_mem write(t_mem val); virtual t_mem set(t_mem val); + virtual t_mem add(long what); virtual t_mem wadd(long what); virtual void set_bit1(t_mem bits); virtual void set_bit0(t_mem bits); - virtual class cl_cell *add_hw(class cl_hw *hw, int *ith); - virtual class cl_hw *get_hw(int ith); + virtual void append_operator(class cl_memory_operator *op); + virtual void prepend_operator(class cl_memory_operator *op); + virtual void del_operator(class cl_brk *brk); + + virtual class cl_memory_cell *add_hw(class cl_hw *hw, int *ith, t_addr addr); + //virtual class cl_hw *get_hw(int ith); virtual class cl_event_handler *get_event_handler(void); }; -class cl_m: public cl_mem +class cl_dummy_cell: public cl_memory_cell { -protected: - class cl_cell **array; - class cl_cell *dummy; - t_addr bus_mask; public: - //t_addr size; - //int width; + cl_dummy_cell(void): cl_memory_cell() {} + virtual t_mem write(t_mem val); + virtual t_mem set(t_mem val); +}; + + +/* + * Address space + */ + +class cl_memory_chip; + +class cl_address_space: public cl_memory +{ +protected: + class cl_memory_cell **cells, *dummy; public: - cl_m(enum mem_class atype, char *aclass_name, t_addr asize, int awidth, - class cl_uc *auc); - cl_m(t_addr asize, int awidth); - virtual ~cl_m(void); - virtual void err_inv_addr(t_addr addr); - virtual int get_cell_flag(t_addr addr); - virtual bool get_cell_flag(t_addr addr, int flag); - virtual void set_cell_flag(t_addr addr, bool set_to, int flag); + class cl_decoder_list *decoders; +public: + cl_address_space(char *id, t_addr astart, t_addr asize, int awidth); + virtual ~cl_address_space(void); + + virtual bool is_address_space(void) { return(DD_TRUE); } virtual t_mem read(t_addr addr); virtual t_mem read(t_addr addr, enum hw_cath skip); virtual t_mem get(t_addr addr); virtual t_mem write(t_addr addr, t_mem val); virtual void set(t_addr addr, t_mem val); - virtual class cl_cell *get_cell(t_addr addr); - + virtual t_mem wadd(t_addr addr, long what); virtual void set_bit1(t_addr addr, t_mem bits); virtual void set_bit0(t_addr addr, t_mem bits); - virtual void write_bit1(t_addr addr, t_mem bits); - virtual void write_bit0(t_addr addr, t_mem bits); - virtual t_mem add(t_addr addr, long what); - virtual t_mem wadd(t_addr addr, long what); - virtual class cl_cell *register_hw(t_addr addr, class cl_hw *hw, int *ith, - bool announce); + virtual class cl_memory_cell *get_cell(t_addr addr); + virtual int get_cell_flag(t_addr addr); + virtual bool get_cell_flag(t_addr addr, enum cell_flag flag); + virtual void set_cell_flag(t_addr addr, bool set_to, enum cell_flag flag); + + virtual bool decode_cell(t_addr addr, + class cl_memory_chip *chip, t_addr chipaddr); + virtual void undecode_cell(t_addr addr); + virtual void undecode_area(class cl_address_decoder *skip, + t_addr begin, t_addr end, class cl_console *con); + + virtual class cl_memory_cell *register_hw(t_addr addr, class cl_hw *hw, + int *ith, + bool announce); + virtual void set_brk(t_addr addr, class cl_brk *brk); virtual void del_brk(t_addr addr, class cl_brk *brk); #ifdef STATISTIC - virtual unsigned long get_nuof_reads(void); - virtual unsigned long get_nuof_writes(void); - virtual void set_nuof_reads(unsigned long value); - virtual void set_nuof_writes(unsigned long value); + virtual unsigned long get_nuof_reads(void) { return(0); } + virtual unsigned long get_nuof_writes(void) { return(0); } + virtual void set_nuof_reads(unsigned long value) {} + virtual void set_nuof_writes(unsigned long value) {} #endif }; +class cl_address_space_list: public cl_list +{ +protected: + class cl_uc *uc; +public: + cl_address_space_list(class cl_uc *the_uc); + virtual t_index add(class cl_address_space *mem); +}; + + +/* + * Memory chip (storage) + */ + +class cl_memory_chip: public cl_memory +{ +protected: + t_mem *array; + int init_value; +public: + cl_memory_chip(char *id, int asize, int awidth, int initial= -1); + virtual ~cl_memory_chip(void); + virtual int init(void); + + virtual bool is_chip(void) { return(DD_TRUE); } + + virtual t_mem *get_slot(t_addr addr); + + virtual t_mem read(t_addr addr) { return(get(addr)); } + virtual t_mem read(t_addr addr, enum hw_cath skip) { return(get(addr)); } + virtual t_mem get(t_addr addr); + virtual t_mem write(t_addr addr, t_mem val) { set(addr, val); return(val); } + virtual void set(t_addr addr, t_mem val); + virtual void set_bit1(t_addr addr, t_mem bits); + virtual void set_bit0(t_addr addr, t_mem bits); +}; + + +/* + * Address decoder + */ + +class cl_address_decoder: public cl_base +{ +public: + class cl_address_space *address_space; + class cl_memory_chip *memchip; + t_addr as_begin, as_end; + t_addr chip_begin; + bool activated; +public: + cl_address_decoder(class cl_memory *as, class cl_memory *chip, + t_addr asb, t_addr ase, t_addr cb); + virtual ~cl_address_decoder(void); + virtual int init(void); + + virtual bool activate(class cl_console *con); + + virtual bool fully_covered_by(t_addr begin, t_addr end); + virtual bool is_in(t_addr begin, t_addr end); + virtual bool covers(t_addr begin, t_addr end); + + virtual bool shrink_out_of(t_addr begin, t_addr end); + virtual class cl_address_decoder *split(t_addr begin, t_addr end); +}; + +/* List of address decoders */ + +class cl_decoder_list: public cl_sorted_list +{ +protected: + bool by_chip; +public: + cl_decoder_list(t_index alimit, t_index adelta, bool bychip); + + virtual void *key_of(void *item); + virtual int compare(void *key1, void *key2); +}; + + +/* + * Messages + */ + +#include "eventcl.h" + +class cl_event_address_space_added: public cl_event +{ +public: + class cl_address_space *as; + cl_event_address_space_added(class cl_address_space *the_as): + cl_event(ev_address_space_added) + { as= the_as; } +}; -#include "errorcl.h" /* * Errors in memory handling */ -class cl_err_inv_addr: public cl_error +#include "errorcl.h" + +ERROR_CLASS_DECL(mem): public cl_error { protected: - class cl_mem *mem; + class cl_memory *mem; t_addr addr; public: - cl_err_inv_addr(class cl_mem *amem, t_addr aaddr); + cl_error_mem(class cl_memory *amem, t_addr aaddr); +}; + +ERROR_CLASS_DECL(mem_invalid_address): public cl_error_mem +{ +public: + cl_error_mem_invalid_address(class cl_memory *amem, t_addr aaddr); + + virtual void print(class cl_commander *c); +}; + +ERROR_CLASS_DECL(mem_non_decoded): public cl_error_mem +{ +public: + cl_error_mem_non_decoded(class cl_memory *amem, t_addr aaddr); + virtual void print(class cl_commander *c); }; diff --git a/sim/ucsim/sim.src/sim.cc b/sim/ucsim/sim.src/sim.cc index d86cf5a3..ed6fb467 100644 --- a/sim/ucsim/sim.src/sim.cc +++ b/sim/ucsim/sim.src/sim.cc @@ -183,8 +183,15 @@ cl_sim::stop(int reason) cmd->frozen_console->dd_printf("User stopped\n"); break; case resINV_INST: - cmd->frozen_console->dd_printf("Invalid instruction 0x%04x\n", - uc->get_mem(MEM_ROM, uc->PC)); + { + cmd->frozen_console->dd_printf("Invalid instruction"); + if (uc->rom) + cmd->frozen_console->dd_printf(" 0x%04x\n", + uc->rom->get(uc->PC)); + } + break; + case resERROR: + // uc::check_error prints error messages... break; default: cmd->frozen_console->dd_printf("Unknown reason\n"); @@ -199,6 +206,31 @@ cl_sim::stop(int reason) cmd->set_fd_set(); } +void +cl_sim::stop(class cl_ev_brk *brk) +{ + class cl_commander *cmd= app->get_commander(); + + state&= ~SIM_GO; + if (cmd->frozen_console) + { + class cl_console *con= cmd->frozen_console; + /* + if (reason == resUSER && + cmd->frozen_console->input_avail()) + cmd->frozen_console->read_line(); + */ + //con->dd_printf("Stop at 0x%06x\n", uc->PC); + con->dd_printf("Event `%s' at %s[0x%"_A_"x]: 0x%"_A_"x %s\n", + brk->id, brk->get_mem()->get_name(), brk->addr, + uc->instPC, + uc->disass(uc->instPC, " ")); + //con->flags&= ~CONS_FROZEN; + //con->print_prompt(); + //cmd->frozen_console= 0; + } +} + /* */ @@ -221,13 +253,13 @@ cl_sim::build_cmdset(class cl_cmdset *cmdset) "long help of stop")); cmd->init(); - cmdset->add(cmd= new cl_step_cmd("step", 0, + cmdset->add(cmd= new cl_step_cmd("step", DD_TRUE, "step Step", "long help of step")); cmd->init(); cmd->add_name("s"); - cmdset->add(cmd= new cl_next_cmd("next", 0, + cmdset->add(cmd= new cl_next_cmd("next", DD_TRUE, "next Next", "long help of next")); cmd->init(); @@ -255,15 +287,15 @@ cl_sim::build_cmdset(class cl_cmdset *cmdset) /* * Messages to broadcast */ - +/* void -cl_sim::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_sim::mem_cell_changed(class cl_address_space *mem, t_addr addr) { if (uc) uc->mem_cell_changed(mem, addr); else printf("JAJ sim\n"); } - +*/ /* End of sim.src/sim.cc */ diff --git a/sim/ucsim/sim.src/simcl.h b/sim/ucsim/sim.src/simcl.h index eab04a32..990b5cbf 100644 --- a/sim/ucsim/sim.src/simcl.h +++ b/sim/ucsim/sim.src/simcl.h @@ -69,11 +69,12 @@ public: virtual class cl_uc *get_uc(void) { return(uc); } // messages from app to handle and broadcast - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + //virtual void mem_cell_changed(class cl_address_space *m, t_addr addr); virtual int main(void); virtual void start(class cl_console *con); virtual void stop(int reason); + virtual void stop(class cl_ev_brk *brk); virtual int step(void); }; diff --git a/sim/ucsim/sim.src/stack.cc b/sim/ucsim/sim.src/stack.cc index c8941d67..d9c5fe8d 100644 --- a/sim/ucsim/sim.src/stack.cc +++ b/sim/ucsim/sim.src/stack.cc @@ -25,18 +25,24 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*@1@*/ +#include + +// cmd.src +#include "newcmdcl.h" + +// sim.src #include "stackcl.h" -cl_stack_op::cl_stack_op(enum stack_op itype, - t_addr iPC, t_addr iaddr, t_mem idata, +cl_stack_op::cl_stack_op(enum stack_op op, + t_addr iPC, t_addr iSP_before, t_addr iSP_after): cl_base() { - type= itype; + operation= op; PC= iPC; - addr= iaddr; - data= idata; + //addr= iaddr; + //data= idata; SP_before= iSP_before; SP_after= iSP_after; } @@ -46,4 +52,487 @@ cl_stack_op::~cl_stack_op(void) } +class cl_stack_op * +cl_stack_op::mk_copy(void) +{ + class cl_stack_op *so= new cl_stack_op(*this); + return(so); +} + +void +cl_stack_op::info_head(class cl_console *con) +{ + con->dd_printf("OP SP before-after L DATA/ADDR INSTRUCTION\n"); +} + +void +cl_stack_op::info(class cl_console *con, class cl_uc *uc) +{ + con->dd_printf("%-4s 0x%06"_A_"x-0x%06"_A_"x %d ", + get_op_name(), SP_before, SP_after, abs(SP_before-SP_after)); + print_info(con); + con->dd_printf(" "); + uc->print_disass(PC, con); + //con->dd_printf("\n"); +} + +char * +cl_stack_op::get_op_name(void) +{ + return("op"); +} + +void +cl_stack_op::print_info(class cl_console *con) +{ + con->dd_printf("-"); +} + +bool +cl_stack_op::sp_increased(void) +{ + if (operation & stack_write_operation) + return(SP_after > SP_before); + else // read operation + return(SP_after < SP_before); +} + +int +cl_stack_op::data_size(void) +{ + int r= SP_after - SP_before; + + return(r<0?-r:r); +} + +int +cl_stack_op::match(class cl_stack_op *op) +{ + return(DD_FALSE); +} + +bool +cl_stack_op::can_removed(class cl_stack_op *op) +{ + bool incr= sp_increased(); // FIXME + bool op_incr= op->sp_increased(); // FIXME + + if ((incr && !op_incr) || + (!incr && op_incr)) + { + printf("BIGBIG ERROR!\n"); + return(DD_FALSE); + } + if (incr) + { + t_mem opa= op->get_after(); + return(SP_before >= opa); + } + else + { + t_mem opa= op->get_after(); + return(SP_before <= opa); + } +} + + +/* + * CALL operation on stack + */ + +cl_stack_call::cl_stack_call(t_addr iPC, t_addr called, t_addr pushed, + t_addr iSP_before, t_addr iSP_after): + cl_stack_op(stack_call, iPC, iSP_before, iSP_after) +{ + called_addr= called; + pushed_addr= pushed; +} + +class cl_stack_op * +cl_stack_call::mk_copy(void) +{ + class cl_stack_call *so= new cl_stack_call(*this); + return(so); +} + +char * +cl_stack_call::get_op_name(void) +{ + return("call"); +} + +void +cl_stack_call::print_info(class cl_console *con) +{ + con->dd_printf("0x%06"_A_"x", called_addr); +} + +char * +cl_stack_call::get_matching_name(void) +{ + return("ret"); +} + +enum stack_op +cl_stack_call::get_matching_op(void) +{ + return(stack_ret); +} + +bool +cl_stack_call::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_ret); +} + + +/* + * INTERRUPT operation (call) on stack + */ + +cl_stack_intr::cl_stack_intr(t_addr iPC, t_addr called, t_addr pushed, + t_addr iSP_before, t_addr iSP_after): + cl_stack_call(iPC, called, pushed, iSP_before, iSP_after) +{ + //called_addr= called; + //pushed_addr= pushed; + operation= stack_intr; +} + +class cl_stack_op * +cl_stack_intr::mk_copy(void) +{ + class cl_stack_intr *so= new cl_stack_intr(*this); + return(so); +} + +char * +cl_stack_intr::get_op_name(void) +{ + return("intr"); +} + +void +cl_stack_intr::print_info(class cl_console *con) +{ + con->dd_printf("0x%06"_A_"x", called_addr); +} + +char * +cl_stack_intr::get_matching_name(void) +{ + return("iret"); +} + +enum stack_op +cl_stack_intr::get_matching_op(void) +{ + return(stack_iret); +} + +int +cl_stack_intr::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_iret); +} + + +/* + * PUSH operation on stack + */ + +cl_stack_push::cl_stack_push(t_addr iPC, t_mem idata, + t_addr iSP_before, t_addr iSP_after): + cl_stack_op(stack_push, iPC, iSP_before, iSP_after) +{ + data= idata; +} + +class cl_stack_op * +cl_stack_push::mk_copy(void) +{ + class cl_stack_push *so= new cl_stack_push(*this); + return(so); +} + +char * +cl_stack_push::get_op_name(void) +{ + return("push"); +} + +char * +cl_stack_push::get_matching_name(void) +{ + return("pop"); +} + +enum stack_op +cl_stack_push::get_matching_op(void) +{ + return(stack_pop); +} + +void +cl_stack_push::print_info(class cl_console *con) +{ + t_addr d= data; + con->dd_printf("0x%06"_A_"x", d); +} + +int +cl_stack_push::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_pop); +} + + +/* + * RETURN operation on stack + */ + +cl_stack_ret::cl_stack_ret(t_addr iPC, t_addr iaddr, + t_addr iSP_before, t_addr iSP_after): + cl_stack_call(iPC, iaddr, 0, iSP_before, iSP_after) +{ + operation= stack_ret; +} + +class cl_stack_op * +cl_stack_ret::mk_copy(void) +{ + class cl_stack_ret *so= new cl_stack_ret(*this); + return(so); +} + +char * +cl_stack_ret::get_op_name(void) +{ + return("ret"); +} + +char * +cl_stack_ret::get_matching_name(void) +{ + return("call"); +} + +enum stack_op +cl_stack_ret::get_matching_op(void) +{ + return(stack_call); +} + +int +cl_stack_ret::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_call); +} + + +/* + * RETURN from interrupt operation on stack + */ + +cl_stack_iret::cl_stack_iret(t_addr iPC, t_addr iaddr, + t_addr iSP_before, t_addr iSP_after): + cl_stack_ret(iPC, iaddr, iSP_before, iSP_after) +{ + operation= stack_iret; +} + +class cl_stack_op * +cl_stack_iret::mk_copy(void) +{ + class cl_stack_iret *so= new cl_stack_iret(*this); + return(so); +} + +char * +cl_stack_iret::get_op_name(void) +{ + return("iret"); +} + +char * +cl_stack_iret::get_matching_name(void) +{ + return("intr"); +} + +enum stack_op +cl_stack_iret::get_matching_op(void) +{ + return(stack_intr); +} + +int +cl_stack_iret::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_intr); +} + + +/* + * POP operation on stack + */ + +cl_stack_pop::cl_stack_pop(t_addr iPC, t_mem idata, + t_addr iSP_before, t_addr iSP_after): + cl_stack_push(iPC, idata, iSP_before, iSP_after) +{ + operation= stack_pop; +} + +class cl_stack_op * +cl_stack_pop::mk_copy(void) +{ + class cl_stack_pop *so= new cl_stack_pop(*this); + return(so); +} + +char * +cl_stack_pop::get_op_name(void) +{ + return("pop"); +} + +char * +cl_stack_pop::get_matching_name(void) +{ + return("push"); +} + +enum stack_op +cl_stack_pop::get_matching_op(void) +{ + return(stack_push); +} + +int +cl_stack_pop::match(class cl_stack_op *op) +{ + return(op->get_op() == stack_push); +} + + +/* + * Stack Errors + */ + +ERROR_CLASS_DEF_PARENT_ON(err_error, stack, "stack", + error_class_base, ERROR_OFF); + +/* Stack Tracker Errors */ +ERROR_CLASS_DEF_PARENT(err_error, stack_tracker, "stack_tracker", + error_stack_class); + +/* Stack Tracker: wrong handle */ +ERROR_CLASS_DEF_PARENT(err_error, + stack_tracker_wrong_handle, + "stack_tracker_wrong_handle", + error_stack_tracker_class) + +cl_error_stack_tracker_wrong_handle::cl_error_stack_tracker_wrong_handle(bool write_op): + cl_error_stack_tracker() +{ + write_operation= write_op; + classification= &error_stack_tracker_wrong_handle_class; +} + +void +cl_error_stack_tracker_wrong_handle::print(class cl_commander *c) +{ + c->dd_printf("%s: wrong stack tracker handle called for %s operation\n", + get_type_name(), write_operation?"write":"read"); +} + +/* Stack Tracker: operation on empty stack */ +ERROR_CLASS_DEF_PARENT(err_error, + stack_tracker_empty, + "operation_on_empty_stack", + error_stack_tracker_class); + +cl_error_stack_tracker_empty:: +cl_error_stack_tracker_empty(class cl_stack_op *op): + cl_error_stack_tracker() +{ + operation= op->mk_copy(); + classification= &error_stack_tracker_empty_class; +} + +cl_error_stack_tracker_empty::~cl_error_stack_tracker_empty(void) +{ + delete operation; +} + +void +cl_error_stack_tracker_empty::print(class cl_commander *c) +{ + c->dd_printf("%s(0x%06"_A_"x: %s on empty stack, PC=" + "0x06"_A_"x, SP=0x%06"_A_"x->0x%06"_A_"x\n", + get_type_name(), operation->get_pc(), operation->get_op_name(), + operation->get_before(), operation->get_after()); +} + +/* Stack Tracker: operation on empty stack */ +ERROR_CLASS_DEF_PARENT(err_warning, + stack_tracker_unmatch, + "stack_operation_unmatched_to_top_of_stack", + error_stack_tracker_class); + +cl_error_stack_tracker_unmatch:: +cl_error_stack_tracker_unmatch(class cl_stack_op *Top, class cl_stack_op *op): + cl_error_stack_tracker() +{ + top= Top->mk_copy(); + operation= op->mk_copy(); + classification= &error_stack_tracker_unmatch_class; +} + +cl_error_stack_tracker_unmatch::~cl_error_stack_tracker_unmatch(void) +{ + delete operation; + delete top; +} + +void +cl_error_stack_tracker_unmatch::print(class cl_commander *c) +{ + c->dd_printf("%s(0x%06"_A_"x): %s when %s expected, " + "SP=0x%06"_A_"x->0x%06"_A_"x\n", + get_type_name(), operation->get_pc(), + operation->get_op_name(), top->get_matching_name(), + operation->get_before(), operation->get_after()); +} + +/* Stack Tracker: stack is inconsistent */ +ERROR_CLASS_DEF_PARENT(err_warning, + stack_tracker_inconsistent, + "stack_looks_corrupted", + error_stack_tracker_class); + +cl_error_stack_tracker_inconsistent:: +cl_error_stack_tracker_inconsistent(class cl_stack_op *op, + int the_unread_data_size) +{ + operation= op->mk_copy(); + unread_data_size= the_unread_data_size; + classification= &error_stack_tracker_inconsistent_class; +} + +cl_error_stack_tracker_inconsistent::~cl_error_stack_tracker_inconsistent(void) +{ + delete operation; +} + +void +cl_error_stack_tracker_inconsistent::print(class cl_commander *c) +{ + c->dd_printf("%s(0x%06"_A_"x): %d byte(s) unread from the stack\n", + get_type_name(), operation->get_pc(), + unread_data_size); +} + + /* End of sim.src/stack.cc */ diff --git a/sim/ucsim/sim.src/stackcl.h b/sim/ucsim/sim.src/stackcl.h index 6e391abb..06e522bc 100644 --- a/sim/ucsim/sim.src/stackcl.h +++ b/sim/ucsim/sim.src/stackcl.h @@ -33,26 +33,207 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA enum stack_op { - stack_call, - stack_push, - stack_ret, - stack_pop + stack_call = 0x01, + stack_intr = 0x02, + stack_push = 0x04, + stack_ret = 0x08, + stack_iret = 0x10, + stack_pop = 0x20 }; +const int stack_write_operation= (stack_call|stack_intr|stack_push); +const int stack_read_operation = (stack_ret|stack_iret|stack_pop); + +/* Abstraction of a stack operation */ class cl_stack_op: public cl_base { -public: - enum stack_op type; +protected: + enum stack_op operation; t_addr PC; // of instruction - t_addr addr; // called routine - t_mem data; // pushed data t_addr SP_before; t_addr SP_after; public: - cl_stack_op(enum stack_op itype, - t_addr iPC, t_addr iaddr, t_mem idata, - t_addr iSP_before, t_addr iSP_after); + cl_stack_op(enum stack_op op, + t_addr iPC, t_addr iSP_before, t_addr iSP_after); virtual ~cl_stack_op(void); + virtual class cl_stack_op *mk_copy(void); + static void info_head(class cl_console *con); + virtual void info(class cl_console *con, class cl_uc *uc); +protected: + virtual void print_info(class cl_console *con); +public: + virtual char *get_op_name(void); + virtual char *get_matching_name(void) { return("unknown"); } + virtual bool sp_increased(void); + virtual int data_size(void); + virtual bool match(class cl_stack_op *op); + virtual enum stack_op get_op(void) { return(operation); } + virtual enum stack_op get_matching_op(void) { return(operation); } + virtual t_addr get_after(void) { return(SP_after); } + virtual t_addr get_before(void) { return(SP_before); } + virtual t_addr get_pc(void) { return(PC); } + virtual bool can_removed(class cl_stack_op *op); +}; + +/* Call of a subrutine, must match with RET */ +class cl_stack_call: public cl_stack_op +{ +protected: + t_addr called_addr; // called routine + t_addr pushed_addr; +public: + cl_stack_call(t_addr iPC, t_addr called, t_addr pushed, + t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); + virtual void print_info(class cl_console *con); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + +/* Call of an ISR, must match with IRET */ +class cl_stack_intr: public cl_stack_call +{ +public: + cl_stack_intr(t_addr iPC, t_addr called, t_addr pushed, + t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); + virtual void print_info(class cl_console *con); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + +/* Push data to stack, must match with POP */ +class cl_stack_push: public cl_stack_op +{ +protected: + t_mem data; // pushed data +public: + cl_stack_push(t_addr iPC, t_mem idata, t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); + virtual void print_info(class cl_console *con); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + +/* Returning from a subroutine, tos must be CALL */ +class cl_stack_ret: public cl_stack_call +{ +public: + cl_stack_ret(t_addr iPC, t_addr iaddr, t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + +/* Returning from an ISR, yos must be INTR */ +class cl_stack_iret: public cl_stack_ret +{ +public: + cl_stack_iret(t_addr iPC, t_addr iaddr, t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + +/* Pop out data from stack, tos must be PUSH */ +class cl_stack_pop: public cl_stack_push +{ +public: + cl_stack_pop(t_addr iPC, t_mem idata, t_addr iSP_before, t_addr iSP_after); + virtual class cl_stack_op *mk_copy(void); +protected: + virtual char *get_op_name(void); +public: + virtual char *get_matching_name(void); + virtual enum stack_op get_matching_op(void); + virtual bool match(class cl_stack_op *op); +}; + + +/* + * All kind of stack errors + */ +//extern class cl_error_class error_stack_class; +//class cl_error_stack: public cl_error +ERROR_CLASS_DECL(stack): public cl_error +{ +public: + cl_error_stack(void) { classification= &error_stack_class; } +}; + +/* + * All kind of stack tracker errors + */ +ERROR_CLASS_DECL(stack_tracker): public cl_error_stack +{ +public: + cl_error_stack_tracker(void) { classification= &error_stack_tracker_class; } +}; + +ERROR_CLASS_DECL(stack_tracker_wrong_handle): public cl_error_stack_tracker +{ +public: + bool write_operation; +public: + cl_error_stack_tracker_wrong_handle(bool write_op); + + virtual void print(class cl_commander *c); +}; + +ERROR_CLASS_DECL(stack_tracker_empty): public cl_error_stack_tracker +{ +protected: + class cl_stack_op *operation; +public: + cl_error_stack_tracker_empty(class cl_stack_op *op); + virtual ~cl_error_stack_tracker_empty(void); + + virtual void print(class cl_commander *c); +}; + +ERROR_CLASS_DECL(stack_tracker_unmatch): public cl_error_stack_tracker +{ +protected: + class cl_stack_op *top, *operation; +public: + cl_error_stack_tracker_unmatch(class cl_stack_op *Top, + class cl_stack_op *op); + virtual ~cl_error_stack_tracker_unmatch(void); + + virtual void print(class cl_commander *c); +}; + +ERROR_CLASS_DECL(stack_tracker_inconsistent): public cl_error_stack_tracker +{ +protected: + class cl_stack_op *operation; + int unread_data_size; +public: + cl_error_stack_tracker_inconsistent(class cl_stack_op *op, + int the_unread_data_size); + virtual ~cl_error_stack_tracker_inconsistent(void); + + virtual void print(class cl_commander *c); }; diff --git a/sim/ucsim/sim.src/test_mem_speed.cc b/sim/ucsim/sim.src/test_mem_speed.cc index 5f40e9eb..920f13cf 100644 --- a/sim/ucsim/sim.src/test_mem_speed.cc +++ b/sim/ucsim/sim.src/test_mem_speed.cc @@ -72,13 +72,13 @@ main(void) signal(SIGALRM, alarmed); con= new cl_console(stdin, stdout, 0); - mem= new cl_mem(MEM_SFR, "egy", 0x10000, 8); + mem= new cl_mem(MEM_SFR, "egy", 0x10000, 8, 0); mem->init(); printf("%g operations on classic memory within 5 sec\n", do_rw_test(mem, 5)); //mem->dump(con); - m2= new cl_m(MEM_TYPES, "test", 0x10000, 8); + m2= new cl_m(MEM_TYPES, "test", 0x10000, 8, 0); m2->init(); printf("%g operations on new memory within 5 sec\n", do_rw_test(m2, 5)); @@ -87,8 +87,9 @@ main(void) for (i= 0; i < 0x10000; i++) { class cl_cell *c= m2->get_cell(i); + int dummy; if (c) - c->add_hw(hw); + c->add_hw(hw, &dummy); } printf("%g operations on new memory within 5 sec with hw read\n", do_rw_test(m2, 5)); diff --git a/sim/ucsim/sim.src/uc.cc b/sim/ucsim/sim.src/uc.cc index 7ad8f08a..600e9d1a 100644 --- a/sim/ucsim/sim.src/uc.cc +++ b/sim/ucsim/sim.src/uc.cc @@ -46,6 +46,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "infocl.h" #include "timercl.h" #include "cmdstatcl.h" +#include "cmdmemcl.h" // local, sim.src #include "uccl.h" @@ -99,6 +100,27 @@ cl_ticker::dump(int nr, double xtal, class cl_console *con) } +/* + * Options of uc + */ + +cl_xtal_option::cl_xtal_option(class cl_uc *the_uc): + cl_optref(the_uc) +{ + uc= the_uc; +} + +void +cl_xtal_option::option_changed(void) +{ + if (!uc) + return; + double d; + option->get_value(&d); + uc->xtal= d; +} + + /* * Abstract microcontroller ****************************************************************************** @@ -107,24 +129,30 @@ cl_ticker::dump(int nr, double xtal, class cl_console *con) cl_uc::cl_uc(class cl_sim *asim): cl_base() { - int i; + //int i; sim = asim; - mems= new cl_list(MEM_TYPES, 1); + //mems= new cl_list(MEM_TYPES, 1); + memchips= new cl_list(2, 2, "memchips"); + address_spaces= new cl_address_space_list(this); + //address_decoders= new cl_list(2, 2); + rom= 0; + hws = new cl_hws(); //options= new cl_list(2, 2); - for (i= MEM_ROM; i < MEM_TYPES; i++) - mems->add(0); + //for (i= MEM_ROM; i < MEM_TYPES; i++) mems->add(0); + xtal_option= new cl_xtal_option(this); + xtal_option->init(); ticks= new cl_ticker(+1, 0, "time"); isr_ticks= new cl_ticker(+1, TICK_INISR, "isr"); idle_ticks= new cl_ticker(+1, TICK_IDLE, "idle"); - counters= new cl_list(2, 2); - it_levels= new cl_list(2, 2); + counters= new cl_list(2, 2, "counters"); + it_levels= new cl_list(2, 2, "it levels"); it_sources= new cl_irqs(2, 2); class it_level *il= new it_level(-1, 0, 0, 0); it_levels->push(il); - st_ops= new cl_list(2, 2); - errors= new cl_list(2, 2); - events= new cl_list(2, 2); + stack_ops= new cl_list(2, 2, "stack operations"); + errors= new cl_list(2, 2, "errors in uc"); + events= new cl_list(2, 2, "events in uc"); sp_max= 0; sp_avg= 0; inst_exec= DD_FALSE; @@ -133,7 +161,7 @@ cl_uc::cl_uc(class cl_sim *asim): cl_uc::~cl_uc(void) { - delete mems; + //delete mems; delete hws; //delete options; delete ticks; @@ -146,31 +174,31 @@ cl_uc::~cl_uc(void) delete ebrk; delete it_levels; delete it_sources; - delete st_ops; + delete stack_ops; errors->free_all(); delete errors; + delete xtal_option; + delete address_spaces; + delete memchips; + //delete address_decoders; } int cl_uc::init(void) { - int mc, i; + int i; + set_name("controller"); cl_base::init(); - if (!(sim->app->args->arg_avail('X')) || - sim->app->args->get_farg('X', 0) == 0) - xtal= 11059200; + if (xtal_option->use("xtal")) + xtal= xtal_option->get_value(xtal); else - xtal= sim->app->args->get_farg('X', 0); - for (mc= MEM_ROM; mc < MEM_TYPES; mc++) - { - class cl_mem *m= mk_mem((enum mem_class)mc, - get_id_string(mem_classes, mc)); - mems->put_at(mc, m); - } - ebrk= new brk_coll(2, 2, /*(class cl_rom *)*/mem(MEM_ROM)); - fbrk= new brk_coll(2, 2, /*(class cl_rom *)*/mem(MEM_ROM)); + xtal= 11059200; + make_memories(); + rom= address_space(MEM_ROM_ID); + ebrk= new brk_coll(2, 2, rom); + fbrk= new brk_coll(2, 2, rom); fbrk->Duplicates= DD_FALSE; brk_counter= 0; mk_hw_elements(); @@ -202,7 +230,7 @@ cl_uc::reset(void) { class it_level *il; - PC= 0; + instPC= PC= 0; state = stGO; ticks->ticks= 0; isr_ticks->ticks= 0; @@ -219,6 +247,8 @@ cl_uc::reset(void) sp_max= 0; sp_avg= 0; + stack_ops->free_all(); + int i; for (i= 0; i < hws->count; i++) { @@ -231,40 +261,24 @@ cl_uc::reset(void) * Making elements */ -class cl_mem * -cl_uc::mk_mem(enum mem_class type, char *class_name) -{ - class cl_mem *m; - - if (get_mem_size(type) < 0) - return(0); - m= new cl_m(type, get_id_string(mem_classes, type), - get_mem_size(type), get_mem_width(type), this); - m->init(); - return(m); -} +void +cl_uc::make_memories(void) +{} -t_addr -cl_uc::get_mem_size(enum mem_class type) +/*t_addr +cl_uc::get_mem_size(char *id) { - switch (type) - { - case MEM_ROM: return(0x10000); - case MEM_XRAM: return(0x10000); - case MEM_IRAM: return(0x80); - case MEM_SFR: return(0x100); - case MEM_TYPES: - default: return(0); - } - return(0); + class cl_memory *m= memory(id); + return(m?(m->get_size()):0); } int -cl_uc::get_mem_width(enum mem_class type) +cl_uc::get_mem_width(char *id) { - return(8); + class cl_memory *m= memory(id); + return(m?(m->width):8); } - +*/ void cl_uc::mk_hw_elements(void) { @@ -297,7 +311,7 @@ cl_uc::build_cmdset(class cl_cmdset *cmdset) cmd->add_name("load"); cmdset->add(cmd= new cl_dl_cmd("download", 0, -"download,dl Load (intel.hex) data", +"download Load (intel.hex) data", "long help of download")); cmd->init(); cmd->add_name("dl"); @@ -312,39 +326,24 @@ cl_uc::build_cmdset(class cl_cmdset *cmdset) "long help of reset")); cmd->init(); - cmdset->add(cmd= new cl_dump_cmd("dump", 0, + cmdset->add(cmd= new cl_dump_cmd("dump", DD_TRUE, "dump memory_type [start [stop [bytes_per_line]]]\n" " Dump memory of specified type\n" "dump bit... Dump bits", "long help of dump")); cmd->init(); - cmdset->add(cmd= new cl_di_cmd("di", 0, -"di [start [stop]] Dump Internal RAM", -"long help of di")); - cmd->init(); - - cmdset->add(cmd= new cl_dx_cmd("dx", 0, -"dx [start [stop]] Dump External RAM", -"long help of dx")); - cmd->init(); - - cmdset->add(cmd= new cl_ds_cmd("ds", 0, -"ds [start [stop]] Dump SFR", -"long help of ds")); - cmd->init(); - - cmdset->add(cmd= new cl_dch_cmd("dch", 0, + cmdset->add(cmd= new cl_dch_cmd("dch", DD_TRUE, "dch [start [stop]] Dump code in hex form", "long help of dch")); cmd->init(); - cmdset->add(cmd= new cl_dc_cmd("dc", 0, + cmdset->add(cmd= new cl_dc_cmd("dc", DD_TRUE, "dc [start [stop]] Dump code in disass form", "long help of dc")); cmd->init(); - cmdset->add(cmd= new cl_disassemble_cmd("disassemble", 0, + cmdset->add(cmd= new cl_disassemble_cmd("disassemble", DD_TRUE, "disassemble [start [offset [lines]]]\n" " Disassemble code", "long help of disassemble")); @@ -451,9 +450,14 @@ cmd->init();*/ cmd->init(); } - { - cset= new cl_cmdset(); - cset->init(); + { // info + super_cmd= (class cl_super_cmd *)(cmdset->get_cmd("info")); + if (super_cmd) + cset= super_cmd->get_subcommands(); + else { + cset= new cl_cmdset(); + cset->init(); + } cset->add(cmd= new cl_info_bp_cmd("breakpoints", 0, "info breakpoints Status of user-settable breakpoints", "long help of info breakpoints")); @@ -469,22 +473,116 @@ cmd->init();*/ "long help of info hardware")); cmd->add_name("hw"); cmd->init(); + cset->add(cmd= new cl_info_stack_cmd("stack", 0, +"info stack Status of stack of the CPU", +"long help of info stack")); + cmd->init(); + cset->add(cmd= new cl_info_memory_cmd("memory", 0, +"info memory Information about memory system", +"long help of info memory")); + cmd->init(); } - cmdset->add(cmd= new cl_super_cmd("info", 0, + if (!super_cmd) { + cmdset->add(cmd= new cl_super_cmd("info", 0, "info subcommand Information, see `info' command for more help", "long help of info", cset)); - cmd->init(); + cmd->init(); + } - cmdset->add(cmd= new cl_timer_cmd("timer", 0, -"timer a|d|g|r|s|v id [direction|value]\n" -" Timer add|del|get|run|stop|value", -"timer add|create|make id [direction] -- create a new timer\n" -"timer del id -- delete a timer\n" -"timer get id -- list timers\n" -"timer run id -- turn a timer ON\n" -"timer stop id -- turn a timer OFF\n" -"timer value id val -- set value of a timer to `val'")); - cmd->init(); + { + super_cmd= (class cl_super_cmd *)(cmdset->get_cmd("timer")); + if (super_cmd) + cset= super_cmd->get_subcommands(); + else { + cset= new cl_cmdset(); + cset->init(); + } + cset->add(cmd= new cl_timer_add_cmd("add", 0, +"timer add id [direction [in_isr]]\n" +" Create a clock counter (timer)", +"log help of timer add")); + cmd->init(); + cmd->add_name("create"); + cmd->add_name("make"); + cset->add(cmd= new cl_timer_delete_cmd("delete", 0, +"timer delete id Delete a timer", +"long help of timer delete")); + cmd->init(); + cmd->add_name("remove"); + cset->add(cmd= new cl_timer_get_cmd("get", 0, +"timer get [id] Get value of a timer, or all", +"long help of timer get")); + cmd->init(); + cset->add(cmd= new cl_timer_run_cmd("run", 0, +"timer start id Start a timer", +"long help of timer run")); + cmd->init(); + cmd->add_name("start"); + cset->add(cmd= new cl_timer_stop_cmd("stop", 0, +"timer stop id Stop a timer", +"long help of timer stop")); + cmd->init(); + cset->add(cmd= new cl_timer_value_cmd("set", 0, +"timer set id value\n" +" Set a timer value", +"long help of timer set")); + cmd->init(); + cmd->add_name("value"); + } + if (!super_cmd) { + cmdset->add(cmd= new cl_super_cmd("timer", 0, +"timer subcommand Manage timers", +"long help of timer", cset)); + cmd->init(); + } + + { + super_cmd= (class cl_super_cmd *)(cmdset->get_cmd("memory")); + if (super_cmd) + cset= super_cmd->get_subcommands(); + else { + cset= new cl_cmdset(); + cset->init(); + } + /* + cset->add(cmd= new cl_memory_cmd("_no_parameters_", 0, +"memory Information about memory system", +"long help of memory")); + cmd->init(); + */ + cset->add(cmd= new cl_memory_createchip_cmd("createchip", 0, +"memory createchip id size cellsize\n" +" Create a new memory chip", +"long help of memory createchip")); + cmd->init(); + cmd->add_name("cchip"); + cset->add(cmd= new cl_memory_createaddressspace_cmd("createaddressspace", 0, +"memory createaddressspace id startaddr size\n" +" Create address space", +"long help of memory createaddressspace")); + cmd->init(); + cmd->add_name("createaddrspace"); + cmd->add_name("createaspace"); + cmd->add_name("caddressspace"); + cmd->add_name("caddrspace"); + cmd->add_name("caspace"); + cset->add(cmd= new cl_memory_createaddressdecoder_cmd("createaddressdecoder", 0, +"memory createaddressdecoder addressspace begin end chip begin\n" +" Create address decoder", +"long help of memory createaddressdecoder")); + cmd->init(); + cmd->add_name("createaddrdecoder"); + cmd->add_name("createadecoder"); + cmd->add_name("caddressdecoder"); + cmd->add_name("caddrdecoder"); + cmd->add_name("cadecoder"); + } + if (!super_cmd) { + cmdset->add(cmd= new cl_super_cmd("memory", 0, +"memory subcommand Manage memory chips and address spaces", +"long help of memory", cset)); + cmd->init(); + } } @@ -493,100 +591,104 @@ cmd->init();*/ */ t_mem -cl_uc::read_mem(enum mem_class type, t_addr addr) +cl_uc::read_mem(char *id, t_addr addr) { - class cl_mem *m; + class cl_address_space *m= address_space(id); - if ((m= (class cl_mem*)mems->at(type)) == 0) - m= (class cl_mem*)(mems->at(MEM_DUMMY)); - return(m->read(addr)); + return(m?(m->read(addr)):0); } t_mem -cl_uc::get_mem(enum mem_class type, t_addr addr) +cl_uc::get_mem(char *id, t_addr addr) { - class cl_mem *m; + class cl_address_space *m= address_space(id); - if ((m= (class cl_mem*)mems->at(type)) == 0) - m= (class cl_mem*)(mems->at(MEM_DUMMY)); - return(m->get(addr)); + return(m?(m->get(addr)):0); } void -cl_uc::write_mem(enum mem_class type, t_addr addr, t_mem val) +cl_uc::write_mem(char *id, t_addr addr, t_mem val) { - class cl_mem *m; + class cl_address_space *m= address_space(id); - if ((m= (class cl_mem*)mems->at(type)) == 0) - m= (class cl_mem*)(mems->at(MEM_DUMMY)); - m->write(addr, val); + if (m) + m->write(addr, val); } void -cl_uc::set_mem(enum mem_class type, t_addr addr, t_mem val) +cl_uc::set_mem(char *id, t_addr addr, t_mem val) { - class cl_mem *m; + class cl_address_space *m= address_space(id); - if ((m= (class cl_mem*)mems->at(type)) == 0) - m= (class cl_mem*)(mems->at(MEM_DUMMY)); - m->set(addr, val); + if(m) + m->set(addr, val); } -class cl_mem * + +/* +class cl_memory * cl_uc::mem(enum mem_class type) { - class cl_mem *m; + class cl_m *m; if (mems->count < type) - m= (class cl_mem *)(mems->at(MEM_DUMMY)); + m= (class cl_m *)(mems->at(MEM_DUMMY)); else - m= (class cl_mem *)(mems->at(type)); + m= (class cl_m *)(mems->at(type)); return(m); } +*/ -class cl_mem * -cl_uc::mem(char *class_name) +class cl_address_space * +cl_uc::address_space(char *id) { - int i, found= 0; - char *mcn, *n, *s; + int i; - if (!class_name) + if (!id || + !(*id)) return(0); - s= n= strdup(class_name); - while (*s) + for (i= 0; i < address_spaces->count; i++) { - *s= toupper(*s); - s++; + class cl_address_space *m= (cl_address_space *)(address_spaces->at(i)); + if (!m || + !m->have_real_name()) + continue; + if (m->is_inamed(id)) + return(m); } - if (!class_name || - !(*class_name)) + return(0); +} + +class cl_memory * +cl_uc::memory(char *id) +{ + int i; + + if (!id || + !(*id)) return(0); - for (i= 0; !found && i < mems->count; i++) + for (i= 0; i < address_spaces->count; i++) { - cl_mem *m= (cl_mem *)(mems->at(i)); + class cl_memory *m= (cl_memory *)(address_spaces->at(i)); if (!m || - !m->class_name || - !(*(m->class_name))) + !m->have_real_name()) continue; - s= mcn= strdup(m->class_name); - while (*s) - { - *s= toupper(*s); - s++; - } - if (strstr(/*m->class_name*/mcn,/*class_name*/n) == /*m->class_name*/mcn) - found= 1; - free(mcn); - if (found) - { - free(n); - return(m); - } + if (m->is_inamed(id)) + return(m); + } + for (i= 0; i < memchips->count; i++) + { + class cl_memory *m= (cl_memory *)(memchips->at(i)); + if (!m || + !m->have_real_name()) + continue; + if (m->is_inamed(id)) + return(m); } - free(n); return(0); } + static long ReadInt(FILE *f, bool *ok, int bytes) { @@ -632,6 +734,13 @@ cl_uc::read_hex_file(const char *nam) bool ok, get_low= 1; uchar low= 0, high; + if (!rom) + { + sim->app->get_commander()-> + dd_printf("No ROM address space to read in.\n"); + return(-1); + } + if (!nam) { sim->app->get_commander()-> @@ -676,17 +785,17 @@ cl_uc::read_hex_file(const char *nam) { if (rtyp == 0) { - if (get_mem_width(MEM_ROM) > 8) + if (rom->width > 8) addr/= 2; for (i= 0; i < dnum; i++) { - if (get_mem_width(MEM_ROM) <= 8) + if (rom->width <= 8) { - set_mem(MEM_ROM, addr, rec[i]); + rom->set(addr, rec[i]); addr++; written++; } - else if (get_mem_width(MEM_ROM) <= 16) + else if (rom->width <= 16) { if (get_low) { @@ -696,7 +805,7 @@ cl_uc::read_hex_file(const char *nam) else { high= rec[i]; - set_mem(MEM_ROM, addr, (high*256)+low); + rom->set(addr, (high*256)+low); addr++; written++; get_low= 1; @@ -705,31 +814,25 @@ cl_uc::read_hex_file(const char *nam) } } else - if (sim->app->args->get_iarg('V', 0) && - rtyp != 1) - sim->app->get_commander()-> - dd_printf("Unknown record type %d(0x%x)\n", rtyp, rtyp); + if (rtyp != 1) + application->debug("Unknown record type %d(0x%x)\n", + rtyp, rtyp); } else - if (sim->app->args->get_iarg('V', 0)) - sim->app->get_commander()-> - dd_printf("Checksum error (%x instead of %x) in " - "record %ld.\n", chk, sum, recnum); + application->debug("Checksum error (%x instead of %x) in " + "record %ld.\n", chk, sum, recnum); } else - if (sim->app->args->get_iarg('V', 0)) - sim->app->get_commander()-> - dd_printf("Read error in record %ld.\n", recnum); + application->debug("Read error in record %ld.\n", recnum); } } - if (get_mem_width(MEM_ROM) > 8 && + if (rom->width > 8 && !get_low) - set_mem(MEM_ROM, addr, low); + rom->set(addr, low); if (nam) fclose(f); - if (sim->app->args->get_iarg('V', 0)) - sim->app->get_commander()->dd_printf("%ld records have been read\n", recnum); + application->debug("%ld records have been read\n", recnum); analyze(0); return(written); } @@ -747,45 +850,33 @@ cl_uc::read_hex_file(const char *nam) bool cl_uc::inst_at(t_addr addr) { - class cl_mem/*rom*/ *rom= /*(class cl_rom *)*/mem(MEM_ROM); - if (!rom) return(0); - //return(rom->inst_map->get(addr)); return(rom->get_cell_flag(addr, CELL_INST)); } void cl_uc::set_inst_at(t_addr addr) { - class cl_mem/*rom*/ *rom= /*(class cl_rom *)*/mem(MEM_ROM); - if (rom) - //rom->inst_map->set(addr); rom->set_cell_flag(addr, DD_TRUE, CELL_INST); } void cl_uc::del_inst_at(t_addr addr) { - class cl_mem/*rom*/ *rom= /*(class cl_rom *)*/mem(MEM_ROM); - if (rom) - //rom->inst_map->clear(addr); rom->set_cell_flag(addr, DD_FALSE, CELL_INST); } bool cl_uc::there_is_inst(void) { - class cl_mem/*rom*/ *rom= /*(class cl_rom *)*/mem(MEM_ROM); - if (!rom) return(0); - //return(!(rom->inst_map->empty())); bool got= DD_FALSE; t_addr addr; - for (addr= 0; addr < rom->size && !got; addr++) + for (addr= 0; rom->valid_address(addr) && !got; addr++) got= rom->get_cell_flag(addr, CELL_INST); return(got); } @@ -801,10 +892,10 @@ cl_uc::there_is_inst(void) /*void cl_uc::register_hw_read(enum mem_class type, t_addr addr, class cl_hw *hw) { - class cl_mem *m; + class cl_m *m; class cl_memloc *l; - if ((m= (class cl_mem*)mems->at(type))) + if ((m= (class cl_m*)mems->at(type))) { if ((l= m->read_locs->get_loc(addr)) == 0) { @@ -951,11 +1042,11 @@ cl_uc::print_disass(t_addr addr, class cl_console *con) char *dis; class cl_brk *b; int i; - class cl_mem *rom= mem(MEM_ROM); - t_mem code= get_mem(MEM_ROM, addr); if (!rom) return; + + t_mem code= rom->get(addr); b= fbrk_at(addr); dis= disass(addr, NULL); if (b) @@ -968,7 +1059,7 @@ cl_uc::print_disass(t_addr addr, class cl_console *con) for (i= 1; i < inst_length(addr); i++) { con->dd_printf(" "); - con->dd_printf(rom->data_format, get_mem(MEM_ROM, addr+i)); + con->dd_printf(rom->data_format, rom->get(addr+i)); } int li= longest_inst(); while (i < li) @@ -996,7 +1087,10 @@ cl_uc::inst_length(t_addr addr) int i; t_mem code; - code = get_mem(MEM_ROM, addr); + if (!rom) + return(0); + + code = rom->get(addr); for (i= 0; tabl[i].mnemonic && (code & tabl[i].mask) != tabl[i].code; i++) ; return(tabl[i].mnemonic?tabl[i].length:1); } @@ -1008,7 +1102,10 @@ cl_uc::inst_branch(t_addr addr) int i; t_mem code; - code = get_mem(MEM_ROM, addr); + if (!rom) + return(0); + + code = rom->get(addr); for (i= 0; tabl[i].mnemonic && (code & tabl[i].mask) != tabl[i].code; i++) ; return tabl[i].branch; @@ -1045,9 +1142,32 @@ cl_uc::get_name(t_addr addr, struct name_entry tab[], char *buf) return(tab[i].name != NULL); } +bool +cl_uc::symbol2address(char *sym, struct name_entry tab[], + t_addr *addr) +{ + int i; + + if (!sym || + !*sym) + return(DD_FALSE); + i= 0; + while (tab[i].name && + (!(tab[i].cpu_type & type) || + strcasecmp(sym, tab[i].name) != 0)) + i++; + if (tab[i].name) + { + if (addr) + *addr= tab[i].addr; + return(DD_TRUE); + } + return(DD_FALSE); +} + char * cl_uc::symbolic_bit_name(t_addr bit_address, - class cl_mem *mem, + class cl_memory *mem, t_addr mem_addr, t_mem bit_mask) { @@ -1065,8 +1185,8 @@ cl_uc::symbolic_bit_name(t_addr bit_address, } if (mem && - mem->class_name && - strstr(mem->class_name, "sfr") == mem->class_name) + mem->have_real_name() && + strstr(mem->get_name(), "sfr") == mem->get_name()) { i= 0; while (sfr_tbl()[i].name && @@ -1101,8 +1221,33 @@ cl_uc::symbolic_bit_name(t_addr bit_address, * Messages to broadcast */ +bool +cl_uc::handle_event(class cl_event &event) +{ + switch (event.what) + { + case ev_address_space_added: + { + try { + class cl_event_address_space_added &e= + dynamic_cast(event); + address_space_added(e.as); + e.handle(); + } + catch (...) + { break; } + break; + } + default: + return(pass_event_down(event)); + break; + } + return(DD_FALSE); +} + +/* void -cl_uc::mem_cell_changed(class cl_mem *mem, t_addr addr) +cl_uc::mem_cell_changed(class cl_address_space *mem, t_addr addr) { if (hws) hws->mem_cell_changed(mem, addr); @@ -1117,6 +1262,16 @@ cl_uc::mem_cell_changed(class cl_mem *mem, t_addr addr) } } } +*/ + +void +cl_uc::address_space_added(class cl_address_space *as) +{ + if (hws) + hws->address_space_added(as); + else + printf("JAJ uc\n");//FIXME +} /* @@ -1136,13 +1291,17 @@ cl_uc::check_errors(void) { int i; class cl_commander *c= sim->app->get_commander(); + bool must_stop= DD_FALSE; if (c) { for (i= 0; i < errors->count; i++) { class cl_error *error= (class cl_error *)(errors->at(i)); + if (!error->is_on()) + continue; error->print(c); + must_stop= must_stop || (error->get_type() & err_stop); if (error->inst) { class cl_console *con; @@ -1150,13 +1309,18 @@ cl_uc::check_errors(void) if (!con) con= c->frozen_console; if (con) - print_disass(error->PC, con); + { + con->dd_printf("Erronouse instruction: "); + print_disass(error->PC, con); + } } } errors->free_all(); } else fprintf(stderr, "no actual console, %d errors\n", errors->count); + if (must_stop) + sim->stop(resERROR); } @@ -1164,7 +1328,7 @@ cl_uc::check_errors(void) * Converting bit address into real memory */ -class cl_mem * +class cl_address_space * cl_uc::bit2mem(t_addr bitaddr, t_addr *memaddr, t_mem *bitmask) { if (memaddr) @@ -1323,11 +1487,12 @@ t_mem cl_uc::fetch(void) { ulong code; + + if (!rom) + return(0); - code= read_mem(MEM_ROM, PC); - PC++; - if (PC >= get_mem_size(MEM_ROM)) - PC= 0; + code= rom->read(PC); + PC= rom->inc_address(PC); return(code); } @@ -1344,9 +1509,10 @@ cl_uc::fetch(t_mem *code) if (!code) return(0); - if (sim->state & SIM_GO) + if ((sim->state & SIM_GO) && + rom) { - if (mem(MEM_ROM)->get_cell_flag(PC, CELL_FETCH_BRK) && + if (rom->get_cell_flag(PC, CELL_FETCH_BRK) && (brk= fbrk->get_bp(PC, &idx)) && (brk->do_hit())) { @@ -1431,35 +1597,103 @@ cl_uc::clock_per_cycle(void) */ void -cl_uc::st_push(class cl_stack_op *op) +cl_uc::stack_write(class cl_stack_op *op) { - st_ops->push(op); + if (op->get_op() & stack_read_operation) + { + class cl_error_stack_tracker_wrong_handle *e= new + cl_error_stack_tracker_wrong_handle(DD_FALSE); + //fprintf(stderr, "%06"_A_"x cl_uc::stack_read() should be called for " + //"%s\n", op->get_pc(), op->get_op_name()); + e->init(); + error(e); + return; + } + stack_ops->push(op); } void -cl_uc::st_call(class cl_stack_op *op) +cl_uc::stack_read(class cl_stack_op *op) { - st_ops->push(op); -} - -int -cl_uc::st_pop(class cl_stack_op *op) -{ - class cl_stack_op *sop= (class cl_stack_op *)(st_ops->pop()); - - if (!sop) - return(1); - return(0); -} + class cl_stack_op *top= (class cl_stack_op *)(stack_ops->top()); + + if (op->get_op() & stack_write_operation) + { + class cl_error_stack_tracker_wrong_handle *e= new + cl_error_stack_tracker_wrong_handle(DD_TRUE); + e->init(); + error(e); + //fprintf(stderr, "%06"_A_"x cl_uc::stack_write() should be called for " + //"%s\n", op->get_pc(), op->get_op_name()); + return; + } + if (!top) + { + class cl_error *e= new cl_error_stack_tracker_empty(op); + /*printf("0x%06"_A_"x %s operation on stack but no operation was before\n + ", + op->get_pc(), op->get_op_name());*/ + e->init(); + error(e); + return; + } -int -cl_uc::st_ret(class cl_stack_op *op) -{ - class cl_stack_op *sop= (class cl_stack_op *)(st_ops->pop()); + if (top) + { + if (!top->match(op)) + { + class cl_error *e= new cl_error_stack_tracker_unmatch(top, op); + e->init(); + error(e); + /*printf("0x%06"_A_"x %s operation on stack but last was %s\n", + op->get_pc(), op->get_op_name(), top->get_op_name());*/ + } + int top_size= top->data_size(), op_size= op->data_size(); + if (top_size != op_size) + { + application->debug("0x%06"_A_"x %d bytes to read out of stack " + "but %d was pushed in last operation\n", + op->get_pc(), op_size, top_size); + } + } - if (!sop) - return(1); - return(0); + int removed= 0; + while (top && + top->can_removed(op)) + { + top= (class cl_stack_op *)stack_ops->pop(); + delete top; + top= (class cl_stack_op *)stack_ops->top(); + removed++; + } + if (removed != 1) + { + application->debug("0x%06"_A_"x %d ops removed from stack-tracker " + "when %s happened, top pc=0x%06"_A_"x " + "top before=0x%06"_A_"x op after=0x%06"_A_"x\n", + op->get_pc(), removed, op->get_op_name(), + top?(top->get_pc()):0, top?(top->get_before()):0, + op->get_after()); + } + + if (top) + { + int ta= top->get_after(), oa= op->get_after(); + if (ta != oa) + { + application->debug("0x%06"_A_"x stack still inconsistent after %s, " + "%d byte(s) should be read out; top after" + "=0x%06"_A_"x op after=0x%06"_A_"x\n", + op->get_pc(), op->get_op_name(), abs(ta-oa), + ta, oa); + class cl_error *e= + new cl_error_stack_tracker_inconsistent(op, abs(ta-oa)); + e->init(); + error(e); + } + } + + delete op; } @@ -1590,7 +1824,7 @@ cl_uc::make_new_brknr(void) } class cl_ev_brk * -cl_uc::mk_ebrk(enum brk_perm perm, class cl_mem *mem, +cl_uc::mk_ebrk(enum brk_perm perm, class cl_address_space *mem, char op, t_addr addr, int hit) { class cl_ev_brk *b; @@ -1604,8 +1838,47 @@ cl_uc::mk_ebrk(enum brk_perm perm, class cl_mem *mem, void cl_uc::check_events(void) { + int i; + for (i= 0; i < events->count; i++) + { + class cl_ev_brk *brk= + dynamic_cast(events->object_at(i)); + sim->stop(brk); + } sim->stop(resBREAKPOINT); } +/* + * Errors + *---------------------------------------------------------------------------- + */ + +ERROR_CLASS_DEF_PARENT_ON(err_error, unknown_code, "unknown_code", + error_class_base, ERROR_ON); + +cl_error_unknown_code::cl_error_unknown_code(class cl_uc *the_uc) +{ + uc= the_uc; + classification= &error_unknown_code_class; +} + +void +cl_error_unknown_code::print(class cl_commander *c) +{ + c->dd_printf(get_type_name()); + c->dd_printf(": unknown instruction code at "); + if (uc->rom) + { + c->dd_printf(uc->rom->addr_format, PC); + c->dd_printf(" ("); + c->dd_printf(uc->rom->data_format, uc->rom->get(PC)); + c->dd_printf(")"); + } + else + c->dd_printf("0x%06x", PC); + c->dd_printf("\n"); +} + + /* End of uc.cc */ diff --git a/sim/ucsim/sim.src/uccl.h b/sim/ucsim/sim.src/uccl.h index 0b1883b2..41327401 100644 --- a/sim/ucsim/sim.src/uccl.h +++ b/sim/ucsim/sim.src/uccl.h @@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "hwcl.h" #include "memcl.h" #include "brkcl.h" +#include "stackcl.h" /* Counter to count clock ticks */ @@ -61,6 +62,16 @@ public: }; +/* Options of the microcontroller */ +class cl_xtal_option: public cl_optref +{ +protected: + class cl_uc *uc; +public: + cl_xtal_option(class cl_uc *the_uc); + virtual void option_changed(void); +}; + /* Abstract microcontroller */ class cl_uc: public cl_base @@ -70,6 +81,7 @@ public: int technology; // CMOS, HMOS int state; // GO, IDLE, PD //class cl_list *options; + class cl_xtal_option *xtal_option; t_addr PC, instPC; // Program Counter bool inst_exec; // Instruction is executed @@ -84,12 +96,18 @@ public: class brk_coll *fbrk; // Collection of FETCH break-points class brk_coll *ebrk; // Collection of EVENT breakpoints class cl_sim *sim; - class cl_list *mems; + //class cl_list *mems; class cl_hws *hws; + + class cl_list *memchips; // v3 + class cl_address_space_list *address_spaces; + class cl_address_space *rom; // Required for almost every uc + + //class cl_list *address_decoders; class cl_irqs *it_sources; // Sources of interrupts class cl_list *it_levels; // Follow interrupt services - class cl_list *st_ops; // Track stack operations + class cl_list *stack_ops; // Track stack operations class cl_list *errors; // Errors of instruction execution class cl_list *events; // Events happened during inst exec @@ -105,19 +123,20 @@ public: virtual void reset(void); // making objects - virtual class cl_mem *mk_mem(enum mem_class type, char *class_name); - virtual t_addr get_mem_size(enum mem_class type); - virtual int get_mem_width(enum mem_class type); + //virtual class cl_m *mk_mem(enum mem_class type, char *class_name); + virtual void make_memories(void); + //virtual t_addr get_mem_size(char *id); + //virtual int get_mem_width(char *id); virtual void mk_hw_elements(void); virtual void build_cmdset(class cl_cmdset *cmdset); // manipulating memories - virtual t_mem read_mem(enum mem_class type, t_addr addr); - virtual t_mem get_mem(enum mem_class type, t_addr addr); - virtual void write_mem(enum mem_class type, t_addr addr, t_mem val); - virtual void set_mem(enum mem_class type, t_addr addr, t_mem val); - virtual class cl_mem *mem(enum mem_class type); - virtual class cl_mem *mem(char *class_name); + virtual t_mem read_mem(char *id, t_addr addr); + virtual t_mem get_mem(char *id, t_addr addr); + virtual void write_mem(char *id, t_addr addr, t_mem val); + virtual void set_mem(char *id, t_addr addr, t_mem val); + virtual class cl_address_space *address_space(char *id); + virtual class cl_memory *memory(char *id); // file handling virtual long read_hex_file(const char *nam); @@ -159,10 +178,8 @@ public: virtual int it_priority(uchar ie_mask) {return(0);} // stack tracking - virtual void st_push(class cl_stack_op *op); - virtual void st_call(class cl_stack_op *op); - virtual int st_pop(class cl_stack_op *op); - virtual int st_ret(class cl_stack_op *op); + virtual void stack_write(class cl_stack_op *op); + virtual void stack_read(class cl_stack_op *op); // breakpoints virtual class cl_fetch_brk *fbrk_at(t_addr addr); @@ -174,7 +191,8 @@ public: virtual void put_breaks(void); virtual void remove_all_breaks(void); virtual int make_new_brknr(void); - virtual class cl_ev_brk *mk_ebrk(enum brk_perm perm, class cl_mem *mem, + virtual class cl_ev_brk *mk_ebrk(enum brk_perm perm, + class cl_address_space *mem, char op, t_addr addr, int hit); virtual void check_events(void); @@ -189,17 +207,25 @@ public: virtual int inst_branch(t_addr addr); virtual int longest_inst(void); virtual bool get_name(t_addr addr, struct name_entry tab[], char *buf); + virtual bool symbol2address(char *sym, struct name_entry tab[], + t_addr *addr); virtual char *symbolic_bit_name(t_addr bit_address, - class cl_mem *mem, + class cl_memory *mem, t_addr mem_addr, t_mem bit_mask); /* Converting abstract address spaces into real ones */ - virtual class cl_mem *bit2mem(t_addr bitaddr, - t_addr *memaddr, t_mem *bitmask); - + virtual class cl_address_space *bit2mem(t_addr bitaddr, + t_addr *memaddr, + t_mem *bitmask); + virtual t_addr bit_address(class cl_memory *mem, + t_addr mem_address, + int bit_number) { return(-1); } + // messages from app to handle and broadcast - virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); + virtual bool handle_event(class cl_event &event); + //virtual void mem_cell_changed(class cl_address_space *mem, t_addr addr); + virtual void address_space_added(class cl_address_space *as); // Error handling virtual void error(class cl_error *error); @@ -213,6 +239,23 @@ public: }; +/* + * Errors + */ + +#include "errorcl.h" + +ERROR_CLASS_DECL(unknown_code): public cl_error +{ + protected: + class cl_uc *uc; + public: + cl_error_unknown_code(class cl_uc *the_uc); + + virtual void print(class cl_commander *c); +}; + + #endif /* End of uccl.h */ diff --git a/sim/ucsim/stypes.h b/sim/ucsim/stypes.h index a264f6ab..a80b241f 100644 --- a/sim/ucsim/stypes.h +++ b/sim/ucsim/stypes.h @@ -31,12 +31,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ddconfig.h" -typedef unsigned char uchar; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef TYPE_UDWORD t_addr; /* 32 bit max */ -typedef TYPE_UWORD t_mem; /* 16 bit max */ -typedef TYPE_WORD t_smem; /* signed 16 bit memory */ +typedef unsigned char uchar; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef TYPE_DWORD t_addr; /* 32 bit max */ +typedef TYPE_UWORD t_mem; /* 16 bit max */ +typedef TYPE_WORD t_smem; /* signed 16 bit memory */ struct id_element { @@ -44,6 +44,12 @@ struct id_element char *id_string; }; +enum error_type { + err_unknown = 0x01, + err_error = 0x02, + err_warning = 0x04 +}; + // table of dissassembled instructions struct dis_entry { @@ -56,9 +62,9 @@ struct dis_entry // table entry of SFR and BIT names struct name_entry { - int cpu_type; - uint addr; - char *name; + int cpu_type; + t_addr addr; + char *name; }; @@ -90,8 +96,8 @@ struct cpu_entry #define CPU_XA 0x0001 #define CPU_ALL_XA (CPU_XA) -#define CPU_HC08 0x0001 -#define CPU_ALL_HC08 (CPU_HC08) +#define CPU_HC08 0x0001 +#define CPU_ALL_HC08 (CPU_HC08) #define CPU_CMOS 0x0001 #define CPU_HMOS 0x0002 @@ -108,6 +114,12 @@ enum mem_class MEM_TYPES }; +#define MEM_ROM_ID "rom" +#define MEM_SFR_ID "sfr" +#define MEM_XRAM_ID "xram" +#define MEM_IXRAM_ID "ixram" +#define MEM_IRAM_ID "iram" + // States of simulator #define SIM_NONE 0 #define SIM_GO 0x01 // Processor is running @@ -130,16 +142,17 @@ enum mem_class #define resUSER 105 /* Stopped by user */ #define resINV_INST 106 /* Invalid instruction */ #define resBITADDR 107 /* Bit address is uninterpretable */ +#define resERROR 108 /* Error happened during instruction exec */ #define BIT_MASK(bitaddr) (1 << (bitaddr & 0x07)) -#define IRAM_SIZE 256 /* Size of Internal RAM */ -#define SFR_SIZE 256 /* Size of SFR area */ -#define SFR_START 128 /* Start address of SFR area */ -#define ERAM_SIZE 256 /* Size of ERAM in 51R */ -#define XRAM_SIZE 0x10000 /* Size of External RAM */ +//#define IRAM_SIZE 256 /* Size of Internal RAM */ +//#define SFR_SIZE 256 /* Size of SFR area */ +//#define SFR_START 128 /* Start address of SFR area */ +//#define ERAM_SIZE 256 /* Size of ERAM in 51R */ +//#define XRAM_SIZE 0x10000 /* Size of External RAM */ //#define IROM_SIZE 0x1000 /* Size of Internal ROM */ -#define EROM_SIZE 0x10000 /* Size of External ROM */ +//#define EROM_SIZE 0x10000 /* Size of External ROM */ /* Type of breakpoints */ @@ -211,6 +224,14 @@ enum hw_event { #define HWF_MISC 0x0004 +/* Letter cases */ +enum letter_case { + case_upper, /* all is upper case */ + case_lower, /* all is lower case */ + case_case /* first letter is upper, others are lower case */ +}; + + #endif /* End of stypes.h */ diff --git a/sim/ucsim/utils.cc b/sim/ucsim/utils.cc index 1a410ebb..b7a625d3 100644 --- a/sim/ucsim/utils.cc +++ b/sim/ucsim/utils.cc @@ -182,4 +182,48 @@ object_name(class cl_base *o) } +char * +case_string(enum letter_case lcase, char *str) +{ + char *p= strdup(str); + char *s= p; + + switch (lcase) + { + case case_upper: + while (p && *p) { + *p= toupper(*p); + p++; + } + break; + case case_lower: + while (p && *p) { + *p= tolower(*p); + p++; + } + break; + case case_case: + if (!p || *p == '\0') + break; + while (isspace(*p)) p++; + if (*p) + *p= toupper(*p); + break; + } + return(s); +} + +/*char * +case_string(enum letter_case lcase, const char *str) +{ + char *p= NIL; + + if (!str || + !*str) + return(NIL); + p= strdup(str); + return case_string(lcase, p); +}*/ + + /* End of utils.cc */ diff --git a/sim/ucsim/utils.h b/sim/ucsim/utils.h index 3b17fd10..9a70db0f 100644 --- a/sim/ucsim/utils.h +++ b/sim/ucsim/utils.h @@ -30,6 +30,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include +// prj +#include "stypes.h" + extern int get_sub_opt(char **option, const char * const *tokens, @@ -41,6 +44,7 @@ extern int get_string_id(struct id_element *ids, char *str, int def); extern char *format_string(char *format, ...); extern void print_char_octal(char c, FILE *f); extern char *object_name(class cl_base *o); +extern char *case_string(enum letter_case lcase, char *str); #endif diff --git a/sim/ucsim/xa.src/Makefile.in b/sim/ucsim/xa.src/Makefile.in index de623682..6e682f97 100644 --- a/sim/ucsim/xa.src/Makefile.in +++ b/sim/ucsim/xa.src/Makefile.in @@ -15,7 +15,7 @@ INSTALL = @INSTALL@ PRJDIR = .. -EXEEXT = @EXEEXT@ +EXEEXT = @EXEEXT@ DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@) CPPFLAGS = @CPPFLAGS@ -I. -I$(PRJDIR) \ @@ -24,7 +24,7 @@ CFLAGS = @CFLAGS@ -Wall CXXFLAGS = @CXXFLAGS@ -Wall M_OR_MM = @M_OR_MM@ -LIBS = @LIBS@ -L$(PRJDIR) -lsim -lutil -lcmd -lguiucsim +LIBS = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lutil -lcmd -lsim -lguiucsim -Wl,--end-group prefix = @prefix@ exec_prefix = @exec_prefix@ diff --git a/sim/ucsim/xa.src/xa.cc b/sim/ucsim/xa.src/xa.cc index da7ed0fc..35be697a 100644 --- a/sim/ucsim/xa.src/xa.cc +++ b/sim/ucsim/xa.src/xa.cc @@ -59,8 +59,8 @@ int cl_xa::init(void) { cl_uc::init(); /* Memories now exist */ - ram= mem(MEM_XRAM); - rom= mem(MEM_ROM); + ram= address_space(MEM_XRAM_ID); + rom= address_space(MEM_ROM_ID); /* set SCR to osc/4, native XA mode, flat 24 */ set_scr(0); @@ -76,16 +76,18 @@ cl_xa::init(void) return(0); } -class cl_mem * +/* +class cl_m * cl_xa::mk_mem(enum mem_class type, char *class_name) { - class cl_mem *m= cl_uc::mk_mem(type, class_name); + class cl_m *m= cl_uc::mk_mem(type, class_name); if (type == MEM_SFR) sfr= m; if (type == MEM_IRAM) iram= m; return(m); } +*/ char * cl_xa::id_string(void) @@ -97,20 +99,21 @@ cl_xa::id_string(void) /* * Making elements of the controller */ - +/* t_addr cl_xa::get_mem_size(enum mem_class type) { switch(type) { case MEM_IRAM: return(0x2000); - case MEM_SFR: return(0x2000); - case MEM_ROM: return(0x10000); + case MEM_SFR: return(0x2000); + case MEM_ROM: return(0x10000); case MEM_XRAM: return(0x10000); default: return(0); } return(cl_uc::get_mem_size(type)); } +*/ void cl_xa::mk_hw_elements(void) @@ -119,6 +122,60 @@ cl_xa::mk_hw_elements(void) /* t_uc::mk_hw() does nothing */ } +void +cl_xa::make_memories(void) +{ + class cl_address_space *as; + + as= rom= new cl_address_space("rom", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + as= iram= new cl_address_space("iram", 0, 0x2000, 8); + as->init(); + address_spaces->add(as); + as= sfr= new cl_address_space("sfr", 0x0, 0x2000, 8); + as->init(); + address_spaces->add(as); + as= ram= new cl_address_space("xram", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("iram_chip", 0x2000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("iram"), chip, 0, 0x1fff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("xram_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("xram"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); + + chip= new cl_memory_chip("sfr_chip", 0x2000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("sfr"), chip, 0x0, 0x1fff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); +} + /* * Help command interpreter @@ -220,14 +277,14 @@ cl_xa::get_disasm_info(t_addr addr, int i; int start_addr = addr; - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); if (code == 0x00) { i= 0; while (disass_xa[i].mnemonic != NOP) i++; } else { len = 2; - code = (code << 8) | get_mem(MEM_ROM, addr++); + code = (code << 8) | get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_xa[i].mask) != disass_xa[i].code && disass_xa[i].mnemonic != BAD_OPCODE) @@ -326,13 +383,13 @@ cl_xa::disass(t_addr addr, char *sep) sprintf(parm_str, "%s,[%s+%02x]", reg_strs[((code >> 4) & 0xf)], w_reg_strs[(code & 0x7)], - get_mem(MEM_ROM, addr+immed_offset)); + get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case IREGOFF8_REG : sprintf(parm_str, "[%s+%02x],%s", w_reg_strs[(code & 0x7)], - get_mem(MEM_ROM, addr+immed_offset), + get_mem(MEM_ROM_ID, addr+immed_offset), reg_strs[((code >> 4) & 0xf)] ); ++immed_offset; break; @@ -340,16 +397,16 @@ cl_xa::disass(t_addr addr, char *sep) sprintf(parm_str, "%s,[%s+%04x]", reg_strs[((code >> 4) & 0xf)], w_reg_strs[(code & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset)<<8)) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset)<<8)) ); ++immed_offset; ++immed_offset; break; case IREGOFF16_REG : sprintf(parm_str, "[%s+%04x],%s", w_reg_strs[(code & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset)<<8)), + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset)<<8)), reg_strs[((code >> 4) & 0xf)] ); ++immed_offset; ++immed_offset; @@ -367,7 +424,7 @@ cl_xa::disass(t_addr addr, char *sep) case DIRECT_REG : sprintf(parm_str, "%s,%s", get_dir_name(((code & 0x7) << 8) | - get_mem(MEM_ROM, addr+immed_offset)), + get_mem(MEM_ROM_ID, addr+immed_offset)), reg_strs[((code >> 4) & 0xf)] ); ++immed_offset; break; @@ -375,96 +432,96 @@ cl_xa::disass(t_addr addr, char *sep) sprintf(parm_str, "%s,%s", reg_strs[((code >> 4) & 0xf)], get_dir_name(((code & 0x7) << 8) | - get_mem(MEM_ROM, addr+immed_offset))); + get_mem(MEM_ROM_ID, addr+immed_offset))); ++immed_offset; break; case REG_DATA8 : sprintf(parm_str, "%s,#0x%02x", b_reg_strs[((code >> 4) & 0xf)], - get_mem(MEM_ROM, addr+immed_offset) ); + get_mem(MEM_ROM_ID, addr+immed_offset) ); ++immed_offset; break; case REG_DATA16 : sprintf(parm_str, "%s,#0x%04x", reg_strs[((code >> 4) & 0xf)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset)<<8)) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset)<<8)) ); ++immed_offset; ++immed_offset; break; case IREG_DATA8 : sprintf(parm_str, "[%s], 0x%02x", w_reg_strs[((code >> 4) & 0x7)], - get_mem(MEM_ROM, addr+immed_offset) ); + get_mem(MEM_ROM_ID, addr+immed_offset) ); ++immed_offset; break; case IREG_DATA16 : sprintf(parm_str, "[%s], 0x%04x", w_reg_strs[((code >> 4) & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset)<<8)) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset)<<8)) ); ++immed_offset; ++immed_offset; break; case IREGINC_DATA8 : sprintf(parm_str, "[%s+], 0x%02x", w_reg_strs[((code >> 4) & 0x7)], - get_mem(MEM_ROM, addr+immed_offset) ); + get_mem(MEM_ROM_ID, addr+immed_offset) ); ++immed_offset; break; case IREGINC_DATA16 : sprintf(parm_str, "[%s+], 0x%04x", w_reg_strs[((code >> 4) & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset)<<8)) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset)<<8)) ); ++immed_offset; ++immed_offset; break; case IREGOFF8_DATA8 : sprintf(parm_str, "[%s+%02x], 0x%02x", w_reg_strs[((code >> 4) & 0x7)], - get_mem(MEM_ROM, addr+immed_offset), - get_mem(MEM_ROM, addr+immed_offset+1) ); + get_mem(MEM_ROM_ID, addr+immed_offset), + get_mem(MEM_ROM_ID, addr+immed_offset+1) ); immed_offset += 2; break; case IREGOFF8_DATA16 : sprintf(parm_str, "[%s+%02x], 0x%04x", w_reg_strs[((code >> 4) & 0x7)], - get_mem(MEM_ROM, addr+immed_offset), - (short)((get_mem(MEM_ROM, addr+immed_offset+2)) | - (get_mem(MEM_ROM, addr+immed_offset+1)<<8)) ); + get_mem(MEM_ROM_ID, addr+immed_offset), + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+2)) | + (get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8)) ); immed_offset += 3; break; case IREGOFF16_DATA8 : sprintf(parm_str, "[%s+%04x], 0x%02x", w_reg_strs[((code >> 4) & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset+0)<<8)), - get_mem(MEM_ROM, addr+immed_offset+2) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset+0)<<8)), + get_mem(MEM_ROM_ID, addr+immed_offset+2) ); immed_offset += 3; break; case IREGOFF16_DATA16 : sprintf(parm_str, "[%s+%04x], 0x%04x", w_reg_strs[((code >> 4) & 0x7)], - (short)((get_mem(MEM_ROM, addr+immed_offset+1)) | - (get_mem(MEM_ROM, addr+immed_offset+0)<<8)), - (short)((get_mem(MEM_ROM, addr+immed_offset+3)) | - (get_mem(MEM_ROM, addr+immed_offset+2)<<8)) ); + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+1)) | + (get_mem(MEM_ROM_ID, addr+immed_offset+0)<<8)), + (short)((get_mem(MEM_ROM_ID, addr+immed_offset+3)) | + (get_mem(MEM_ROM_ID, addr+immed_offset+2)<<8)) ); immed_offset += 4; break; case DIRECT_DATA8 : sprintf(parm_str, "%s,#0x%02x", get_dir_name(((code & 0x0070) << 4) | - get_mem(MEM_ROM, addr+immed_offset)), - get_mem(MEM_ROM, addr+immed_offset+1)); + get_mem(MEM_ROM_ID, addr+immed_offset)), + get_mem(MEM_ROM_ID, addr+immed_offset+1)); immed_offset += 3; break; case DIRECT_DATA16 : sprintf(parm_str, "%s,#0x%04x", get_dir_name(((code & 0x0070) << 4) | - get_mem(MEM_ROM, addr+immed_offset)), - get_mem(MEM_ROM, addr+immed_offset+2) + - (get_mem(MEM_ROM, addr+immed_offset+1)<<8)); + get_mem(MEM_ROM_ID, addr+immed_offset)), + get_mem(MEM_ROM_ID, addr+immed_offset+2) + + (get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8)); immed_offset += 3; break; @@ -474,11 +531,11 @@ cl_xa::disass(t_addr addr, char *sep) break; case CY_BIT : sprintf(parm_str, "C,%s", - get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM, addr+2))); + get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM_ID, addr+2))); break; case BIT_CY : sprintf(parm_str, "%s,C", - get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM, addr+2))); + get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM_ID, addr+2))); break; case REG_DATA4 : strcpy(parm_str, "REG_DATA4"); @@ -501,13 +558,13 @@ cl_xa::disass(t_addr addr, char *sep) case DIRECT_DATA4 : sprintf(parm_str, "%s,#0x%x", get_dir_name(((code & 0x70)<<4) | - get_mem(MEM_ROM, addr+2)), + get_mem(MEM_ROM_ID, addr+2)), code&0x0f); break; case DIRECT : sprintf(parm_str, "%s", get_dir_name(((code & 0x007) << 4) + - get_mem(MEM_ROM, addr+2))); + get_mem(MEM_ROM_ID, addr+2))); break; case REG : sprintf(parm_str, "%s", @@ -519,33 +576,33 @@ cl_xa::disass(t_addr addr, char *sep) break; case BIT_ALONE : sprintf(parm_str, "%s", - get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM, addr+2))); + get_bit_name(((code&0x0003)<<8) + get_mem(MEM_ROM_ID, addr+2))); break; case BIT_REL8 : sprintf(parm_str, "%s,0x%04x", - get_bit_name((code&0x0003)<<8) + get_mem(MEM_ROM, addr+2), - ((signed char)get_mem(MEM_ROM, addr+3)*2+addr+len)&0xfffe); + get_bit_name((code&0x0003)<<8) + get_mem(MEM_ROM_ID, addr+2), + ((signed char)get_mem(MEM_ROM_ID, addr+3)*2+addr+len)&0xfffe); break; case DATA4: sprintf(parm_str, "#0x%02x", code&0x0f); break; case ADDR24 : sprintf(parm_str, "0x%06x", - (get_mem(MEM_ROM, addr+3)<<16) + - (get_mem(MEM_ROM, addr+1)<<8) + - get_mem(MEM_ROM, addr+2)); + (get_mem(MEM_ROM_ID, addr+3)<<16) + + (get_mem(MEM_ROM_ID, addr+1)<<8) + + get_mem(MEM_ROM_ID, addr+2)); break; break; case REG_REL8 : sprintf(parm_str, "%s,0x%04x", reg_strs[(code>>4) & 0xf], - ((signed char)get_mem(MEM_ROM, addr+2)*2+addr+len)&0xfffe); + ((signed char)get_mem(MEM_ROM_ID, addr+2)*2+addr+len)&0xfffe); break; case DIRECT_REL8 : sprintf(parm_str, "%s,0x%04x", get_dir_name(((code&0x07)<<8) + - get_mem(MEM_ROM, addr+2)), - ((signed char)get_mem(MEM_ROM, addr+2)*2+addr+len)&0xfffe); + get_mem(MEM_ROM_ID, addr+2)), + ((signed char)get_mem(MEM_ROM_ID, addr+2)*2+addr+len)&0xfffe); break; case REG_USP: sprintf(parm_str, "REG_USP"); @@ -555,11 +612,11 @@ cl_xa::disass(t_addr addr, char *sep) break; case REL8 : sprintf(parm_str, "0x%04x", - ((signed char)get_mem(MEM_ROM, addr+1)*2+addr+len)&0xfffe); + ((signed char)get_mem(MEM_ROM_ID, addr+1)*2+addr+len)&0xfffe); break; case REL16 : sprintf(parm_str, "0x%04x", - ((signed short)((get_mem(MEM_ROM, addr+1)<<8) + get_mem(MEM_ROM, addr+2))*2+addr+len)&0xfffe); + ((signed short)((get_mem(MEM_ROM_ID, addr+1)<<8) + get_mem(MEM_ROM_ID, addr+2))*2+addr+len)&0xfffe); break; case RLIST : { @@ -615,34 +672,34 @@ cl_xa::disass(t_addr addr, char *sep) sprintf(parm_str, "%s,%s,0x%02x", reg_strs[((code >> 4) & 0xf)], get_dir_name(((code & 0x7) << 8) + - get_mem(MEM_ROM, addr+immed_offset)), - ((signed char) get_mem(MEM_ROM, addr+immed_offset+1) * 2) & 0xfffe ); + get_mem(MEM_ROM_ID, addr+immed_offset)), + ((signed char) get_mem(MEM_ROM_ID, addr+immed_offset+1) * 2) & 0xfffe ); break; case REG_DATA8_REL8 : sprintf(parm_str, "%s,#0x%02x,0x%02x", reg_strs[((code >> 4) & 0xf)], - get_mem(MEM_ROM, addr+immed_offset+1), - ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe ); + get_mem(MEM_ROM_ID, addr+immed_offset+1), + ((signed char)get_mem(MEM_ROM_ID, addr+immed_offset) * 2) & 0xfffe ); break; case REG_DATA16_REL8 : sprintf(parm_str, "%s,#0x%04x,0x%02x", w_reg_strs[(code >> 4) & 0xf], - get_mem(MEM_ROM, addr+immed_offset+2) + - (get_mem(MEM_ROM, addr+immed_offset+1)<<8), - ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe ); + get_mem(MEM_ROM_ID, addr+immed_offset+2) + + (get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8), + ((signed char)get_mem(MEM_ROM_ID, addr+immed_offset) * 2) & 0xfffe ); break; case IREG_DATA8_REL8 : sprintf(parm_str, "[%s],#0x%02x,0x%02x", reg_strs[((code >> 4) & 0x7)], - get_mem(MEM_ROM, addr+immed_offset+1), - ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe ); + get_mem(MEM_ROM_ID, addr+immed_offset+1), + ((signed char)get_mem(MEM_ROM_ID, addr+immed_offset) * 2) & 0xfffe ); break; case IREG_DATA16_REL8 : sprintf(parm_str, "[%s],#0x%04x,0x%02x", w_reg_strs[(code >> 4) & 0x7], - get_mem(MEM_ROM, addr+immed_offset+2) + - (get_mem(MEM_ROM, addr+immed_offset+1)<<8), - ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe ); + get_mem(MEM_ROM_ID, addr+immed_offset+2) + + (get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8), + ((signed char)get_mem(MEM_ROM_ID, addr+immed_offset) * 2) & 0xfffe ); break; case A_APLUSDPTR : @@ -657,15 +714,15 @@ cl_xa::disass(t_addr addr, char *sep) sprintf(parm_str, "%s,%s+0x%02x", w_reg_strs[(code >> 4) & 0x7], w_reg_strs[code & 0x7], - get_mem(MEM_ROM, addr+immed_offset)); + get_mem(MEM_ROM_ID, addr+immed_offset)); break; case REG_REGOFF16 : sprintf(parm_str, "%s,%s+0x%02x", w_reg_strs[(code >> 4) & 0x7], w_reg_strs[code & 0x7], - get_mem(MEM_ROM, addr+immed_offset+1) + - (get_mem(MEM_ROM, addr+immed_offset+0)<<8)); + get_mem(MEM_ROM_ID, addr+immed_offset+1) + + (get_mem(MEM_ROM_ID, addr+immed_offset+0)<<8)); break; case A_PLUSDPTR : @@ -932,10 +989,11 @@ int cl_xa::exec_inst(void) break; } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + PC= rom->inc_address(PC, -1); //tick(-clock_per_cycle()); sim->stop(resINV_INST); return(resINV_INST); diff --git a/sim/ucsim/xa.src/xacl.h b/sim/ucsim/xa.src/xacl.h index 6c6780d1..fb64cae1 100644 --- a/sim/ucsim/xa.src/xacl.h +++ b/sim/ucsim/xa.src/xacl.h @@ -42,11 +42,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_xa: public cl_uc { public: - cl_mem *ram; - cl_mem *rom; + class cl_address_space *ram; + class cl_address_space *rom; struct t_regs regs; - class cl_mem *sfr, *iram; + class cl_address_space *sfr, *iram; // for now make it as simple as possible // TYPE_UBYTE mem_direct[1024*2]; @@ -59,9 +59,10 @@ public: virtual int init(void); virtual char *id_string(void); - virtual class cl_mem *mk_mem(enum mem_class type, char *class_name); - virtual t_addr get_mem_size(enum mem_class type); + //virtual class cl_m *mk_mem(enum mem_class type, char *class_name); + //virtual t_addr get_mem_size(enum mem_class type); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual struct dis_entry *dis_tbl(void); diff --git a/sim/ucsim/z80.src/Makefile.in b/sim/ucsim/z80.src/Makefile.in index 8aed4371..2dd50830 100644 --- a/sim/ucsim/z80.src/Makefile.in +++ b/sim/ucsim/z80.src/Makefile.in @@ -23,10 +23,10 @@ CXXFLAGS = @CXXFLAGS@ -Wall M_OR_MM = @M_OR_MM@ PICOPT = @PICOPT@ SHAREDLIB = @SHAREDLIB@ +EXEEXT = @EXEEXT@ -EXEEXT = @EXEEXT@ +LIBS = @LIBS@ -L$(PRJDIR) -Wl,--start-group -lutil -lcmd -lsim -lguiucsim -Wl,--end-group -LIBS = @LIBS@ -L$(PRJDIR) -lutil -lsim -lutil -lcmd -lguiucsim DL = @DL@ dl_ok = @dl_ok@ @@ -113,7 +113,7 @@ include clean.mk # -------- .SUFFIXES: .asm .hex -z80.src: sz80$(EXEEXT) shared_lib +z80.src: sz80$(EXEEXT) shared_lib sz80$(EXEEXT): $(OBJECTS) $(PRJDIR)/*.a $(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LIBS) diff --git a/sim/ucsim/z80.src/inst_cb.cc b/sim/ucsim/z80.src/inst_cb.cc index 6c9aa410..0ec12a59 100644 --- a/sim/ucsim/z80.src/inst_cb.cc +++ b/sim/ucsim/z80.src/inst_cb.cc @@ -694,10 +694,11 @@ cl_z80::inst_cb(void) case 0xFF: // SET 7,A return (inst_cb_set(code)); } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + PC= rom->inc_address(PC, -1); return(resINV_INST); } diff --git a/sim/ucsim/z80.src/inst_xxcb.cc b/sim/ucsim/z80.src/inst_xxcb.cc index d696d302..0b979b16 100644 --- a/sim/ucsim/z80.src/inst_xxcb.cc +++ b/sim/ucsim/z80.src/inst_xxcb.cc @@ -684,10 +684,11 @@ cl_z80::inst_XXcb(void) case 0xFF: // SET 7,A return (inst_XXcb_set(code)); } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + PC= rom->inc_address(PC, -1); return(resINV_INST); } diff --git a/sim/ucsim/z80.src/z80.cc b/sim/ucsim/z80.src/z80.cc index e0b1b123..9d2a6566 100644 --- a/sim/ucsim/z80.src/z80.cc +++ b/sim/ucsim/z80.src/z80.cc @@ -68,7 +68,7 @@ cl_z80::init(void) { cl_uc::init(); /* Memories now exist */ - rom= mem(MEM_ROM); + rom= address_space(MEM_ROM_ID); // ram= mem(MEM_XRAM); ram= rom; @@ -90,7 +90,7 @@ cl_z80::id_string(void) /* * Making elements of the controller */ - +/* t_addr cl_z80::get_mem_size(enum mem_class type) { @@ -102,6 +102,7 @@ cl_z80::get_mem_size(enum mem_class type) } return(cl_uc::get_mem_size(type)); } +*/ void cl_z80::mk_hw_elements(void) @@ -110,6 +111,27 @@ cl_z80::mk_hw_elements(void) /* t_uc::mk_hw() does nothing */ } +void +cl_z80::make_memories(void) +{ + class cl_address_space *as; + + as= new cl_address_space("rom", 0, 0x10000, 8); + as->init(); + address_spaces->add(as); + + class cl_address_decoder *ad; + class cl_memory_chip *chip; + + chip= new cl_memory_chip("rom_chip", 0x10000, 8); + chip->init(); + memchips->add(chip); + ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0); + ad->init(); + as->decoders->add(ad); + ad->activate(0); +} + /* * Help command interpreter @@ -177,12 +199,12 @@ cl_z80::get_disasm_info(t_addr addr, int start_addr = addr; struct dis_entry *dis_e; - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); dis_e = NULL; switch(code) { case 0xcb: /* ESC code to lots of op-codes, all 2-byte */ - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_z80_cb[i].mask) != disass_z80_cb[i].code && disass_z80_cb[i].mnemonic) @@ -194,7 +216,7 @@ cl_z80::get_disasm_info(t_addr addr, break; case 0xed: /* ESC code to about 80 opcodes of various lengths */ - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_z80_ed[i].mask) != disass_z80_ed[i].code && disass_z80_ed[i].mnemonic) @@ -206,11 +228,11 @@ cl_z80::get_disasm_info(t_addr addr, break; case 0xdd: /* ESC codes,about 284, vary lengths, IX centric */ - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); if (code == 0xcb) { immed_n = 2; addr++; // pass up immed data - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_z80_ddcb[i].mask) != disass_z80_ddcb[i].code && disass_z80_ddcb[i].mnemonic) @@ -232,11 +254,11 @@ cl_z80::get_disasm_info(t_addr addr, break; case 0xfd: /* ESC codes,sme as dd but IY centric */ - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); if (code == 0xcb) { immed_n = 2; addr++; // pass up immed data - code= get_mem(MEM_ROM, addr++); + code= get_mem(MEM_ROM_ID, addr++); i= 0; while ((code & disass_z80_fdcb[i].mask) != disass_z80_fdcb[i].code && disass_z80_fdcb[i].mnemonic) @@ -315,18 +337,18 @@ cl_z80::disass(t_addr addr, char *sep) switch (*(b++)) { case 'd': // d jump relative target, signed? byte immediate operand - sprintf(temp, "#%d", (char)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "#%d", (char)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; case 'w': // w word immediate operand sprintf(temp, "#0x%04x", - (uint)((get_mem(MEM_ROM, addr+immed_offset)) | - (get_mem(MEM_ROM, addr+immed_offset+1)<<8)) ); + (uint)((get_mem(MEM_ROM_ID, addr+immed_offset)) | + (get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8)) ); ++immed_offset; ++immed_offset; break; case 'b': // b byte immediate operand - sprintf(temp, "#0x%02x", (uint)get_mem(MEM_ROM, addr+immed_offset)); + sprintf(temp, "#0x%02x", (uint)get_mem(MEM_ROM_ID, addr+immed_offset)); ++immed_offset; break; default: @@ -593,10 +615,11 @@ cl_z80::exec_inst(void) case 0xff: return(inst_rst(code)); } - if (PC) + /*if (PC) PC--; else - PC= get_mem_size(MEM_ROM)-1; + PC= get_mem_size(MEM_ROM_ID)-1;*/ + PC= rom->inc_address(PC, -1); sim->stop(resINV_INST); return(resINV_INST); diff --git a/sim/ucsim/z80.src/z80cl.h b/sim/ucsim/z80.src/z80cl.h index 53e9e331..966d2464 100644 --- a/sim/ucsim/z80.src/z80cl.h +++ b/sim/ucsim/z80.src/z80cl.h @@ -40,16 +40,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA class cl_z80: public cl_uc { public: - cl_mem *ram; - cl_mem *rom; + class cl_memory *ram; + class cl_memory *rom; struct t_regs regs; public: cl_z80(class cl_sim *asim); virtual int init(void); virtual char *id_string(void); - virtual t_addr get_mem_size(enum mem_class type); + //virtual t_addr get_mem_size(enum mem_class type); virtual void mk_hw_elements(void); + virtual void make_memories(void); virtual struct dis_entry *dis_tbl(void); virtual int inst_length(t_addr addr);