version 0.5.2
authordrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 16 Jul 2004 16:36:33 +0000 (16:36 +0000)
committerdrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 16 Jul 2004 16:36:33 +0000 (16:36 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3383 4a8a32a2-be11-0410-ad9d-d568d2c75423

143 files changed:
sim/ucsim/.version
sim/ucsim/Makefile
sim/ucsim/NEWS
sim/ucsim/app.cc
sim/ucsim/appcl.h
sim/ucsim/avr.src/Makefile.in
sim/ucsim/avr.src/avr.cc
sim/ucsim/avr.src/avrcl.h
sim/ucsim/avr.src/jump_inst.cc
sim/ucsim/clean.mk
sim/ucsim/cmd.src/Makefile.in
sim/ucsim/cmd.src/bp.cc
sim/ucsim/cmd.src/bpcl.h
sim/ucsim/cmd.src/cmdconf.cc
sim/ucsim/cmd.src/cmdconfcl.h
sim/ucsim/cmd.src/cmdgui.cc
sim/ucsim/cmd.src/cmdset.cc
sim/ucsim/cmd.src/cmdsetcl.h
sim/ucsim/cmd.src/cmdstat.cc
sim/ucsim/cmd.src/cmduc.cc
sim/ucsim/cmd.src/cmdutil.cc
sim/ucsim/cmd.src/command.cc
sim/ucsim/cmd.src/commandcl.h
sim/ucsim/cmd.src/get.cc
sim/ucsim/cmd.src/info.cc
sim/ucsim/cmd.src/infocl.h
sim/ucsim/cmd.src/newcmd.cc
sim/ucsim/cmd.src/newcmdcl.h
sim/ucsim/cmd.src/set.cc
sim/ucsim/cmd.src/setcl.h
sim/ucsim/cmd.src/show.cc
sim/ucsim/cmd.src/showcl.h
sim/ucsim/cmd.src/timer.cc
sim/ucsim/cmd.src/timercl.h
sim/ucsim/conf
sim/ucsim/configure
sim/ucsim/configure.in
sim/ucsim/ddconfig_in.h
sim/ucsim/doc/Makefile.in
sim/ucsim/doc/analyzer.html
sim/ucsim/doc/cmd.html
sim/ucsim/doc/cmd_bp.html
sim/ucsim/doc/cmd_dump.html
sim/ucsim/doc/cmd_exec.html
sim/ucsim/doc/cmd_general.html
sim/ucsim/doc/cmd_removed.html
sim/ucsim/doc/cmd_set.html
sim/ucsim/doc/commref.html
sim/ucsim/doc/cpu_types.html
sim/ucsim/doc/index.html
sim/ucsim/doc/invoke.html
sim/ucsim/doc/mulcons.html
sim/ucsim/doc/serial.html
sim/ucsim/doc/syntax.html
sim/ucsim/error.cc
sim/ucsim/errorcl.h
sim/ucsim/eventcl.h [new file with mode: 0644]
sim/ucsim/globals.cc
sim/ucsim/globals.h
sim/ucsim/gui.src/gui.cc
sim/ucsim/gui.src/serio.src/Makefile.in
sim/ucsim/gui.src/serio.src/main.cc
sim/ucsim/hc08.src/Makefile.in
sim/ucsim/hc08.src/hc08.cc
sim/ucsim/hc08.src/hc08cl.h
sim/ucsim/libtool [new file with mode: 0755]
sim/ucsim/main_in.mk
sim/ucsim/mkecho
sim/ucsim/option.cc
sim/ucsim/optioncl.h
sim/ucsim/packages_in.mk
sim/ucsim/pobj.cc
sim/ucsim/pobjcl.h
sim/ucsim/ptt.cc [new file with mode: 0644]
sim/ucsim/s51.src/Makefile.in
sim/ucsim/s51.src/arith.cc
sim/ucsim/s51.src/bit.cc
sim/ucsim/s51.src/glob.cc
sim/ucsim/s51.src/glob.h
sim/ucsim/s51.src/inc.cc
sim/ucsim/s51.src/interrupt.cc
sim/ucsim/s51.src/interruptcl.h
sim/ucsim/s51.src/jmp.cc
sim/ucsim/s51.src/logic.cc
sim/ucsim/s51.src/mov.cc
sim/ucsim/s51.src/pca.cc
sim/ucsim/s51.src/pcacl.h
sim/ucsim/s51.src/port.cc
sim/ucsim/s51.src/portcl.h
sim/ucsim/s51.src/s51.cc
sim/ucsim/s51.src/serial.cc
sim/ucsim/s51.src/serialcl.h
sim/ucsim/s51.src/sim51.cc
sim/ucsim/s51.src/timer0.cc
sim/ucsim/s51.src/timer0cl.h
sim/ucsim/s51.src/timer1.cc
sim/ucsim/s51.src/timer2.cc
sim/ucsim/s51.src/timer2cl.h
sim/ucsim/s51.src/uc251.cc
sim/ucsim/s51.src/uc251cl.h
sim/ucsim/s51.src/uc390.cc
sim/ucsim/s51.src/uc390cl.h
sim/ucsim/s51.src/uc390hw.cc
sim/ucsim/s51.src/uc390hwcl.h
sim/ucsim/s51.src/uc51.cc
sim/ucsim/s51.src/uc51cl.h
sim/ucsim/s51.src/uc51r.cc
sim/ucsim/s51.src/uc51rcl.h
sim/ucsim/s51.src/uc52.cc
sim/ucsim/s51.src/uc52cl.h
sim/ucsim/s51.src/uc89c51r.cc
sim/ucsim/s51.src/uc89c51rcl.h
sim/ucsim/s51.src/wdt.cc
sim/ucsim/s51.src/wdtcl.h
sim/ucsim/sim.src/(c).1
sim/ucsim/sim.src/Makefile.in
sim/ucsim/sim.src/arg.cc
sim/ucsim/sim.src/argcl.h
sim/ucsim/sim.src/brk.cc
sim/ucsim/sim.src/brkcl.h
sim/ucsim/sim.src/hw.cc
sim/ucsim/sim.src/hwcl.h
sim/ucsim/sim.src/itsrc.cc
sim/ucsim/sim.src/mem.cc
sim/ucsim/sim.src/memcl.h
sim/ucsim/sim.src/sim.cc
sim/ucsim/sim.src/simcl.h
sim/ucsim/sim.src/stack.cc
sim/ucsim/sim.src/stackcl.h
sim/ucsim/sim.src/test_mem_speed.cc
sim/ucsim/sim.src/uc.cc
sim/ucsim/sim.src/uccl.h
sim/ucsim/stypes.h
sim/ucsim/utils.cc
sim/ucsim/utils.h
sim/ucsim/xa.src/Makefile.in
sim/ucsim/xa.src/xa.cc
sim/ucsim/xa.src/xacl.h
sim/ucsim/z80.src/Makefile.in
sim/ucsim/z80.src/inst_cb.cc
sim/ucsim/z80.src/inst_xxcb.cc
sim/ucsim/z80.src/z80.cc
sim/ucsim/z80.src/z80cl.h

index edb78d6cf0c488cfad7a168f7df0eabbcb60985d..cb0c939a936f142669d38cf1ece330266d730965 100644 (file)
@@ -1 +1 @@
-0.4.1-pre5
+0.5.2
index ce162ff10d776f82369bf3b61ba55027318f398e..b5c0278adc02a7b7c5cd6434fc399acd1a0ef262 100644 (file)
@@ -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"
index d62e965b3a6a1859b7f52c2c0e35b53a097f1196..ce227235d15b0cfae2e3059f7e8b97b62c734f94 100644 (file)
@@ -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
index 3c2a4d847569bd4cd3ff97778e3c39931be65221..f357afefc29766e67761d318cd05b626f8251177 100644 (file)
@@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <unistd.h>
 #ifdef HAVE_GETOPT_H
 # include <getopt.h>
@@ -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);
 }
 
 
index e0049197f918f64c9452cc136e3f7db1ce5a5a14..5195b32dfa71bb7506a8ac356320c37ca4b5eae6 100644 (file)
@@ -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, ...);
 };
 
 
index 57cbf209b9b096834e927e8ca41ff9a70bbff6f0..55afbee06b321a894f2f36cf48fbc9d60a658f0c 100644 (file)
@@ -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
index bef5a621ee9a4046a283914794aa75963c6e5187..379edd09703619e8eda1f136c3e222bdfee7ba67 100644 (file)
@@ -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);
index 3572599e85bfa58fd592884b8500f9d4e4d6b272..712efd8f187105720a70aae8c2b33e804ab25f53 100644 (file)
@@ -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);
index 49c9769b55a3ec5ecd940e21269166ea84d8569f..54f98f9726054b84082eebceb27620861305bd53 100644 (file)
@@ -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
index 7643b5e130dfc2b42c30e73eaab49eca84056c43..84fff8d4b339ea24d0ea88d78b93f5bfd505dd25 100644 (file)
@@ -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
index 6f7f66ca28c9d77fcad67fecc2d10a4c632f8bef..c026f015b3096eb5368c4de772f1ea18daf0531b 100644 (file)
@@ -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
index 7a1302408363d123b35b376c3bdffd714932c605..617f43e5d3f75f48f4d4057302b0228c72e80010 100644 (file)
@@ -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;
index ecf4395219c29c5aa83679d87e77425ebaf04ff5..61e0b7f4bb7a07b8b6813e78e9acd26f63e24951 100644 (file)
@@ -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;
 
index 1d4d79e5ee4c3f5cc267e8b25484f2eb44f8da88..a78cc7f75ecf6eda925eea851c16ef4bc5098d2c 100644 (file)
@@ -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);
 }
 
index 9be11ca266acaa5b682cff61720e0ceb03bfdda7..68ebc2a72c510be57c7a6fddab0c32db6a710f1c 100644 (file)
@@ -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
index cd10416eb831d3888d237fc0280234c8e8cbe079..5a1fdef907a1afaceaa0692ea9027af3fd035b34 100644 (file)
@@ -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;
   }
index 40ab449545dfe50c7fdba1395d58ac57d3b45ae4..f0226ceb298ef520a210d953e4a616eeff28d8a1 100644 (file)
@@ -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<class cl_cmd *>(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<class cl_cmd *>(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 */
index 298a476c0865114f14b5a5bada2f624ef98a405b..381c2cf7255ef205eb599a7443fce37b2edf205b 100644 (file)
@@ -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
index f430437c4d64ec82aa322635e1dd384eb6e6e117..fbf5dd92144d457cefd092de642e44412df147bd 100644 (file)
@@ -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);
            }
       }
   }
index 3623bd7a539d98d2ec1937ae89a3427bdd4f9354..cb3aa557b994dfbcbadb0fe1ce833dbeff0f3ffb 100644 (file)
@@ -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)
index 50a90e3e28f2d3b176196385ce3366c30f100994..aa831bf8c083feb07587cc36b7a0f8db3c0d38f5 100644 (file)
@@ -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
index e58a225118a3a6ed9476154613b3ff84cd53b54e..6d96129e3a81ff30914020ee8316e2f8f753c2de 100644 (file)
@@ -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)));
index 3bec252d34d639420b9cb5f121199221946907d3..36dc7767a9f7a4e333c92843cc9fad2b7640ceeb 100644 (file)
@@ -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);
 };
index f070f02f07c78db1924822f28f7896af58cd7fb9..d16f892d75cd2e043bbe17528d5db55f1896966b 100644 (file)
@@ -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()));
+             */
+           }
        }
     }
   
index 9e04cc79fd5b8fc8ed53c027ad46c4bc0f3caf4d..ff6881c5d6043d24130be8bdf75b289d03e63173 100644 (file)
@@ -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 */
index ea460a0dfacc486fae9f5f5fa67ed387ede624c3..870d96ab5fc5451e3e9383c3279929ef497ff7d9 100644 (file)
@@ -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
 
index 762d6447acd6368518bebfdd78fd1560cac61ca5..cf32c05c4f610af5932f7eb0d0be499334679f8e 100644 (file)
@@ -45,6 +45,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <unistd.h>
 #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 */
index c0a604ab557087b338be202bb16dbc3c7bef6ddc..6e3af3e443cd988e48e14c997e3ef4dbf757224b 100644 (file)
@@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ddconfig.h"
 
 #include <stdio.h>
+#include <stdarg.h>
 #include <sys/types.h>
 #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);
 };
 
 
index 2c1387eb6036736d1e5da260dacc647f0a679ee2..07d0134c12a2eaa65e625512c9bce1ae17a20c3c 100644 (file)
@@ -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 <ctype.h>
 #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<class cl_error_class *>(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);
 }
 
 
index 066b3d302d1d8e7b0c9ee2542b0a6d893531e630..8f9481c2d9120bccb4d0b15f3905beffe11dac80 100644 (file)
@@ -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
 
index 9833d2b8e4a2eb3284f03b30d7cca3d201ca3ed1..8f6fee137ca68aca471c684122bdcb921cff32e2 100644 (file)
@@ -26,11 +26,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 /*@1@*/
 
 #include "ddconfig.h"
+
+#include <stdlib.h>
 #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<class cl_error_class *>(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<class cl_error_class*>(registered_errors->object_at(i));
+      if (!ec->get_parent())
+       show_error_cmd_print_node(con, 0, ec);
+    }
+  return(DD_FALSE);
 }
 
 
index 72498b78935c0475ac5fde4e46e34b92b2d65b7b..f7eab7ddaad9ca4ee6592fb1ddf0dac36dde8ae0 100644 (file)
@@ -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
 
index e72931916991983976700ef4ee387e6d41935706..e029c49bf62cd9910cc30bd3e57ec2bb66b85362 100644 (file)
@@ -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])
     {
index 128b66edaca22bdfefe069b0cf5218fb779b4a74..754790855d67684c285872ea59dcca04e6c4f87b 100644 (file)
@@ -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 */
index c3e4fcf4a21016c0bc35686d16e7d703342f0176..c5a4eb13882056ab6b2dad2bb2eba008bd73288b 100755 (executable)
@@ -35,6 +35,9 @@ case $TARGET in
        --enable-xa \
        "$@"
        ;;
+    *)
+       echo >&2 "Do not know how to configure!"
+       ;;
 esac
 
 # End of conf
index 865f6db97f6fab6ae566195e36d38ff12089f524..721ac7308d92709f7341862279bdee182795b0b1 100755 (executable)
@@ -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 <unistd.h>
 #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<lib dir> 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 <stdlib.h>' \
+   '' \
    '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 <stdlib.h>
 $ac_declaration
+#include <stdlib.h>
 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 <assert.h>
 #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 <assert.h>
 #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 <stdlib.h>' \
+   '' \
    '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 <stdlib.h>
 $ac_declaration
+#include <stdlib.h>
 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 <assert.h>
 #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 <assert.h>
 #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 <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <<EOF
-#line 7283 "configure"
+#line 7544 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -7378,7 +7639,7 @@ else
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 7381 "configure"
+#line 7642 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8112,10 +8373,366 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
-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'
+for ac_prog in flex lex
+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_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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares _doprnt.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _doprnt innocuous__doprnt
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #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 <<CEOF' >>$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 <<CEOF' >>$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; }
index eb113efcd7b88d26f0d948b0c396beda4e8ed268..600d53cb28ab7f0956442462fe6dddfaffe8abda 100644 (file)
@@ -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
 # ===========================================================================
 
index 0ee8478cea5bc5480ee3423ad3a425fff744f189..442fde0be932e525f66b55fe77d529319fdc47b4 100644 (file)
@@ -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
index 10e628aa347bdf836ff272c9e27b1a2f13dadd33..4a996b635e98413123b35e3db8c962d9898a2f05 100644 (file)
@@ -22,6 +22,7 @@ man1dir         = $(mandir)/man1
 man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
+#docdir                = $(prefix)/share/doc/ucsim
 docdir         = @docdir@/ucsim
 
 
index 08c91d97d7e99e16d5363e2221aaa12a311d6550..2922c6c87b9c44796462d6a2855383f5b7fc8dda 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: Code Analyzer</title>
+<title>&micro;Csim: Code Analyzer</title>
 </head>
 
 <body bgcolor="white">
index 6043982eb0c75d3908c7e641784dd10ca840b7ab..3d72870d27740c10b3c07342625dad2a69c6fe97 100644 (file)
 
 <body bgcolor="white">
 
-<h1>Command reference of ucsim</h1>
+<h1>Command reference of &micro;Csim</h1>
 
 
+<!--GENERAL-->
+
 <a href="cmd_general.html">General commands and information</a>
 
-<ul><li><a href="cmd_general.html#h"><b>help,?</b> Help about
-commands</a> (<font color="#ff2211">changed 0.2.38</font>)
+<ul><li><a href="cmd_general.html#conf"><b>conf</b> Configuration</a>
+(<font color="#ff2211">changed in 0.5.0</font>)
 
-<li><a href="cmd_general.html#show"><b>show</b> Show different kind of
-information</a> (<font color="#ff2211">since 0.1.3</font>) (<font
-color="#ff2211">changed 0.2.38</font>)
+<ul><li><a href="cmd_general.html#conf_objects"><b>conf
+objects</b></a> (<font color="#ff2211">since 0.5.0</font>)
+</ul>
 
-<li><a href="cmd_general.html#file"><b>file,load</b> Load FILE into
-ROM</a>
 
-<li><a href="cmd_general.html#dl"><b>download,dl</b> Download (intel
-hex) data</a>
+<li><a href="cmd_general.html#h"><b>help,?</b> Help about
+commands</a> (<font color="#ff2211">changed in 0.2.38</font>)
+
 
 <li><a href="cmd_general.html#q"><b>quit</b> Quit</a> (<font
-color="cmd_general.html#ff2211">changed 0.2.12</font>)
+color="cmd_general.html#ff2211">changed in 0.2.12</font>)
+
 
 <li><a href="cmd_general.html#kill"><b>kill</b> Shut down the
 simulator</a> (<font color="#ff2211">since 0.2.12</font>)
 
-<li><a href="cmd_general.html#reset"><b>reset</b> Reset
 
-<li><a href="cmd_general.html#where"><b>where,Where</b> Search for
-data in memory</a> (<font color="#ff2211">since 0.2.38</font>)
+<li><a href="cmd_general.html#exec"><b>exec</b> Execute commands from file
+(<font color="#ff2211">since 0.5.0</font>)
+
+
+<li><a href="cmd_general.html#expression"><b>expression</b> Compute value
+of an expression (<font color="#ff2211">since 0.5.0</font>)
+
+
+<li><a href="cmd_general.html#show"><b>show</b> Show different kind of
+information</a> (<font color="#ff2211">since 0.1.3</font>) (<font
+color="#ff2211">changed in 0.2.38, 0.5.0</font>)
+
+<ul><li><a href="cmd_general.html#show_copying"><b>show copying</b></a>
+
+<li><a href="cmd_general.html#show_warranty"><b>show warranty</b></a>
+
+<li><a href="cmd_general.html#show_option"><b>show option</b></a>
+(<font color="#ff2211">since 0.5.0</font>)
+
+<li><a href="cmd_general.html#show_error"><b>show error</b></a> (<font
+color="#ff2211">since 0.5.0</font>)
+</ul>
+
+
+<li><a href="cmd_general.html#get"><b>get</b> Get various things</a>
+(<font color="#ff2211">since 0.2.38</font>)
+
+<ul><li><a href="cmd_general.html#get_option">get option</a>
+
+<li><a href="cmd_general.html#get_sfr">get sfr</a>
+</ul>
+
+
+<li><a href="cmd_general.html#set"><b>set</b> Set various things</a>
+(<font color="#ff2211">since 0.2.38</font>)
+
+<ul><li><a href="cmd_general.html#set_option"><b>set option</b></a>
+(<font color="#ff2211">since 0.5.0</font>)
+
+<li><a href="cmd_general.html#set_error"><b>set error</b></a> (<font
+color="#ff2211">since 0.5.0</font>)
+
+<li><a href="cmd_general.html#set_memory"><b>set memory</b></a>
+
+<li><a href="cmd_general.html#set_bit"><b>set bit</b></a>
+
+<li><a href="cmd_general.html#set_hardware"><b>set hardware</b></a> (<font
+color="#ff2211">set port renamed and changed in 0.5.0</font>)
+
+</ul>
 
-<li><a href="cmd_general.html#conf"><b>conf</b> Configuration</a>
 
 <li><a href="cmd_general.html#state"><b>state</b> State of
 simulator</a>
 
+
+<li><a href="cmd_general.html#reset"><b>reset</b> Reset
+
+
 <li><a href="cmd_general.html#info"><b>info</b> Information</a> (<font
-color="#ff2211">changed 0.2.38</font>)
+color="#ff2211">changed in 0.5.0</font>)
+
+<ul><li><a href="cmd_general.html#info_breakpoints"><b>info
+breakpoints</b></a>
+
+<li><a href="cmd_general.html#info_registers"><b>info registers</b></a>
+
+<li><a href="cmd_general.html#info_hardware"><b>info hardware</b></a>
+
+<li><a href="cmd_general.html#info_stack"><b>info stack</b></a> (<font
+color="#ff2211">since 0.5.0</font>)
+
+<li><a href="cmd_general.html#info_memory"><b>info memory</b></a> (<font
+color="#ff2211">since 0.5.0</font>)
+
+</ul>
+
 
 <li><a href="cmd_general.html#timer"><b>timer</b> Managing timers to
 measure execution time and profiling</a>
 
-<li><a href="cmd_general.html#set"><b>set</b> Set various things</a>
-(<font color="#ff2211">since 0.2.38</font>)
+<ul><li><a href="cmd_general.html#timer_add">timer add</a>
 
-<li><a href="cmd_general.html#get"><b>get</b> Get various things</a>
-(<font color="#ff2211">since 0.2.38</font>)
+<li><a href="cmd_general.html#timer_delete">timer delete</a>
+
+<li><a href="cmd_general.html#timer_get">timer get</a>
+
+<li><a href="cmd_general.html#timer_start">timer start</a>
+
+<li><a href="cmd_general.html#timer_stop">timer stop</a>
+
+<li><a href="cmd_general.html#timer_set">timer set</a>
+
+</ul>
+
+</ul>
+
+
+<!--MEMORY-->
+
+<a href="cmd_memory.html">Memory manipulation</a>
 
-<li><a href="cmd_general.html#fill"><b>fill</b> Fill memory region
+<ul><li><a href="cmd_memory.html#file"><b>file,load</b> Load FILE into
+ROM</a>
+
+
+<li><a href="cmd_memory.html#dl"><b>download,dl</b> Download (intel
+hex) data into ROM</a>
+
+
+<li><a href="cmd_memory.html#fill"><b>fill</b> Fill memory region
 with data</a> (<font color="#ff2211">since 0.2.38</font>)
 
+
+<li><a href="cmd_memory.html#where"><b>where,Where</b> Search for
+data in memory</a> (<font color="#ff2211">since 0.2.38</font>)
+
+
+<li><a href="cmd_memory.html#memory"><b>memory</b> Manage address
+spaces, memory chips and address decoders (<font color="#ff2211">since
+0.5.0</font>)
+
+<ul><li><a href="cmd_memory.html#memory_createchip">memory
+createchip</a>
+
+<li><a href="cmd_memory.html#memory_createaddressspace">memory
+createaddressspace</a>
+
+<li><a href="cmd_memory.html#memory_createaddressdecoder">memory
+createaddressdecoder</a>
+
+</ul>
+
 </ul>
 
 
+<!--EXEC-->
+
 <a href="cmd_exec.html">Execution</a>
 
-<ul><li><a href="cmd_exec.html#stop"><b>stop</b> Stop</a> (<font
+<ul><li><a href="cmd_exec.html#run"><b>r,run,go</b> Go</a> (<font
+color="#ff2211">since 0.2.20</font>) (<font color="#ff2211">changed
+0.2.38</font>)
+
+
+<li><a href="cmd_exec.html#stop"><b>stop</b> Stop</a> (<font
 color="#ff2211">since 0.2.12</font>)
 
+
 <li><a href="cmd_exec.html#step"><b>s,step</b> Step</a> (<font
-color="pink">renamed from <b>s</b> 0.2.38</font>)
+color="#ff2211">renamed from <b>s</b> in 0.2.38</font>)
+
 
 <li><a href="cmd_exec.html#n"><b>n,next</b> Next</a>
 
+
 <li><a href="cmd_exec.html#pc"><b>pc</b> Set/get PC</a> (<font
 color="#ff2211">since 0.1.5</font>)
 
-<li><a href="cmd_exec.html#run"><b>r,run,go</b> Go</a> (<font
-color="#ff2211">since 0.2.20</font>) (<font color="#ff2211">changed
-0.2.38</font>)
-
 </ul>
 
 
+<!--BREAKPOINT-->
+
 <a href="cmd_bp.html">Breakpoints</a>
 
 <ul><li><a href="cmd_bp.html#break"><b>break</b> Set fix
-breakpoint</a> (<font color="#ff2211">changed 0.2.38</font>)
+breakpoint</a> (<font color="#ff2211">changed in 0.2.38</font>)
+
 
 <li><a href="cmd_bp.html#tbreak"><b>tbreak</b> Set temporary
-breakpoint</a> (<font color="#ff2211">changed 0.2.38</font>)
+breakpoint</a> (<font color="#ff2211">changed in 0.2.38</font>)
+
 
 <li><a href="cmd_bp.html#clear"><b>clear</b> Clear fix breakpoint</a>
 
+
 <li><a href="cmd_bp.html#delete"><b>delete</b> Delete
 breakpoint(s)</a>
 
 </ul>
 
 
+<!--DUMP-->
+
 <a href="cmd_dump.html">Dump commands</a>
 
 <ul><li><a href="cmd_dump.html#dump"><b>dump</b> Dump memory or bits</a>
 (<font color="#ff2211">since 0.2.38</font>)
 
+
 <li><a href="cmd_dump.html#disassemble"><b>disassemble</b>
 Disassemble</a>
 
+
 <li><a href="cmd_dump.html#dc"><b>dc</b> Dump code in disass
 format</a>
 
+
 <li><a href="cmd_dump.html#dch"><b>dch</b> Dump code in hex format</a>
 
+
 <li><a href="cmd_dump.html#di"><b>di</b> Dump Internal RAM</a>
 
+
 <li><a href="cmd_dump.html#dx"><b>dx</b> Dump External RAM</a>
 
+
 <li><a href="cmd_dump.html#ds"><b>ds</b> Dump SFR</a>
 
 </ul>
 
 
+<!--REMOVED-->
+
 <a href="cmd_removed.html">Removed obsolet commands</a>
 
 <ul><li><a href="cmd_removed.html#wi">wi,Wi</a> Search for string in
 Internal RAM (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#where">where,Where</a> instead</font>)
+href="cmd_memory.html#where">where,Where</a> instead</font>)
 
 <li><a href="cmd_removed.html#wx">wx,Wx</a> Search for string in
 External RAM (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#where">where,Where</a> instead</font>)
+href="cmd_memory.html#where">where,Where</a> instead</font>)
 
 <li><a href="cmd_removed.html#wc">wc,Wc</a> Search for string in ROM
 (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#where">where,Where</a> instead</font>)
+href="cmd_memory.html#where">where,Where</a> instead</font>)
 
 <li><a href="cmd_removed.html#gopt">gopt</a> Get value of option(s)
 (<font color="#ff2211">removed 0.2.38, use <a
@@ -193,19 +325,19 @@ bit</a> instead</font>)
 
 <li><a href="cmd_removed.html#fi">fi</a> Fill IRAM area with data
 (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#fill">fill</a> instead</font>)
+href="cmd_memory.html#fill">fill</a> instead</font>)
 
 <li><a href="cmd_removed.html#fx">fx</a> Fill XRAM area with data
 (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#fill">fill</a> instead</font>)
+href="cmd_memory.html#fill">fill</a> instead</font>)
 
 <li><a href="cmd_removed.html#fs">fs</a> Fill SFR area with data
 (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#fill">fill</a> instead</font>)
+href="cmd_memory.html#fill">fill</a> instead</font>)
 
 <li><a href="cmd_removed.html#fc">fc</a> Fill ROM area with data
 (<font color="#ff2211">removed 0.2.38, use <a
-href="cmd_general.html#fill">fill</a> instead</font>)
+href="cmd_memory.html#fill">fill</a> instead</font>)
 
 <li><a href="cmd_removed.html#db">db</a> Dump bit</a> (<font
 color="#ff2211">removed 0.2.38, use <a
index e786103db8d38747a65859d7ac2768686daa2622..e64e2bf6a7b3d2fe08befbff89e5b3bf999564fd 100644 (file)
@@ -1,15 +1,15 @@
 <html>
 <head>
-<title>Breakpoints commands of uCsim</title>
+<title>Breakpoints commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
                                                           <!-- BREAKPOINTS -->
 
-<h2>Commands of uCsim to manage breakpoints</h2>
+<h2>Commands of &micro;Csim to manage breakpoints</h2>
 
-Two kind of breakpoints can be used: fetch and event
+Two kind of breakpoint can be used: fetch and event
 breakpoint. <B>Fetch</b> 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 <i>before</i> the instruction at location specified by the
 breakpoint would be executed.
 
 <p><b>Event</b> breakpoints are special onces. They cause stop of
-execution if event specified by the breakpoint occures. Events are:
-
-<dl><dt><b>wi</b> <dd>writing into internal RAM at specified location;
-
-<dt><b>ri</b> <dd>reading from internal RAM at specified address;
-
-<dt><b>wx</b> <dd>writing into external RAM at specified location
-(MOVX instruction);
-
-<dt><b>rx</b> <dd>reading from external RAM at specified address (MOVX
-instruction);
-
-<dt><b>ws</b> <dd>writing into SFR area at specified location;
-
-<dt><b>rs</b> <dd>reading from SFR area at specified address;
-
-<dt><b>rc</b> <dd>reading from code memory at specified location (MOVC
-instruction).</dl>
-
-Event breakpoint stops execution <i>after</i> 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 <i>after</i> specified event occured.
 
 <p>Every breakpoint can be <b>fix</b> (permanent) or <b>dynamic</b>
 (temporary). Dynamic breakpoints are automatically removed when they
@@ -50,11 +33,13 @@ href="#n"><b>next</b></a>.
 number specifies how many times the breakpoint must be hit before it
 causes the execution to stop. This hit number is 1 by default.
 
+<hr>
+
 
-<a name="break"><h3>break addr [hit]
-<br>break memory_type r|w addr [hit]</h3></a>
-<a name="tbreak"><h3>tbreak addr [hit]
-<br>tbreak memory_type r|w addr [hit]</h3></a>
+<a name="break"><h3>break <i>addr [hit]</i>
+<br>break <i>memory_type r|w addr [hit]</i></h3></a>
+<a name="tbreak"><h3>tbreak<i> addr [hit]</i>
+<br>tbreak <i>memory_type r|w addr [hit]</i></h3></a>
 
 
 Set fetch or event breakpoint. The command specifies if the breakpoint
@@ -74,8 +59,8 @@ placed to. It should be address of an instruction.
 <dt>Event breakpoint
 
 <dd>First parameter specifies class name of memory where we are going
-to watch for en event. Class names of memories can be checked by q<a
-href="cmd_general.html#conf">conf</a> command.
+to watch for en event. Class names of memories can be checked by <a
+href="cmd_general.html#info_memory">info memory</a> command.
 <br>Second parameter specifies the event. It can be <b>r</b> to
 specify <b>read</b> operation or <b>w</b> which means <b>write</b>
 operation.
@@ -113,8 +98,10 @@ Stop at 000160: (4) Breakpoint
 F 000160
 > </pre>
 
+<hr>
 
-<a name="clear"><h3>clear [addr...]</h3></a>
+
+<a name="clear"><h3>clear <i>[addr...]</i></h3></a>
 
 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
 > </pre>
 
+<hr>
+
 
-<a name="delete"><h3>delete [number...]</h3></a>
+<a name="delete"><h3>delete <i>[number...]</i></h3></a>
 
 Delete breakpoint(s) by its number.
 
index 2c36cbcc8d62665bc4c394e7ec4c9bae0c474981..af2150c5c8ed773e222209f0a73e96be71d69c81 100644 (file)
@@ -1,36 +1,37 @@
 <html>
 <head>
-<title>Dump commands of uCsim</title>
+<title>Dump commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
 
-<h2>Dump commands of uCsim</h2>
+<h2>Dump commands of &micro;Csim</h2>
 
-<a name="dump"><h3>dump memory_type [start [end
-[bytes_per_line]]]
-<br>dump bit_name...</h3></a>
+<a name="dump"><h3>dump <i>memory_type [start [end [bytes_per_line]]]</i>
+<br>dump <i>bit_name...</i></h3></a>
 
 First form can be used get content of memory while second form can be
 used to check value of bit or bits.
 
 
-<a name="dump_memory"><h4>dump memory_type [start [end
-[bytes_per_line]]]</h4></a>
+<blockquote>
+
+<a name="dump_memory"><h4>dump <i>memory_type [start [end
+[bytes_per_line]]]</i></h4></a>
 
 Hexadecimal dump of a memory region. First parameter specifies
-memory. Class name of the memory must be used, it can be checked using
-<a href="cmd_general.html#conf">conf</a> 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 <a href="cmd_general.html#info_memory">info memory</a>
+command which lists size and name of all available memories.
 
 <p><b>start</b> and <b>end</b> parameters can be used to specify the
-first and last address of the region. If <b>end</b> is omitted then 64
-memory location is dumped. If both <b>start</b> and <b>end</b> 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 <b>end</b> is omitted
+then 64 memory location is dumped. If both <b>start</b> and <b>end</b>
+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.
 
 <p>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.. .:.
-> <font color="#118811">du x 10 20 10</font>
+> <font color="#118811">du xram 10 20 10</font>
 0x000a ff 01 00 fa 01 01 40 01 01 44 ......@..D
 0x0014 01                            .
-> <font color="#118811">du x</font>
+> <font color="#118811">du xram</font>
 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......
+>
+</pre>
+
+<hr>
+
+
+<a name="dump_bit"><h4>dump <i>bit_name...</i></h4></a>
+
+If the simulated controller supports addressable bits (such as MCS51
+does) this command can be used to print out values of bit(s). <a
+href="syntax.html#bit_param">Any form of bit address</a> can be used
+as parameter:
+
+<pre>
+0> <font color="#118811">dump ac p1.2 0x21</font>
+     PSW.6 0xd0 00 0
+      P1.2 0x90 ff 1
+    0x24.1 0x24 24 0
+0> 
+</pre>
+
+Please note, that this command can not be used, if there is no address
+space called <b>sfr</b>.
+
+<pre>
+$ <font color="#118811">sz80</font>
+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> 
+</pre>
+
+
+</blockquote>
+
+<hr>
+
+
+<a name="dch"><h3>dch <i>[start [stop]]</i></h3></a>
+
+Hexadecimal dump of code memory area from address <b>start</b> to
+address <b>stop</b>. Default value of start address is address of
+following memory cell which was dumped by previous <b>dch</b>
+command. If <b>stop</b> parameter is not given <b>dch</b> command
+lists 10 lines 8 bytes per line.
+
+<pre>
+$ <font color="#118811">s51 remo.hex</font>
+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
+> <font color="#118811">wc remo</font>
+0013da 52 65 6d 6f             Remo
+> <font color="#118811">dch 0x13da</font>
+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..
 > </pre>
 
+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.
+
+<hr>
+
+
+<a name="dc"><h3>dc <i>[start [stop]]</i></h3></a>
+
+Disassembled dump of code memory area. This command simply produces
+disassambled list of memory area specified by the parameters. Default
+value of <b>start</b> parameter is last address listed by previous
+<b>dc</b> command. If <b>stop</b> parameter is not given 20 lines are
+listed.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</font> 
+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
+> <font color="#118811">dc</font>
+   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
+> </pre>
 
-<a name="dump_bit"><h4>dump bit_name...</h4></a>
+<hr>
 
 
-<a name="disassemble"><h3>disassemble [start [offset
-[lines]]]</h3></a>
+<a name="disassemble"><h3>disassemble <i>[start [offset
+[lines]]]</i></h3></a>
 
 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 <b>offset</b> is negative the simulator goes
-backward and skips specified number of instructions. Default value of
+instructions which discovered by the <a href="analyzer.html">code
+analyzer</a>. 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 <b>offset</b> is negative the
+simulator goes backward and skips specified number of
+instructions. Default value of
 <b>start</b> parameter is last address which was listed by previous
 <b>dis</b> command and default value of <b>offset</b> is -1. It means
 you can make continuous list repeating parameterless <b>dis</b>
@@ -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
 > <font color="#118811">dis</font>
-   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
-> <font color="#118811">bs f 0x180</font>
-> <font color="#118811">bs d 0x189</font>
+> <font color="#118811">br 0x180</font>
+> <font color="#118811">tbr 0x189</font>
 > <font color="#118811">dis 0x180 -3 10</font>
    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.
 
-
-<a name="dc"><h3>dc [start [stop]]</h3></a>
-
-Disassembled dump of code memory area. This command simply produces
-disassambled list of memory area specified by the parameters. Default
-value of <b>start</b> parameter is last address listed by previous
-<b>dc</b> command. If <b>stop</b> parameter is not given 20 lines are
-listed.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</font> 
-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
-> <font color="#118811">dc</font>
-   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
-> </pre>
-
-
-<a name="dch"><h3>dch [start [stop]]</h3></a>
-
-Hexadecimal dump of code memory area from address <b>start</b> to
-address <b>stop</b>. Default value of start address is address of
-following memory cell which was dumped by previous <b>dch</b>
-command. If <b>stop</b> parameter is not given <b>dch</b> command
-lists 10 lines 8 bytes per line.
-
-<pre>
-$ <font color="#118811">s51 remo.hex</font>
-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
-> <font color="#118811">wc remo</font>
-0013da 52 65 6d 6f             Remo
-> <font color="#118811">dch 0x13da</font>
-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..
-> </pre>
-
-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.
+<hr>
 
 
-<a name="di"><h3>di [start [stop]]</h3></a>
+<a name="di"><h3>di <i>[start [stop]]</i></h3></a>
 
-Hexadecimal dump of internal RAM area from address <b>start</b> to
-address <b>stop</b>. Default value of start address is address of
-following memory cell which was dumped by previous <b>di</b>
-command. If <b>stop</b> parameter is not given <b>di</b> command
-lists 10 lines 8 bytes per line.
+Hexadecimal dump of <b>iram</b> named address space area from address
+<b>start</b> to address <b>stop</b>. Default value of start address is
+address of following memory cell which was dumped by previous
+<b>di</b> command. If <b>stop</b> parameter is not given <b>di</b>
+command lists 10 lines 8 bytes per line.
 
 <pre>
 $ <font color="#118811">s51 remoansi.hex</font>
-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
-> <font color="#118811">sopt stopit 1</font>
-> <font color="#118811">g</font>
+0> <font color="#118811">set opt irq_stop 1</font>
+0> <font color="#118811">go</font>
 Simulation started, PC=0x000000
 Stop at 000023: (5) Interrupt
 F 000023
-> <font color="#118811">di</font>
+0> <font color="#118811">di</font>
 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 ........
-> </pre>
+0>
+</pre>
+
+<hr>
 
 
-<a name="dx"><h3>dx [start [stop]]</h3></a>
+<a name="dx"><h3>dx <i>[start [stop]]</i></h3></a>
 
-Hexadecimal dump of external RAM area from address <b>start</b> to
-address <b>stop</b>. Default value of start address is address of
-following memory cell which was dumped by previous <b>dx</b>
-command. If <b>stop</b> parameter is not given <b>dx</b> command
-lists 10 lines 8 bytes per line.
+Hexadecimal dump of <b>xram</b> named address space area from address
+<b>start</b> to address <b>stop</b>. Default value of start address is
+address of following memory cell which was dumped by previous
+<b>dx</b> command. If <b>stop</b> parameter is not given <b>dx</b>
+command lists 10 lines 8 bytes per line.
 
 <pre>
 $ <font color="#118811">s51 remoansi.hex</font>
-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
-> <font color="#118811">sopt stopit 1</font>
-> <font color="#118811">g</font>
+0> <font color="#118811">set opt irq_stop 1</font>
+0> <font color="#118811">go</font>
 Simulation started, PC=0x000000
 Stop at 000023: (5) Interrupt
 F 000023
-> <font color="#118811">dx 0x100</font>
+0> <font color="#118811">dx 0x100</font>
 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 ..$.....
-> </pre>
+0>
+</pre>
+
+<hr>
+
+
+<a name="ds"><h3>ds <i>[start [stop]]</i></h3></a>
 
+Hexadecimal dump of <b>sfr</b> named address space area from address
+<b>start</b> to address <b>stop</b>. Default value of start address is
+address of following memory cell which was dumped by previous
+<b>ds</b> command. If <b>stop</b> parameter is not given <b>ds</b>
+command lists 10 lines 8 bytes per line.
+
+<pre>
+$ <font color="#118811">s51 remo.hex</font>
+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> <font color="#118811">set opt irq_stop 1</font>
+0> <font color="#118811">go</font>
+Simulation started, PC=0x000000
+Stop at 000023: (5) Interrupt
+F 000023
+0> <font color="#118811">ds</font>
+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>
+</pre>
 
 <hr>
 
+
 </body>
 </html>
index 8bca134842dfb67e9a8bc7cf18e6965c580c1648..c4adbe9c6b4c91648977762ebab17ca84f4f49e0 100644 (file)
@@ -1,12 +1,60 @@
 <html>
 <head>
-<title>Execution commands of uCsim</title>
+<title>Execution commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
 
-<h2>Execution commands of uCsim</h2>
+<h2>Execution commands of &micro;Csim</h2>
+
+
+<a name="run"><h3>r,run,go [start [stop]]</h3></a>
+
+This command starts the execution of the simulated program.
+
+<p>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.
+
+<p>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 <b>stopit</b> option is TRUE, or fatal error
+occures or <a href="#stop">stop</a> command is used on an other
+console, or ENTER key is pressed on the console where the run command
+was issued.
+
+<p>If program execution is started the console is <i>frozen</i> 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 <a
+href="mulcons.html">multiple consoles</a> for more information.
+
+<p>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:
+
+<pre>
+$ <font color="#118811">./s51</font>
+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.
+> <font color="#118811">b 0x10</font>
+Breakpoint 1 at 0x000010: MOV   R7,A
+> <font color="#118811">b 0x20</font>
+Breakpoint 2 at 0x000020: MOV   R7,A
+> <font color="#118811">run 0x10</font>
+Warning: maybe not instruction at 0x000010
+Simulation started, PC=0x000010
+Stop at 0x000020: (104) Breakpoint
+F 0x000020
+> 
+</pre>
+
+<hr>
 
 
 <a name="stop"><h3>stop</h3></a>
@@ -38,6 +86,8 @@ commands. If it stopped by the stop command the instruction pointed by
 PC is dissassembled, see the <a href="#dis"><b>dis</b></a> command for
 description of disassembled form.
 
+<hr>
+
 
 <a name="step"><h3>s,step</h3></a>
 
@@ -61,6 +111,8 @@ under certain conditions; type `show c' for details.
 After execution of actual instruction pointed by PC the <b>step</b>
 command dumps out the register set.
 
+<hr>
+
 
 <a name="n"><h3>n,next</h3></a>
 
@@ -101,6 +153,8 @@ under certain conditions; type `show c' for details.
    000177 0f       INC   R7
 > </pre>
 
+<hr>
+
 
 <a name="pc"><h3>pc [address]</h3></a>
 
@@ -124,53 +178,10 @@ Warning: maybe not instruction at 000020
  * 000020 ff       MOV   R7,A
 > </pre>
 
+<hr>
 
-<a name="run"><h3>r,run,go [start [stop]]</h3></a>
-
-This command starts the execution of the simulated program.
-
-<p>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.
-
-<p>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 <b>stopit</b> option is TRUE, or fatal error
-occures or <a href="#stop">stop</a> command is used on an other
-console, or ENTER key is pressed on the console where the run command
-was issued.
-
-<p>If program execution is started the console is <i>frozen</i> 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 <a
-href="mulcons.html">multiple consoles</a> for more information.
-
-<p>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:
-
-<pre>
-$ ./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.
-> <font color="#118811">b 0x10</font>
-Breakpoint 1 at 0x000010: MOV   R7,A
-> <font color="#118811">b 0x20</font>
-Breakpoint 2 at 0x000020: MOV   R7,A
-> <font color="#118811">run 0x10</font>
-Warning: maybe not instruction at 0x000010
-Simulation started, PC=0x000010
-Stop at 0x000020: (104) Breakpoint
-F 0x000020
-> 
-</pre>
 
-<hr>
+<!--OK-->
 
 </body>
 </html>
index e0483de03fc95e6f09ba5eb527ef798c6d375437..fd0adf93237cdb91e4f703e214a5037ff5527d39 100644 (file)
 <html>
 <head>
-<title>General commands of uCsim</title>
+<title>General commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
-<h2>General commands of uCsim</h2>
+<h2>General commands of &micro;Csim</h2>
 
 
-<p>Every command which changes content of ROM area such as <b><a
-href="#dl">dl</a></b> or <b><a href="cmd_set#set_memory">set
-memory</a></b> deletes result of code analyzer and causes to
-re-analyze the code.
+<a name="conf"><h3>conf</h3></a>
 
+Conf command can be used to display different kind of information
+about &micro;Csim. It can be followed by a subcommand:
 
-<a name="show"><h3>show</h3></a>
+<p><a href="#conf_">conf</a>
+<br>conf <a href="#conf_objects">objects</a>
 
-Show command can be used to display different kind of information. It
-must be followed by a subcommand. Subcommands are:
+<blockquote>
 
-<p>show <a href="#show_copying">copying</a>
-<br>show <a href="#show_warranty">warranty</a>
+<a name="conf_"><h4>conf</h4></a>
 
+This command (without a subcommand) prints out configuration of the
+simulator:
 
-<a name="show_copying"><h4>show copying</h4></a>
+<pre>
+0> <font color="#118811">conf</font>
+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>
+</pre>
 
-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.
 
+<a name="conf_objects"><h4>conf <i>objects</i></h4></a>
 
-<a name="show_warranty"><h4>show warranty</h4></a>
+This command is for development only.
 
-This command prints out last 2 point of the license ("NO WARRANTY"
-message).
+</blockquote>
 
+<hr>
 
-<a name="dl"><h3>download,dl</h3></a>
 
-Download command. It is same as <a href="#l">load</a> 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 <b>download</b> and <b>dl</b>.
+<a name="h"><h3>?,help <i>[command]</i></h3></a>
+
+Help command. It prints out short description of the commands.
+
+<p>If a command name is given as parameter then &micro;Csim prints out all
+command that has similar names:
 
 <pre>
-$ <font color="#118811">s51 -V</font>
-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.
-> <font color="#118811">do
-:03000000020003F8
-:1000030075812078207600D8FC900000AE83AF8203
-:100013009000001200416005E4F0A380F690009F79
-:1000230012004A9000A312004A9000A712006890A1
-:1000330000AD12006875D0001200B50200B3EF6581
-:10004300827003EE658322E493F8740193F97402DA
-:1000530093FE740393F5828E83E869700122E4931F
-:10006300F6A30880F4E493FC740193FD740293FEF9
-:10007300740393FF740493F8740593F582888312D1
-:100083000041700122E493A3A883A9828C838D820B
-:10009300F0A3AC83AD828883898280E3212100B5FC
-:1000A300212100B5000000B500B5000000B500B582
-:0200B30080FECD
-:1000B5007520117501AA850120750102850120228F
-:00000001FF</font>
-197 bytes loaded
-> </pre>
+0> <font color="#118811">? s</font>
+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> <font color="#118811">? s o</font>
+show option [name] Show internal data of options
+set option name|nr value
+                   Set value of an option
+0> 
+</pre>
+
+Some commands have more than one name which can produce interesting
+result:
+
+<pre>
+0> <font color="#118811">? t r</font>
+timer delete id    Delete a timer
+timer start id     Start a timer
+0> 
+</pre>
+
+It looks that names of listed subcommands start with no "r" but take a
+closer look on that commands:
+
+<pre>
+0> <font color="#118811">? t d</font>
+timer delete id    Delete a timer
+Names of command: delete remove
+long help of timer delete
+0> <font color="#118811">? t start</font>
+timer start id     Start a timer
+Names of command: run start
+long help of timer run
+0> </pre>
+
+<p>If parameter is unique name of a command then long description of
+the command is printed out.
+
+<hr>
 
 
 <a name="q"><h3>quit</h3></a>
@@ -92,6 +128,8 @@ under certain conditions; type `show c' for details.
 > <font color="#118811">q</font>
 $ </pre>
 
+<hr>
+
 
 <a name="kill"><h3>kill</h3></a>
 
@@ -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.
 
+<hr>
 
-<a name="h"><h3>?,help [command]</h3></a>
 
-Help command. It prints out short description of the commands.
+<a name="exec"><h3>exec <i>file</i></h3></a>
 
-<p>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:
 
-<p>If parameter is unique name of a command then long description of
-the command is printed out.
+<pre>
+drdani@emma:~$ <font color="#118811">cat /tmp/x</font>
+get opt
+quit
+conf
+drdani@emma:~$ <font color="#118811">s51</font>
+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> <font color="#118811">exec "/tmp/x"</font>
+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> 
+</pre>
 
+<hr>
 
-<a name="reset"><h3>reset</h3></a>
 
-Reset command. It resets the microcontroller. It has same effect as
-active signal on the RST pin.
+<a name="expression"><h3>expression <i>expr</i></h3></a>
+
+Executes "expr" as an expression. For more about expressions, see <a
+href="syntax.html">command syntax</a>.
 
 <pre>
-$ <font color="#118811">s51 -V remoansi.hex</font>
-ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+0> <font color="#118811">expr 1 + 2</font>
+3
+0> <font color="#118811">expr xram[256*dph+dpl]= &amp;sp</font>
+129
+0> 
+</pre>
+
+
+<hr>
+
+
+<a name="show"><h3>show</h3></a>
+
+Show command can be used to display different kind of information. It
+must be followed by a subcommand. Subcommands are:
+
+<p>show <a href="#show_copying">copying</a>
+<br>show <a href="#show_warranty">warranty</a>
+<br>show <a href="#show_option">option</a>
+<br>show <a href="#show_error">error</a>
+
+<blockquote>
+
+<a name="show_copying"><h4>show copying</h4></a>
+
+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.
+
+<hr>
+
+<a name="show_warranty"><h4>show warranty</h4></a>
+
+This command prints out last 2 point of the license ("NO WARRANTY"
+message).
+
+<hr>
+
+<a name="show_option"><h4>show option</h4></a>
+
+This command is for development only.
+
+<hr>
+
+<a name="show_error"><h4>show error</h4></a>
+
+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
+<a href="#set_error"><b>set error</b></a> command. Errors are
+organized in parent-child relationship. Childs are listed under the
+parent:
+
+<pre>
+0> <font color="#118811">sh er</font>
+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> </pre>
+
+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:
+
+<dl><dt><b>on</b></dt> <dd>state is ON
+
+<dt><b>off</b><dt> <dd>state is OFF
+
+<dt><b>unset</b></dt> <dd>state is inherited from the parent.
+</dl>
+
+If state is <b>ON</b> and the event happens, it is reported. If state
+is <b>OFF</b> then the event is silently ignored.
+
+</blockquote>
+<hr>
+
+
+<a name="get"><h3>get</h3></a>
+
+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:
+
+<p>get <a href="#get_sfr">sfr</a>
+<br>get <a href="#get_option">option</a>
+
+
+<blockquote>
+
+<a name="get_sfr"><h4>get sfr <i>address...</i></h4></a>
+
+This command can be used to check values of SFR location(s) if SFR
+exists in simulated memory. Note that <a
+href="cmd_dump.html#dump_memory">dump memory</a> or <a
+href="cmd_dump.html#ds">ds</a> can be used as well.
+
+<p>Parameters are interpreted as SFR names or addresses and values of
+addressed locations are dumped out.
+
+<pre>
+$ <font color="#118811">s51 </font>
+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
-> <font color="#118811">dr</font>
-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
-> <font color="#118811">s 2</font>
-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
-> <font color="#118811">res</font>
-> <font color="#118811">dr</font>
-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> <font color="#118811">get sfr pcon p1 0 0x80 kahd scon 256</font>
+0x87 00 .
+0x90 ff .
+Warning: Invalid address 0
+0x80 ff .
+Warning: Invalid address kahd
+0x98 00 .
+Warning: Invalid address 256
+0> </pre>
+
+<hr>
+
+
+<a name="get_option"><h4>get option <i>[name]</i></h4></a>
+
+Get actual value of option(s). Some options can be set by <a
+href="#set_option"><b>set option</b></a> to modify behavior of the
+simulator. Using <b>get option</b> 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.
+
+<pre>
+$ <font color="#118811">s51 -V</font>
+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> <font color="#118811">get opt</font>
+ 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> 
+</pre>
+
+First element of the list is the number of the option. It is followed
+by name of the option (<b>debug</b>, <b>irq_stop</b>, etc.). Number or
+the name can be used to identify the option in
+<b>get option</b> and <a href="#set_option"><b>set option</b></a>
+command. Next element shows which part of the simulator created the
+option.
+
+<p>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.
+
+<p>Last part describes the option.
+
+<p>Some options can have same name. An example is the <b>debug</b>
+option. One is created by the application to store value given by -V
+(see <a href="invoke.html">invokation</a>). This will be used as
+default value when a new instance of a console is created:
+
+<pre>
+$ <font color="#118811">cat /tmp/x</font>
+get opt debug
+$ <font color="#118811">s51</font>
+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> <font color="#118811">get opt debug</font>
+ 3. debug(by console0): FALSE - Debug messages to console0
+ 4. debug(by application): FALSE - Print debug messages (-V)
+0> <font color="#118811">set opt 4 1</font>
+0> <font color="#118811">get opt debug</font>
+ 3. debug(by console0): FALSE - Debug messages to console0
+ 4. debug(by application): TRUE - Print debug messages (-V)
+0> <font color="#118811">exec "/tmp/x"</font>
+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> 
+</pre>
+
+</blockquote>
+
+<hr>
+
+
+<a name="set"><h3>set</h3></a>
+
+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:
+
+<p>set <a href="#set_option">option</a>
+<br>set <a href="#set_error">error</a>
+<br>set <a href="#set_memory">memory</a>
+<br>set <a href="#set_bit">bit</a>
+<br>set <a href="#set_hardware">hardware</a>
+
+
+<blockquote>
+
+<a name="set_option"><h4>set option <i>name|nr value</i></h4></a>
+
+<p>Set option value. Options described at (<a
+href="#get_option"><b>get option</b></a>) 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 <tt>1</tt>, <tt>t</tt>,
+<tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
+it will be FALSE.
+
+<pre>
+$ <font color="#118811">s51 -V</font>
+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.
+> <font color="#118811">get opt</font>
+ 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
+> <font color="#118811">set opt debug f</font>
+Ambiguous option name, use number instead
+> <font color="#118811">set opt 3 f</font>
+> <font color="#118811">get opt debug</font>
+ 3. debug(by console0): FALSE - Debug messages to console0
+ 4. debug(by application): TRUE - Print debug messages (-V)
 > </pre>
 
+<hr>
+
+
+<a name="set_error"><h4>set error <i>error_name
+on|off|unset</i></h4></a>
+
+This command can be used to set if an error event should be reported
+or not. Actual settings can be retrieved by <a href="show_error">show
+error</a> command.
+
+<hr>
+
+
+<a name="set_memory"><h4>set memory <i>memory_type address
+data...</i></h4></a>
+
+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 <a
+href="cmd_general.html#info_memory">info memory</a> command. Chips and
+address spaces can be used as well.
+
+<p>Second parameter specifies start address of the modification.
+
+<p>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 <a href="syntax.html">syntax</a> for more
+details.
+
+<p>Modified memory locations will be dumped out.
+
+<pre>
+0> <font color="#118811">set mem xram 1 "ab\tcd\0ef\012ghq" 2 "ABC"</font>
+0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
+0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
+0> <font color="#118811">set mem sfr pcon 0x34</font>
+0x87 34                      4
+0> <font color="#118811">set mem xram_chip 1 2</font>
+0x0001 02                      .
+0> </pre>
 
-<a name="where"><h3>where,Where memory_type data...</h3></a>
+<hr>
 
-Searching for some data in memory. First parameter specifies
-memory. Class name of the memory must be used, it can be checked using
-<a href="cmd_general.html#conf">conf</a> command which lists size and
-class name of all available memories.
 
-<p>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.
+<a name="set_bit"><h4>set bit <i>address 0|1</i></h4></a>
 
-<p><b>where</b> command do case unsensitive search while <b>Where</b>
-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 <i>address<b>.</b>bitnumber</i> format where
+<i>address</i> addresses SFR area and <i>bitnumber</i> 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.
 
-<p>Search is done in whole memory and all matches are dumped out.
+<p>Second parameter interpreted as 1 if it is not zero.
+
+<p>Modified memory location is dumped out.
 
 <pre>
-$ <font color="#118811">/s51</font>
+$ <font color="#118811">s51 </font>
 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.
-> <font color="#118811">set mem x 20 "Dani d ani D ani dani Dani"</font>
-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
-> <font color="#118811">where x "dani"</font>
-0x0014 44 61 6e 69             Dani
-0x0025 64 61 6e 69             dani
-0x002a 44 61 6e 69             Dani
-> <font color="#118811">Where x "d ani"</font>
-0x0019 64 20 61 6e 69          d ani
-> </pre>
+> <font color="#118811">set bit tf1 1</font>
+0x88 80 .
+> <font color="#118811">set bit 130 0</font>
+0x80 fb .
+> <font color="#118811">set bit pcon.2 1</font>
+0x87 04 .
+> <font color="#118811">set bit 10.7 1</font>
+0x0a 80 .
+> 
+</pre>
 
+<hr>
 
-<a name="conf"><h3>conf</h3></a>
 
-This command prints out configuration of the simulator:
+<a name="set_hardware"><h4>set hardware <i>hardware_id data</i></h4></a>
+
+This command can be used to set value into a hardware element of the
+controller (<a href="#conf">conf</a> command lists them).
+
+<p>Actually only <b>port</b> 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.
 
 <pre>
-> <font color="#118811">conf</font>
-ucsim version 0.2.37
+0> <font color="#118811">conf</font>
 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> <font color="#118811">set hw port[0] 12</font>
+0> <font color="#118811">i h po[0]</font>
+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> <font color="#118811">set hw port[0] 23</font>
+0> <font color="#118811">i h po[0]</font>
+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> <font color="#118811">set hw irq[0] 12</font>
+Nothing to do
+0> 
 </pre>
 
-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.
+</blockquote>
+
+<hr>
 
 
 <a name="state"><h3>state</h3></a>
@@ -244,20 +586,45 @@ Idle times and main program.
 <p>Last line infroms about maximum value of the stack pointer and a
 "not very well" calculated average value of it.
 
+<hr>
+
 
-<a name="file"><h3>file,load "FILE"</h3></a>
+<a name="reset"><h3>reset</h3></a>
 
-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.
 
 <pre>
-> <font color="#118811">file "../../remo.hex"</font>
-55470 words read from ../../remo.hex
-> 
-</pre>
+$ <font color="#118811">s51 -V remoansi.hex</font>
+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
+> <font color="#118811">i r</font>
+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
+> <font color="#118811">s</font>
+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
+> <font color="#118811">s</font>
+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
+> <font color="#118811">res</font>
+> <font color="#118811">i r</font>
+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
+> </pre>
 
-Don't forget to enclose file name in quotes to make the parameter to
-be a string.
+<hr>
 
 
 <a name="info"><h3>info</h3></a>
@@ -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:
 
-<p>info <a href="#info_bp">breakpoints</a>
-<br>info <a href="#info_reg">registers</a>
-<br>info <a href="#info_hw">hardware</a>
+<p>info <a href="#info_breakpoints">breakpoints</a>
+<br>info <a href="#info_registers">registers</a>
+<br>info <a href="#info_hardware">hardware</a>
+<br>info <a href="#info_stack">stack</a>
+<br>info <a href="#info_memory">memory</a>
 
+<blockquote>
 
-<a name="info_bp"><h4>info breakpoints</h4></a>
+<a name="info_breakpoints"><h4>info breakpoints</h4></a>
 
 This subcommand prints out information about breakpoints:
 
 <pre>
-> <font color="#118811">b 12</font>
+0> <font color="#118811">b 12</font>
 Breakpoint 1 at 0x00000c: MOV   R7,A
-> <font color="#118811">tb 43</font>
+0> <font color="#118811">tb 43</font>
 Breakpoint 2 at 0x00002b: MOV   R7,A
-> <font color="#118811">bse ws f 0x80</font>
-> <font color="#118811">i b</font>
+0> <font color="#118811">b sfr w 0x80</font>
+0> <font color="#118811">i b</font>
 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
 </pre>
 
 As you see above, the command can be shortened to "i b". The list of
 breakpoints contains 7 columns:
 
-<dl><dt><b>Num</b> <dd>Number of the breakpoint. Normal and event
-breakpoints are numbered separately.
+<dl><dt><b>Num</b> <dd>Number of the breakpoint.
 
 <dt><b>Type</b> <dd>This column shows type of the breakpoint. It can
 be <i>fetch</i> for normal breakpoints or <i>event</i> for event
@@ -317,7 +686,10 @@ breakpoints it contains type of event.
 
 </dl>
 
-<a name="info_reg"><h4>info registers</h4></a>
+<hr>
+
+
+<a name="info_registers"><h4>info registers</h4></a>
 
 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.
 <p>Following line shows indirect addressing registers X, Y, and Z as
 well as pointed memory values.
 
-<p>Last line is disassembled instruction ap PC.
+<p>Last line is disassembled instruction at PC.
 
-<a name="info_hw"><h4>info hardware|hw identifier</h4></a>
+<h5>Registers of Z80 family</h5>
+
+<pre>
+$ <font color="#118811">sz80</font>
+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> <font color="#118811">i r</font>
+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> 
+</pre>
+
+<h5>Registers of XA family</h5>
+
+<pre>
+$ <font color="#118811">sxa</font>
+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> <font color="#118811">i r</font>
+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> 
+</pre>
+
+<h5>Registers of HC08 family</h5>
+
+<pre>
+$ <font color="#118811">shc08</font>
+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> <font color="#118811">i r</font>
+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> 
+</pre>
+
+<hr>
+
+
+<a name="info_hardware"><h4>info hardware|hw <i>identifier</i></h4></a>
 
 This subcommand prints out information about a unit of the
 controller. <b>identifier</b> specifies hardware element. One form of
 it is a name. Names of hardware elements can be checked by <a
 href="#conf">conf</a> 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 <a href="#conf">conf</a> command.
 
 <p>Ouput format of this command depends on CPU family and type of the
@@ -414,12 +838,12 @@ controller even in the same CPU family.
 
 <pre>
 $ <font color="#118811">s51 -t 51</font>
-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.
-> <font color="#118811">conf</font>
-ucsim version 0.2.38-pre2
+0> <font color="#118811">conf</font>
+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"
-> <font color="#118811">i h port[2]</font>
+  _51_dummy[0]
+0> <font color="#118811">i h port[2]</font>
 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)
-> <font color="#118811">i h t[0]</font>
+0> <font color="#118811">i h t[0]</font>
 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
-> <font color="#118811">i h u</font>
+0> <font color="#118811">i h u</font>
 uart[0] Shift, fixed clock MultiProc=none irq=dis prio=0
 Receiver OFF RB8=0 irq=0
 Transmitter TB8=0 irq=0
-> 
+0
 </pre>
 
 Timer #2 differs a little bit from other timers of MCS51:
 
 <pre>
 $ <font color="#118811">s51 -t 52</font>
-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.
-> <font color="#118811">i h timer0</font>
+0> <font color="#118811">i h timer0</font>
 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
-> <font color="#118811">i h t[2]</font>
+0> <font color="#118811">i h t[2]</font>
 timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
-> 
+0
 </pre>
 
+<hr>
 
-<a name="timer"><h3>timer a|d|g|r|s|v id [value]</h3></a>
-
-Handling of timers. First parameter of timer command determines the
-operation which can be
-
-<dl><dt><b>add (or simply a)</b> <dd>to create a new timer. New timers
-are turned ON by default and initialized to value 0.
-
-<dt><b>del (or simply d)</b> <dd>to remove a timer if you don't need
-it any more.
-
-<dt><b>get (or simply g)</b> <dd>to get value of timers. See comment
-below.
-
-<dt><b>run (or simply r)</b> <dd>to turn a timer ON.
-
-<dt><b>stop (or simply s)</b> <dd>to turn a timer OFF. It still exist
-but doesn't count xtal periods.
-
-<dt><b>value (or simply v)</b> <dd>to set value of the timer (number
-of xtal periods). `param' is the new value.
 
-</dl>
+<a name="info_stack"><h4>info stack</h4></a>
 
-<b>id</b> 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.
 
 <pre>
-> <font color="#118811">tim a 3</font>
-> <font color="#118811">tim g 0</font>
-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)
-> <font color="#118811">tim a "a"</font>
-> <font color="#118811">tim g 0</font>
-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)
-> 
+$ <font color="#118811">s51 ~/remo.hex</font>
+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> <font color="#118811">set opt irq_stop true</font>
+0> <font color="#118811">r</font>
+Simulation started, PC=0x000000
+Stop at 0x000023: (2) Interrupt
+F 0x000023
+0> <font color="#118811">i s</font>
+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> 
 </pre>
 
-If you use 0 as timer id in "get" operation, simulator prints out
-value of all timers including predefined ones.
-
-
-<a name="set"><h3>set</h3></a>
-
-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:
-
-<p>set <a href="#set_memory">memory</a>
-<br>set <a href="#set_bit">bit</a>
-<br>set <a href="#set_port">port</a>
-<br>set <a href="#set_option">option</a>
-
+First column shows the operation which can be <b>call</b> or
+<b>push</b> or <b>intr</b> (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 <b>called</b> address is
+printed, not the pushed one! Last column is the instruction which has
+been executed when the operation occured.
 
-<a name="set_memory"><h4>set memory memory_type address
-data...</h4></a>
+<hr>
 
-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 <a
-href="cmd_general.html#conf">conf</a> command.
 
-<p>Second parameter specifies start address of the modification.
+<a name="info_memory"><h4>info memory</h4></a>
 
-<p>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 <a href="syntax.html">syntax</a> for more
-details.
-q
-<p>Modified memory locations are dumped out.
+This command shows information about <a href="memory.html">memory
+system</a>: chips, address spaces and address decoders.
 
 <pre>
 $ <font color="#118811">s51</font>
-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.
-> <font color="#118811">set mem x 1 "ab\tcd\0ef\012ghq" 2 "ABC"</font>
-0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
-0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
-> <font color="#118811">set mem sfr pcon 0x34</font>
-0x87 34                      4
-> </pre>
-
+0> <font color="#118811">i m</font>
+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> 
+</pre>
 
-<a name="set_bit"><h4>set bit address 0|1</h4></a>
+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 <a href="cmd_dump.html#dump">dump</a>, <a href="#set_memory">set
+memory</a>, 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 <i>address<b>.</b>bitnumber</i> format where
-<i>address</i> addresses SFR area and <i>bitnumber</i> 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.
+<p>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 "-&gt;" sign the name and the address of the memory
+chip is printed where the decoder maps the area of the address space.
 
-<p>Second parameter interpreted as 1 if it is not zero.
-
-<p>Modified memory location is dumped out.
+<p>Memory system of other controller family can be different.
 
 <pre>
-$ <font color="#118811">s51 </font>
-ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
-ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+$ <font color="#118811">savr</font>
+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.
-> <font color="#118811">set bit tf1 1</font>
-0x88 80 .
-> <font color="#118811">set bit 130 0</font>
-0x80 fb .
-> <font color="#118811">set bit pcon.2 1</font>
-0x87 04 .
-> <font color="#118811">set bit 10.7 1</font>
-0x0a 80 .
-> 
+0> <font color="#118811">i m</font>
+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> 
 </pre>
 
+</blockquote>
 
-<a name="set_port"><h4>set port hardware_id data</h4></a>
+<hr>
 
-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.
 
-<pre>
-> <font color="#118811">set port 0 12</font>
-> <font color="#118811">i h po[0]</font>
-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)
-> <font color="#118811">set port port[0] 23</font>
-> <font color="#118811">i h po[0]</font>
-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)
-> </pre>
+<a name="timer"><h3>timer</i></h3></a>
 
+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.
 
-<a name="set_option"><h4>set option name value</h4></a>
+<p>Known subcommands are:
 
-<p>Set option value. Options described at (<a
-href="#get_option"><b>get option</b></a>) 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 <tt>1</tt>, <tt>t</tt>,
-<tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
-it will be FALSE.
+<p>timer <a href="#timer_add">add</a>
+<br>timer <a href="#timer_delete">delete</a>
+<br>timer <a href="#timer_get">get</a>
+<br>timer <a href="#timer_start">start</a>
+<br>timer <a href="#timer_stop">stop</a>
+<br>timer <a href="#timer_set">set</a>
 
-<pre>
-$ <font color="#118811">s51 -V</font>
-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.
-> <font color="#118811">get opt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug FALSE Debug messages appears on this console.
-> <font color="#118811">set opt debug t</font>
-> <font color="#118811">get opt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug TRUE Debug messages appears on this console.
-> </pre>
+<p>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.
 
+<blockquote>
 
-<a name="get"><h3>get</h3></a>
+<a name="timer_add"><h4>timer add|create|make <i>id [direction
+[in_isr]]</i></h4></a>
 
-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. <b>Direction</b> is an integer (can be
+positive or negative) number which is added to the actual value in
+every step. If <b>in_isr</b> is TRUE the timer counts only when
+execution is in an interrupt handler.
 
-<p>get <a href="#get_sfr">sfr</a>
-<br>get <a href="#get_option">option</a>
+<hr>
 
 
-<a name="get_sfr"><h4>get sfr address...</h4></a>
+<a name="timer_delete"><h4>timer delete|remove <i>id</i></h4></a>
 
-This command can be used to check values of SFR location(s) if SFR
-exists in simulated memory. Note that <a
-href="cmd_dump.html#dump_memory">dump memory</a> or <a
-href="cmd_dump.html#ds">ds</a> can be used as well.
+To remove a timer if you don't need it any more.
 
-<p>Parameters are interpreted as SFR names or addresses and values of
-addressed locations are dumped out.
+<hr>
 
-<pre>
-$ <font color="#118811">s51 </font>
-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.
-> <font color="#118811">get sfr pcon p1 0 0x80 kahd scon</font>
-0x87 00 .
-0x90 ff .
-0x00 00 .
-0x80 ff .
-Warning: Invalid address kahd
-0x98 00 .
-> </pre>
 
+<a name="timer_get"><h4>timer get <i>[id]</i></h4></a>
 
-<a name="get_option"><h4>get option name</h4></a>
+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 <a
-href="#set_option"><b>set option</b></a> to modify behavior of the
-simulator. Using <b>get option</b> 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.
+<hr>
 
-<pre>
-$ <font color="#118811">s51 -V</font>
-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.
-> <font color="#118811">get opt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug FALSE Debug flag.
-> <font color="#118811">get opt stopit</font>
-stopit FALSE Stop if interrupt accepted.
-> </pre>
 
-This version of the simulator knows about three options. First element
-of the list is name of the option (<b>verbose</b>, <b>debug</b> and
-<b>stopit</b>). This name can be used to identify the option in
-<b>gopt</b> and <a href="#set_option"><b>set option</b></a>
-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.
+<a name="timer_start"><h4>timer start|run <i>id</i></h4></a>
 
-<dl><dt><b>verbose</b> <dd>?
+To turn a timer ON.
 
-<dt><b>debug</b> <dd>Debug flag can be set by <b>-V</b> 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.
+<hr>
 
-<dt><b>stopit</b> <dd>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.
 
-</dl>
+<a name="timer_stop"><h4>timer stop <i>id</i></h4></a>
+
+To turn a timer OFF. It still exist but doesn't count xtal periods.
 
+<hr>
 
-<a name="fill"><h3>fill memory_type start end data</h3></a>
 
-Fill memory region with specified data. First parameter specifies
-memory. Class name of the memory must be used, it can be checked using
-<a href="cmd_general.html#conf">conf</a> command which lists size and
-class name of all available memories.
+<a name="timer_set"><h4>timer set|value <i>id value</i></h4></a>
 
-<p><b>start</b> and <b>end</b> parameters specify first and last
-address of the memory region to be filled.
+To set value of the timer (number of xtal periods). <b>value</b> is
+the new value.
 
-<p><b>data</b> parameter specifies the data which is used to fill the
-memory region.
 
 <pre>
-$ <font color="#118811">s51</font> 
-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.
-> <font color="#118811">fill x 12 0x12 0x56</font>
-> <font color="#118811">dump x 0 0x20</font>
-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                      .
-> </pre>
+0> <font color="#118811">tim a 3</font>
+0> <font color="#118811">tim g</font>
+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> <font color="#118811">tim a "a"</font>
+0> <font color="#118811">tim g</font>
+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> 
+</pre>
 
+</blockquote>
 
 <hr>
 
+
 </body>
 </html>
index f9376994c9889131d59a57cb7b080a48765bf8f3..b4130b7b98b9b3289616f008773ec69992a12ea8 100644 (file)
@@ -1,11 +1,11 @@
 <html>
 <head>
-<title>Removed commands of uCsim</title>
+<title>Removed commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
-<h2>Removed commands of uCsim</h2>
+<h2>Removed commands of &micro;Csim</h2>
 
 <font color="gray">
 
@@ -584,8 +584,6 @@ Port2 11111111 0xff 255 .    Port3 11110111 0xf7 247 .
 000088    TR1 1
 > </pre>
 
-</font>
-
 
 <a name="sp"><h3>sp port data</h3></a>
 
index 053627a2bd5f1bf92f73070fdef8435adf723acc..fa96645a7dd0017572f7832dadbef4a2aeb278c5 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>Set commands of uCsim</title>
+<title>Set commands of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
index f50252cc4bd13b536949509db908ba7625f5aa5c..c77ed6b74fe385290c58149dc830b9a8e6790613 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: Command Reference</title>
+<title>&micro;Csim: Command Reference</title>
 </head>
 
 <body bgcolor="white">
index 5c8820b7935a7c7bb7fc9fa96091890b50aee6b4..75886a5c242d8560d21d9970f19ce68216e2b7ca 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: CPU types</title>
+<title>&micro;Csim: CPU types</title>
 </head>
 
 <body bgcolor="white">
index 726c17620b59e303786e8062033641a6b0a76990..4836fac0292ca68005f3245bc074cc1f33a2b436 100644 (file)
@@ -18,12 +18,14 @@ developer</a> ]
 
 <h1>Software simulator for microcontrollers</h1>
 
-<b><i>uCsim</i></b> can be used to simulate microcontrollers. It
-supports MCS51 family. AVR and Z80 support is under development.
+<b><i>&micro;Csim</i></b> can be used to simulate microcontrollers. It
+supports MCS51 family. AVR core, Z80, HC08 and XA are supported by
+UNIX version only.
 
 <a name="download"><h2>Download</h2></a>
 
-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.
 
 <li>Compile the package with <tt><b>make</b></tt> command.
 
-<li>Install executable <b>s51</b> to any directory you want. It can be
-done with <tt><b>make install</b></tt> command which will place files
-in installation directory specified with <tt><b>--<!-- --
+<li>Install executables <b>s51</b>, <b>savr</b>, <b>shc08</b>,
+<b>sxa</b>, <b>sz80</b> to any directory you want. It can be done with
+<tt><b>make install</b></tt> command which will place files in
+installation directory specified with <tt><b>--<!-- --
 -->prefix=<i>dir</i></b></tt> option of
 <tt><b>configure</b></tt>. 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.
 <li><a href="serial.html">Serial interfaces</a>. <br>The simulator can
 virtually connect a terminal to serial interface of the simulated CPU.
 
+<li><a href="memory.html">Memory simulation</a>. <br>Simulated CPU
+provides address spaces, storage is simulated by memory chips, address
+decoders conects them together.
+
 <li><a href="syntax.html">Command syntax</a> and <a
 href="cmd.html">command reference</a>. <i>(Now updated up to
-0.2.38)</i> <br>The simulator can be controlled via a command line
+0.5.0)</i> <br>The simulator can be controlled via a command line
 interface. It accepts simple commands.
 
 </ul>
index 024b138e648c5827cae7a01046d4a1cdd896e9cd..58f1affd1a0009d563b5bcd4293a10531034018b 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: Invokation</title>
+<title>&micro;Csim: Invokation</title>
 </head>
 
 <body bgcolor="white">
@@ -13,6 +13,8 @@ families:
 <p>MCS51 family is simulated by <b>s51</b>
 <br>AVR family is simulated by <b>savr</b>
 <br>Z80 processor is simulated by <b>sz80</b>
+<br>XA family is simulated by <b>sxa</b>
+<br>HC08 processor is simulated by <b>shc08</b>
 
 <p>The simulator can be started in the following way:
 
@@ -56,8 +58,8 @@ computer.
 <a name="Zoption"><dt><tt><b>-Z portnum</b></tt></a>
 
 <dd>Listen for incoming connections on port <b>portnum</b>. Using this
-option <i>uCsim</i> can serve multiple consoles. You can get a console
-by simply telnet into machine running <i>uCsim</i> to port
+option <i>&micro;Csim</i> can serve multiple consoles. You can get a console
+by simply telnet into machine running <i>&micro;Csim</i> to port
 <b>portnumber</b>. This option is not available on platforms which
 doesn't support BSD networking.
 
@@ -75,7 +77,7 @@ specify a teminal with -s option.
 <dt><tt><b>-S in=file,out=file</b></tt>
 
 <dd>Using this option you can specify different files for input and
-output streams that <i>uCsim</i> uses to simulate microprocessor's
+output streams that <i>&micro;Csim</i> uses to simulate microprocessor's
 serial interface.
 
 <br>See <a href="serial.html">more about serial interface
index 771c47c5159ba2181b89a125c9c8d5e8b4a4ba4a..a5888da0b649963df3af3fcbc0c816a131c4c1ee 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: Multiple Consoles</title>
+<title>&micro;Csim: Multiple Consoles</title>
 </head>
 
 <body bgcolor="white">
@@ -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.
 
-<p>To run <i>uCsim</i> in the background you have to use <a
+<p>To run <i>&micro;Csim</i> in the background you have to use <a
 href="invoke.html#Zoption">-Z</a> option for the simulator:
 
 <pre>
index 7707d7cbe293c42be5998ab65c72046d18a8849e..77664466240d635de5c82d9922888c21bc09ce9a 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>UCSIM: Serial Interafces</title>
+<title>&micro;Csim: Serial Interafces</title>
 </head>
 
 <body bgcolor="white">
index cd4f62a0fa01a5fa7f55b444dfd3ce3f33d5e278..cf61ae8d0668fbbe769fc8735fa4fb0f7ccb118e 100644 (file)
 <html>
 <head>
-<title>Command syntax of uCsim</title>
+<title>Command syntax of &micro;Csim</title>
 </head>
 
 <body bgcolor="white">
 
-<h2>Command syntax of uCsim</h2>
+Content:
 
-<h3>Command names</h3>
+<ul><li><a href="#syntax">Syntax</a>
+<li><a href="#expr">Expressions</a>
+<li><a href="#redir">Redirection</a>
+</ul>
+
+
+<a name="syntax"><h2>Command syntax of &micro;Csim</h2></a>
+
+&micro;Csim uses a very simple command interpreter. Command can be entered
+after &micro;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.
+
+<p>Syntacticaly parameters can be a string, bit name, array, number or
+symbol. Interpretation of these syntactical elements depends on actual
+command.
+
+<p>If the command line can not be recognized as a known command,
+&micro;Csim tries to evaluate the command line as an
+<i>expression</i>. <a href="#expr">See below</a> for information about
+operands and operators which can be used in expressions.
+
+
+<a name="command_name"><h3>Command names</h3></a>
+
+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:
+
+<pre>
+> <font color="green">help run</font>
+run [start [stop]] Go
+Names of command: <b>go r run</b>
+...
+</pre>
+
+Some commands just groups other commands. These commands have a set of
+so-called <i>sub-commands</i>. Sub-command must be second word in the
+command line. For example:
+
+<pre>
+> <font color="green">help set</font>
+set <b>subcommand</b>     Set, see `set' command for more help
+Names of command: set
+long help of set
+> <font color="green">set</font>
+"set" must be followed by the name of a subcommand
+List of subcommands:
+<b>set option</b> name|nr value
+                   Set value of an option
+<b>set error</b> on|off|unset
+                   Set value of an error
+<b>set memory</b> memory_type address data...
+                   Place list of data into memory
+<b>set bit</b> addr 0|1   Set specified bit to 0 or 1
+<b>set hardware</b> cathegory params...
+                   Set parameters of specified hardware element
+</pre>
 
 
 <h3>Type of parameters</h3>
 
-<h4>String</h4>
+<a name="string_type"><h4>String type</h4></a>
 
-<h4>Bit</h4>
+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:
 
-<h4>Array</h4>
+<pre>
+0> <font color="green">set opt 7 <b>s51&gt;</b></font>
+0s51><font color="green">set opt 7 <b>".s51&gt; "</b></font>
+0.s51> 
+</pre>
 
-<h4>Number</h4>
 
-<p>Some commands accept parameters which in most cases can be
+<a name="bit_type"><h4>Bit type</h4></a>
+
+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.
+
+<pre>
+0> <font color="green">dump <b>p1.1</b></font>
+      P1.1 0x90 ff 1
+0> <font color="green">dump <b>0x80.1</b></font>
+      P4.1 0x80 ff 1
+0> 
+</pre>
+
+
+<a name="array_type"><h4>Array type</h4></a>
+
+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:
+
+<pre>
+0> <font color="green">info hw <b>port[0]</b></font>
+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> 
+</pre>
+
+
+<a name="number_type"><h4>Number type</h4></a>
+
+Some commands accept parameters which in most cases can be
 numbers. Numbers can be entered in C-style form. If the number begins
 whith <tt><b>0x</b></tt> or <tt><b>0X</b></tt> it is interpreted as a
 hexadecimal number. If it begins with <tt><b>0</b></tt> followed by
 digits it is interpreted as octal number. In other cases it is
 interpreted as decimal number.
 
-<h4>Symbol</h4>
+
+<a name="symbol_type"><h4>Symbol type</h4></a>
+
+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 <b>symbol</b>. Symbols can be interpreted in several
+ways.
 
 
 <h3>Interpretation of parameters</h3>
 
-<h4>Address</h4>
 
-<h4>Number</h4>
+<a name="address_param"><h4>Address parameters</h4></a>
+
+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.
+
+
+<a name="number_param"><h4>Number, data parameters</h4></a>
+
+When a command expects a number it should get a number. <font
+color="red">Note</font>, that symbols is not converted to number they
+can be used as address only!
+
+
+<a name="string_param"><h4>String parameters</h4></a>
+
+Strings can be entered without quotes if they are recognized as
+srtings (see above) and do not contain spaces.
+
+
+<a name="data_list_param"><h4>Data list parameters</h4></a>
+
+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.
+
+<pre>
+> <font color="green">where xram "ab" 0x43</font>
+0xf961 61 62 63                abc
+> 
+</pre>
+
+
+<a name="memory_param"><h4>Memory parameters</h4></a>
+
+Where memory type is expected, name of the memory should be
+used. Most commands accept memory chip and address space too. See
+<a href="memory.html">memory simulation</a> for more information.
+
+
+<a name="hw_param"><h4>Hardware element parameters</h4></a>
+
+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.
+
+
+<a name="bit_param"><h4>Bit parameters</h4></a>
+
+Bits can be specified by several ways. One way is using bit type of
+command parameter:
+
+<pre>
+0> <font color="green">dump 0.2</font>
+    0x00.2 0x00 00 0
+0> <font color="green">dump 0xc3.2</font>
+    0xc3.2 0xc3 00 0
+0> <font color="green">dump p2.3</font>
+      P2.3 0xa0 ff 1
+0>
+</pre>
+
+In this way, any IRAM or SFR location can be addressed as the above
+example shows.
 
-<h4>Data</h4>
+<p>Other way is using bit address either by value or by symbolic name:
 
-<h4>String</h4>
+<pre>
+0> <font color="green">dump ea</font>
+     IE0.7 0xa8 00 0
+0> <font color="green">dump 34</font>
+    0x24.2 0x24 24 1
+0> <font color="green">dump 0xc7</font>
+   SCON1.7 0xc0 00 0
+0> 
+</pre>
 
-<h4>Data list</h4>
+Of course, only addressable bits can be accessed in this way.
 
-<h4>Memory</h4>
+<hr>
+
+
+<a name="expr"><h2>Expressions</h2></a>
+
+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):
+
+<pre>
+0> <font color="green">12*(34+56)</font>
+1080
+0> 
+</pre>
+
+
+<h3>Operands</h3>
+
+Operands of the expressions can be
+
+<ul><li>number;
+
+<li>memory (either address space, or memory chip);
+
+<li>or bit</ul>
+
+
+<h4>Number operands</h4>
+
+Numbers can be entered in decimal, octal (starting with 0 followed by
+a number), or hexadecimal (started with 0x):
+
+<pre>
+0> <font color="green">12</font>
+12
+0> <font color="green">012</font>
+10
+0> <font color="green">0x12</font>
+18
+0> 
+</pre>
+
+Numbers must be integers (floating point is not supported) and not
+bigger than the value which can be stored as <b>long int</b>.
+
+
+<h4>Memory operands</h4>
+
+Memory can be an address space location or a memory chip cell. It can
+be specified in following form:
+
+<pre>name[address]</pre>
+
+where <i>name</i> is the name of the address space or memory chip and
+<i>address</i> is an expression specifying location (index) of the
+cell.
+
+<p>Registers in SFR address space can also be specified using
+pre-defined names (symbols) of the registers.
 
-<h4>Hardware element</h4>
+<pre>
+0> <font color="green">xram[0x543]</font>
+67
+0> <font color="green">xram_chip[1347]</font>
+67
+0> <font color="green">rom[12*(34+56)]</font>
+56
+0> <font color="green">sp</font>
+7
+0> <font color="green">rom[256*dph+dpl]</font>
+88
+0> 
+</pre>
 
-<h4>Bit</h4>
+Value of the memory operand is always a positive integer number.
 
-<h4>
+
+<h4>Bit operands</h4>
+
+Bit operands are evaluated to 0 or 1. Any bit of any memory location
+can be specified as bit using following form:
+
+<pre>memory.bitnumber</pre>
+
+where <i>memory</i> is a memory location as a memory operand and
+<i>bitnumber</i> 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.
+
+<p>Alternatively, name of the bit can be used to specify named SFR
+bits.
+
+<pre>
+0> <font color="green">p0.3</font>
+1
+0> <font color="green">xram[12*(34+56)].9-2</font>
+0
+0> <font color="green">it0</font>
+0
+0> 
+</pre>
+
+
+<h3>Operators</h3>
+
+<table border="1">
+<tr><th>Type</th> <th>Operator</th> <th>Meaning</th></tr>
+<tr><td>Primary</td> <td>( )</td> <td>Group of sub-expressions</td></tr>
+<tr><td>One operand</td> <td>- &amp;</td> <td>Unary minus, address of</td></tr>
+<tr><td rowspan="2">Arithmetic</td> <td>* /</td> <td>Multiply, divide</td></tr>
+<tr> <td>+ -</td> <td>Add, substract</td></tr>
+<tr><td>Assignment</td> <td>=</td> <td>Assign to</td></tr>
+</table>
+
+Arithmetic operators and parenthesises work as usual.
+
+<p>Assigment operator can be used to modify memory cells and bits of
+the cells. Result will be the assigned value.
+
+<pre>
+0> <font color="green">p0=23</font>
+23
+0> <font color="green">i h port[0]</font>
+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> <font color="green">p0.0= 0</font>
+0
+0> <font color="green">i h p[0]</font>
+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> <font color="green">xram[256*dph+dpl]= rom[0]</font>
+108
+0> <font color="green">dump rom 0 0</font>
+0x0000 6c                      l
+0> <font color="green">dump sfr dph dph</font>
+0x83 00                      .
+0> <font color="green">dump sfr dpl dpl</font>
+0x82 00                      .
+0> <font color="green">dump xram 0 0</font>
+0x0000 6c                      l
+0> <font color="green">0x6c</font>
+108
+0> <font color="green">dump ea</font>
+     IE0.7 0xa8 00 0
+0> <font color="green">ea= 1111</font>
+1
+0> <font color="green">dump ea</font>
+     IE0.7 0xa8 80 1
+0> 
+</pre>
+
+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.
+
+<pre>
+0> <font color="green">dpl</font>
+0
+0> <font color="green">&amp;dpl</font>
+130
+0> <font color="green">ea</font>
+1
+0> <font color="green">&amp;ea</font>
+175
+0> <font color="green">256*dph+dpl</font>
+46630
+0> <font color="green">&amp;xram[256*dph+dpl]</font>
+46630
+0> 
+</pre>
 
 <hr>
 
+
+<a name="redir"><h2>Redirection</h2></a>
+
+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
+&micro;Csim doesn't allow to put redirection at the beginning of the
+command!
+
+<pre>
+$ <font color="#118811">s51 remo.hex</font>
+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> <font color="#118811">dump >/tmp/rom.dump rom</font>
+0> <font color="#118811">quit</font>
+$ <font color="#118811">cat /tmp/rom.dump</font>
+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
+$ <font color="#118811">s51 remo.hex</font>
+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> <font color="#118811">dump rom 0x50 >>/tmp/rom.dump</font>
+0> <font color="#118811">quit</font>
+$ <font color="#118811">cat /tmp/rom.dump</font>
+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....
+$ 
+</pre>
+
+
+<hr>
+
+
 </body>
 </html>
index 7f3fa5d604175fc49c6b3148f4ba3afec381dd05..a8c533bbc7f5d40bce7ca99ad00fbe83631be4ec 100644 (file)
  *
  */
 
-/* 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 <stdlib.h>
+#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<class cl_error_class *>(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"));
 }
 
 
index 99f83e81320fcc35542f5271ff71ea8e34e9659b..8e0461f7fa2b663bc08b23185c6f450ba3fca76d 100644 (file)
@@ -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 (file)
index 0000000..fa0c525
--- /dev/null
@@ -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 */
index 1c8b92826888d8a1472011f6bc9b935d38e1a235..d6d93583dea493a8b71e1e0a2edfab2a82df19b9 100644 (file)
@@ -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 */
index ff273b5d864faad423fec69150a106e469a2a91a..45c549262e67e915265a13e5179a7aba79e4108a 100644 (file)
@@ -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 */
index dbacfcf0fb087a35087dc43c1f5499f393de7e56..8565ca1175fefaa7ad3f24315675fcea1da3d579 100644 (file)
@@ -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)
index 9c71adcdc57491f8a3b0cbfa345ced8a665c5704..7afa286e4b1640a2fc770b6ef5db5194117d085c 100644 (file)
@@ -17,7 +17,7 @@ M_OR_MM         = @M_OR_MM@
 
 LIBS           = @CURSES_LIBS@ @LIBS@
 
-EXEEXT          = @EXEEXT@
+EXEEXT         = @EXEEXT@
 
 curses_ok      = @curses_ok@
 
index 5293a1745c6d74766557aa691fc51900bc3dc442..98ea1bd0b57c2a06b2a9ab1e02113eab4e7d0ad3 100644 (file)
@@ -2,6 +2,8 @@
  * to emulate the serial input and output of an 8051 controller               *
  * main.cc - the main stuff                                                   *
  ******************************************************************************/
+#include "ddconfig.h"
+
 #include <sys/types.h>
 #include <iostream>
 #include <stdlib.h>
@@ -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);
 
index 3759862afbe5725cd36d40553ac0c02ab3cd3922..8b62d78e353a7a86c7fa9b7945cda7fb63567891 100644 (file)
@@ -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@
 
index 06af92c95137d473c77925c8e743054b8e5191a9..3550cbb9ded3904e3f2268a22921a0c27be557f8 100644 (file)
@@ -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);
index eae0bb23ee3c7cfae51ddb7f0f616d3ae0b34f8f..35efadf8a7761a40ea0036f2eb80bf75d608bf7f 100644 (file)
@@ -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 (executable)
index 0000000..4f5a901
--- /dev/null
@@ -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 <gord@gnu.ai.mit.edu>, 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 <gord@gnu.ai.mit.edu>, 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 <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.4.2a
+TIMESTAMP=" (1.922.2.79 2001/11/28 21:50:31)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# 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='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS="      "}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  echo "$modename: not configured to build any kind of library" 1>&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 <<EOF
+         int main() { return 0; }
+EOF
+         $rm conftest
+         $CC -o conftest conftest.c $deplibs
+         if test $? -eq 0 ; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             name="`expr $i : '-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\"`
+               deplib_matches=`eval \\$echo \"$library_names_spec\"`
+               set dummy $deplib_matches
+               deplib_match=$2
+               if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                 newdeplibs="$newdeplibs $i"
+               else
+                 droppeddeps=yes
+                 echo
+                 echo "*** Warning: dynamic linker does not accept needed library $i."
+                 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 I believe you do not have"
+                 echo "*** because a test_compile did reveal that the linker did not use it for"
+                 echo "*** its dynamic dependency list that programs get resolved with at runtime."
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         else
+           # Error occured in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             name="`expr $i : '-l\(.*\)'`"
+            # If $name is empty we are operating on a -L argument.
+             if test -n "$name" && test "$name" != "0"; then
+               $rm conftest
+               $CC -o conftest conftest.c $i
+               # Did it work?
+               if test $? -eq 0 ; then
+                 ldd_output=`ldd conftest`
+                 libname=`eval \\$echo \"$libname_spec\"`
+                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                 set dummy $deplib_matches
+                 deplib_match=$2
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   echo
+                   echo "*** Warning: dynamic linker does not accept needed library $i."
+                   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 a test_compile did reveal that the linker did not use this one"
+                   echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                 fi
+               else
+                 droppeddeps=yes
+                 echo
+                 echo "*** Warning!  Library $i is needed by this library but I was not able to"
+                 echo "***  make it link in!  You will probably need to install it or some"
+                 echo "*** library that it depends on before this library will be fully"
+                 echo "*** functional.  Installing it before continuing would be even better."
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method
+         file_magic_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
+                     # 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:
index 413f4dbe2f0b6a5b90e76d5d51a7bfe325507e2e..b101d697e9b4b03d476fc73125da62abf8403dc1 100644 (file)
@@ -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
 # ----------------------
index 4718b7dab578b698dffd933849a43718a25a079c..91ac1aa19fdf62cbd3a209a72a4de443e060ec71 100755 (executable)
@@ -1,5 +1,8 @@
 #!/bin/sh
+
 if [ -f ${1}/devel ]; then
        shift
        echo "$@"
 fi
+
+# End of mkecho
index 1c9ad202912d4d9c2aa14b241721cf6826ab38ee..45e62cf1c38867def034ef500ef23228390d0822 100644 (file)
@@ -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 */
index c2b30692076491cb603525c0d6ae0af0991df105..da4d4baa0df9e9af014d5d883b7dacbc8bdb5451 100644 (file)
@@ -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
index 0c60e06b5a97a7569f90f26ef97c65289de7063c..4027b938a5c76ea97f646f0ceb0141563966d9a5 100644 (file)
@@ -1,4 +1,4 @@
-EXEEXT          = @EXEEXT@
+EXEEXT         = @EXEEXT@
 
 enable_51      = @enable_51@
 enable_avr     = @enable_avr@
index f747e96bbd9473988f2970dbc821bc21afc1eced..126e14db5d7e31c6f33610938cfc7f22bcfe38a7 100644 (file)
@@ -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<class cl_base *>(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<class cl_base *>(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)
 {}
 
 
index b7ccb87cc4690ab37dd4c823cb1e380e1fe985a1..317d1ce8d1fe102b384fdbe561b56badada54b9c 100644 (file)
@@ -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 (file)
index 0000000..8138260
--- /dev/null
@@ -0,0 +1,232 @@
+#include <stdio.h>
+#include <pthread.h>
+
+// 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);
+}
index 89a45c9e3d5648978a50f1c93322a3c31a13f08d..50b4f37473f6d82622324cb40253d8b2942c7cbd 100644 (file)
@@ -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
index 15eb73d55a68e363d082d966d27f48dae34df1c9..7e8da8807220b4ea25dcaf6a226dbb2826722487 100644 (file)
@@ -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;
 
index 2b6cf83e4620a5d22651a8490197ee2306b83c6b..7b55a33ad170265c594abb6ce28576b29c91e050 100644 (file)
@@ -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);
index 65e9c0ce0aea06dd3b14f236e7269a04c722be81..f09e8f259946f31541cacc011ff97d9fc971c603 100644 (file)
@@ -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 */
index 76e5f9ba37fe0370c815c366604c44da3d3a900a..4e4a80676aa2f415c40a421f1ea298076491df61 100644 (file)
@@ -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
index d33919972ee6512876c376238b5dd0ed50f1897a..23d3564138d947f9b5a0a68b317cfab8813482e2 100644 (file)
@@ -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;
 
index 36196292bf9de970b791ae43b8b2b45d1d46adb7..80aad40c9261b8364e10a5932a3620c609ec7510 100644 (file)
@@ -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));
index b2076758439e7f1bd951bd5c276eb01f74eeaff5..2b84e8c3edb25026937838c0161930488dee089b 100644 (file)
@@ -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);
index 285a746d20a9910042e8735115cf434dbae1666c..ed6f1147ef8f9ea002b61f25bbb89166d99a54ef 100644 (file)
@@ -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);
 }
 
index d7158110aa214242f1294d3894f2f2fe5c84a381..229f80cee80717fba196c39b8b434a186d4f13bf 100644 (file)
@@ -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);
index 512da92b093e0c93c6a6c9c2c561a5c07ada829e..a932e9d13ee9c9644be53a27d230a5103a530fb5 100644 (file)
@@ -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());
index 173893aa140d9fb0da9900ab2788e12aba792bcc..3497fa2cddf11a8dd0068f8856e7bdb2d27b57d0 100644 (file)
@@ -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);
index c782118b8074f633d356fc893156f6ac984fcc6a..9c5ced5169c1a0d8e50d5785e31244bf1c6394fc 100644 (file)
@@ -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);
index 37cf983cf3bc20906bd3bccbc4cf18b2d9443775..a02ad7909fb654df0e6bece1cf66834571476d85 100644 (file)
@@ -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);
index b5a55ebe631e9b23c5785eeeee2c582149726829..001d7c9db2fcb1abbd0a497c1abf1f70fd0ae5d4 100644 (file)
@@ -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);
index 11eabe48ed44d24d6432218deee197b202170709..207f5dec4b6459039226c49baa1eed0c89c5dcc7 100644 (file)
@@ -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);
index 3b5436d0c70176487f9ea3e5fd27256ab0f01045..1b32248bdac169b9647a4473979ae68a6388dc66 100644 (file)
@@ -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");
 
index f4a375bdd8e6bf805f07c27c9f841aa422649e8b..ae6dee645b2eec91275ba7989f894f8ca3262834 100644 (file)
@@ -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);
index 658ad57b28c49eee25b6414bedc5afeb0d3cb875..e4c281df590e74b312c6b8b543d4ab0e3f3b33ed 100644 (file)
@@ -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);
 }
index fddf0c8242c3c2c9a024a8dc4cac92561d9581d7..281f8c18a54fb55424e1948e1d8506c0372dd8db 100644 (file)
@@ -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");
 }
index 950041fc5503a55d9e7ada03761ad4881bd98129..56184f9ed175ff3d5446445cb73c409d617217bb 100644 (file)
@@ -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);
 
index ccb0abd343d0b6e233f24d87f6e2b6ba03b40d45..402210094fe3cca0a0a04af7dacc569f86f00afc 100644 (file)
@@ -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");
 }
index ea2ab95f23d162f073a02730deb1ef7f8c8b955f..9a215c253cdf13e343d577f2f0c69e9def74e540 100644 (file)
@@ -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");
 }
index c5cb0cdbef3e9602611f331b69fac7533aed7985..57e7b4f32ee476499ab4a806040ca21ec5ba8748 100644 (file)
@@ -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);
 
index 74d21ff7c067b31756ad5d168da45d337b91436f..3694bac3ca763b626448ab12db3db7da85c3a7cf 100644 (file)
@@ -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)
 {
 }
 
index 0f71060125c5b477f81f4e90298386f41cddc2a6..931e988e96e164ec8ca20a46a25e1215e45398a9 100644 (file)
@@ -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);
 };
 
 
index 623d3915ae784dca32376fbade99c66e98edbd52..05ebe08e81ac14e9066bebe515f3130458e8894f 100644 (file)
@@ -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 */
index a745263d867f3e2dbac13b5acfa26ac1bc366ef2..e81d4fcb4d35f99b6ac0b3c61691bd01a6c22490 100644 (file)
@@ -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);
 
index d8bae3600d8dbeb75bb268dc672f5df1f070d696..d01c17224d4b27656e5f7970236ba3bf8f540dd8 100644 (file)
@@ -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);
 }
 
index e0b0ca01c5b7021b83cf84d56e928428467b240c..a3476d170f55eeb3697c643c93fd62cb65da48c0 100644 (file)
@@ -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);
 
index d6c2c00bd09b92cf2063aa9f8b911146c6464559..a5f8dc999374edac5c7f967c281963369f155fda 100644 (file)
@@ -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
index 17f8bea3241f01cc5993a05db587f941594ba4b6..30818e7cd74cfe5dd6a2862777ebf7d57a9bdbb3 100644 (file)
@@ -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);
 };
 
index 117c455e436f453573ef0ffbf51791af8f5210aa..cecb2469b50fc3a7963de137dde79d263d982c1a 100644 (file)
@@ -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<class cl_memory_chip *>(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 */
index 9fa378d8e3491422d8d7a2a58d852be8c846af25..1518bfce9618024f2db6120a8c5118f6ddfec432 100644 (file)
@@ -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);
 };
 
 
index 122164d3c6b1f1f97a2821df2f0bc8cc6b7cccb8..41053953d4b86555c2f9c30abdc813a71214ac5d 100644 (file)
@@ -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 */
index ff15378521ec63e84326c65f2bfa4473959dd02f..b0890a88f3c081fdedfe783c54ce96356af3d6d9 100644 (file)
@@ -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);
index 7a137da499c7b8519fcce8a33ee85f565e7c5ca1..f29e51d64202555a5de223b7f2bfccdb269c7661 100644 (file)
@@ -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);
index 02936ee3a4a4b94bb0e37a76406bf2f20e9cc0b1..280756314b12e99741b458e589dfce265378e926 100644 (file)
@@ -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
index 7e7141e0a6db0701d267914a6f4335484c97b90f..d4b10cd6dc16aa3b7433c2f470a0094dcffc6d1a 100644 (file)
@@ -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) &&
index 88ff39a1a90c6e179e97354856ff5b958480cfef..be1d57a5cd753f96c9c4cf208747d66280a4d3b7 100644 (file)
@@ -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);
 
index d673f9fd8225014fb78e9a791cf42659714024d5..ce02b92f849bd0b7340403c396f1a821886e85ec 100644 (file)
@@ -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.
+*/
index 77ce47da631bc6bf8a67e6bc88b05d25b2f05451..50a17eea0b4054350689a2d0b4b2cf3ed46c9a09 100644 (file)
@@ -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
 
index 8777353cc9c41308ad2dd7b4b081464ccc81cdcc..e38ae65dc95938344b2af88a0eff9fd1e16c5486 100644 (file)
@@ -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<class cl_memory_chip *>(value.memory.memory);
+      if (value.memory.memory->is_address_space())
+       value.memory.address_space=
+         dynamic_cast<class cl_address_space *>(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 */
index acf7be147d04fac1a7df40d5a979d33111b556bf..c829d92e2fcc66ed3fbcea99bdaa283d653a125a 100644 (file)
@@ -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
index b18b89f3d50d6ee81b2b602218ca5a9797ed1a2a..f28ccc62343a08f008b28d80bb6f38fd67d792a2 100644 (file)
@@ -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));
 }
 
index b5ed8a800c32468b840eb3befc0ad22619e94380..0b93c72586964ff5e66f983bf3cd906660907995 100644 (file)
@@ -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);
 
index 167c1cad9527210d3dae1604d639d9bfc851fe06..45fa705917f79395f886770e6e7c07bcac6ffc40 100644 (file)
@@ -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<class cl_watched_cell *>(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);
+    }
+}
+
 
 /*
  *____________________________________________________________________________
index a67921e02a4e752317b67628b158df5aa4f827f5..3024011f676e116c9e14a87091216a197c2fe5e2 100644 (file)
@@ -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);
 };
 
 
index aec8c97fd71824691617d405b69fd8ed98920e5a..ad17146d9ef5d8b2ef0a27237883173946a4e503 100644 (file)
@@ -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;
 }
index f47137aaeab01df75949ba0cf10b83f657e58a86..7d9a780fdc15ff321c9e40a6e739a28eeca0aa30 100644 (file)
@@ -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 <stdio.h>
@@ -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<class cl_address_decoder *>(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");
 }
 
 
index d2044fb3bfae5a58219e4a5d12dc7573a28a00c2..223fa443406d939c5726efabf7f556288fd9fe7b 100644 (file)
@@ -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);
 };
 
index d86cf5a3c5849e8297f4ec3167f840e0a54ddea1..ed6fb4675d96aa2eba551e25d08605b3a7891e4e 100644 (file)
@@ -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 */
index eab04a32cbbd7d9985c253a2e1bd4a93f256f451..990b5cbf01431e293dbbafb3134b7a370d513a04 100644 (file)
@@ -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);
 };
 
index c8941d678fb12eabf557d312b20efa3935e17a61..d9c5fe8d1296610c6b75ac3d8f25cdd69f57719a 100644 (file)
@@ -25,18 +25,24 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
+#include <stdlib.h>
+
+// 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 */
index 6e391abb1ae96b4814d1b5816a2d99c785dff0a4..06e522bc2ecba597a36425df7f96b9590a4a5f12 100644 (file)
@@ -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);
 };
 
 
index 5f40e9ebfed9d89d4e5c388412380be5aa62f64e..920f13cf1e88d6195b3cb4f650b8296d3f2802f8 100644 (file)
@@ -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));
index 7ad8f08a9851918b3719d736adf5820634d2bc7c..600e9d1a3aad1947e206d332529400f254fd3b11 100644 (file)
@@ -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<class cl_event_address_space_added &>(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<class cl_ev_brk *>(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 */
index 0b1883b2b63737fbb68927b7173acffe7abff737..41327401b5f2d6b7c7c898694e549457bd2cf1d3 100644 (file)
@@ -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 */
index a264f6ab8b6029c6ffd0dd8d042dea6441956f47..a80b241f4b172f6230500eb7ab8b43e901e499e8 100644 (file)
@@ -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 */
index 1a410ebbaedb090e81abdec49da66bfb3a091dfc..b7a625d393c0e4a2d2b479c343d85d2af1d0810f 100644 (file)
@@ -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 */
index 3b17fd1083cc2112bdbb21858b96e390089f0ff3..9a70db0fa75816c717c85b72fed3927851785bb2 100644 (file)
@@ -30,6 +30,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <stdio.h>
 
+// 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
index de6236827d7606f4968c7502696f9dd47cf8393e..6e682f97c07c52a08ecd66a156a04dfd744bf3b3 100644 (file)
@@ -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@
index da7ed0fc6d74b42a279bd22124bcf800f7e86fae..35be697abb7abb3572b0d9a66ac5b0227ac9fe89 100644 (file)
@@ -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);
index 6c6780d1990059e9f3c92b4b21e9db802271d553..fb64cae156154e9115ea70c9f8acb09dedbfc122 100644 (file)
@@ -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);
 
index 8aed4371f08b92a44ff7f6b7dbc5f61fd23f26af..2dd508308fb657b7fab58dc233f16607a0d19a55 100644 (file)
@@ -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)
index 6c9aa410c40d970942bd4c25a2bbe8ec26efb3ff..0ec12a59fe3f1fee9120442f24233139acd48c6c 100644 (file)
@@ -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);
 }
 
index d696d30275c3f4c794b47a78a5a7341a6aa0cbba..0b979b1622db7269be6b4c1887d321a0d1aca3e1 100644 (file)
@@ -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);
 }
 
index e0b1b12392bffec99775efffc5504d9eca7c8770..9d2a6566a0ef61873216f724f8b995ee64b12c3d 100644 (file)
@@ -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);
index 53e9e331988899a57376a689ea78efb88bd65e83..966d2464feb59c02cdca04d8c4d711dd8eb657cc 100644 (file)
@@ -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);