* sim/ucsim/*.*, sim/ucsim/configure, sim/ucsim/configure.in:
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Jun 2007 22:32:26 +0000 (22:32 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Jun 2007 22:32:26 +0000 (22:32 +0000)
  permanent solution to suppress GCC 4.2.0 c++ warning:
  deprecated conversion from string constant to `char *'
  use 'const char *' where ever required

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4837 4a8a32a2-be11-0410-ad9d-d568d2c75423

61 files changed:
ChangeLog
sim/ucsim/app.cc
sim/ucsim/appcl.h
sim/ucsim/avr.src/avr.cc
sim/ucsim/avr.src/avrcl.h
sim/ucsim/cmd.src/bpcl.h
sim/ucsim/cmd.src/cmdconf.cc
sim/ucsim/cmd.src/cmdpars.cc
sim/ucsim/cmd.src/cmdpars.y
sim/ucsim/cmd.src/command.cc
sim/ucsim/cmd.src/commandcl.h
sim/ucsim/cmd.src/newcmd.cc
sim/ucsim/cmd.src/newcmdcl.h
sim/ucsim/cmd.src/newcmdposix.cc
sim/ucsim/cmd.src/newcmdposixcl.h
sim/ucsim/cmd.src/newcmdwin32.cc
sim/ucsim/cmd.src/newcmdwin32cl.h
sim/ucsim/cmd.src/show.cc
sim/ucsim/configure
sim/ucsim/configure.in
sim/ucsim/error.cc
sim/ucsim/errorcl.h
sim/ucsim/globals.cc
sim/ucsim/hc08.src/hc08.cc
sim/ucsim/hc08.src/hc08cl.h
sim/ucsim/option.cc
sim/ucsim/optioncl.h
sim/ucsim/pobj.cc
sim/ucsim/pobjcl.h
sim/ucsim/pobjt.h
sim/ucsim/s51.src/serial.cc
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/timer1cl.h
sim/ucsim/s51.src/timer2.cc
sim/ucsim/s51.src/timer2cl.h
sim/ucsim/s51.src/uc390.cc
sim/ucsim/s51.src/uc390cl.h
sim/ucsim/s51.src/uc51.cc
sim/ucsim/s51.src/uc51cl.h
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/itsrccl.h
sim/ucsim/sim.src/mem.cc
sim/ucsim/sim.src/memcl.h
sim/ucsim/sim.src/stack.cc
sim/ucsim/sim.src/stackcl.h
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/z80.src/z80.cc
sim/ucsim/z80.src/z80cl.h

index 5ea767000edf499cccb81a7a79fe0b938a859167..6203bf41ab36a9614b70834837a018a3d9805e85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-07 Borut Razem <borut.razem AT siol.net>
+
+       * sim/ucsim/*.*, sim/ucsim/configure, sim/ucsim/configure.in:
+         permanent solution to suppress GCC 4.2.0 c++ warning:
+         deprecated conversion from string constant to `char *'
+         use 'const char *' where ever required
+
 2007-06-04 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/SDCCast.c(decorateType): better optimize '!!' and comparisons
@@ -56,7 +63,7 @@
        * device/lib/pic16/libdev/pic18f[24]5j10.c:
          search for included source file in local directory
        * sim/ucsim/configure, sim/ucsim/configure.in:
-         temporary solution to supress GCC 4.2.0 c++ warning:
+         temporary solution to suppress GCC 4.2.0 c++ warning:
          deprecated conversion from string constant to `char *'
 
 2007-06-01 Raphael Neider <rneider AT web.de>
index 44daef00fdc01359407c5b19dff72a25a518ad8c..241454730371d2018a77eee8122d2de0653ea4f1 100644 (file)
@@ -192,7 +192,7 @@ cl_app::done(void)
  */
 
 static void
-print_help(char *name)
+print_help(const char *name)
 {
   printf("%s: %s\n", name, VERSIONSTR);
   printf("Usage: %s [-hHVvP] [-p prompt] [-t CPU] [-X freq[k|M]]\n"
@@ -793,7 +793,7 @@ cl_app::mk_options(void)
 
 
 int
-cl_app::dd_printf(char *format, ...)
+cl_app::dd_printf(const char *format, ...)
 {
   va_list ap;
 
@@ -807,7 +807,7 @@ cl_app::dd_printf(char *format, ...)
 }
 
 int
-cl_app::debug(char *format, ...)
+cl_app::debug(const char *format, ...)
 {
   va_list ap;
 
index 70da7d9b6d1b2066686558940434b18629c52399..a9a3ced1523099710098bd8dd09e40f4bb544d78 100644 (file)
@@ -116,8 +116,8 @@ protected:
   virtual void mk_options(void);
 
 public: // output functions
-  virtual int dd_printf(char *format, ...);
-  virtual int debug(char *format, ...);
+  virtual int dd_printf(const char *format, ...);
+  virtual int debug(const char *format, ...);
 };
 
 
index 5991f6c33f65359f0c8b3d76d946e9b170f136cd..dbf3b72ee497cbb4ee8c5176881232123032c58c 100644 (file)
@@ -66,7 +66,7 @@ cl_avr::init(void)
   return(0);
 }
 
-char *
+const char *
 cl_avr::id_string(void)
 {
   return("unspecified AVR");
@@ -172,7 +172,8 @@ char *
 cl_avr::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20];
-  char *buf, *p, *b, *t;
+  const char *b;
+  char *buf, *p, *t;
   uint code, data= 0;
   int i;
 
@@ -291,10 +292,10 @@ cl_avr::disass(t_addr addr, char *sep)
     buf= (char *)malloc(6+strlen(p)+1);
   else
     buf= (char *)malloc((p-work)+strlen(sep)+strlen(p)+1);
-  for (p= work, b= buf; *p != ' '; p++, b++)
-    *b= *p;
+  for (p= work, t= buf; *p != ' '; p++, t++)
+    *t= *p;
   p++;
-  *b= '\0';
+  *t= '\0';
   if (sep == NULL)
     {
       while (strlen(buf) < 6)
index 34f3c5ea76a3eae8e35f4a27cecff71275bbd4c4..0e82e4925bf70c1e4076c38e8773a59f4bca3c47 100644 (file)
@@ -46,7 +46,7 @@ public:
 public:
   cl_avr(class cl_sim *asim);
   virtual int init(void);
-  virtual char *id_string(void);
+  virtual const char *id_string(void);
 
   //virtual t_addr get_mem_size(enum mem_class type);
   //virtual int get_mem_width(enum mem_class type);
index 407b6add4031c74b8ac0bc280731a3fa368be433..117cf35de4014a1c41f793ef28f93a044f1fff86 100644 (file)
@@ -48,10 +48,10 @@ COMMAND_TAIL;
 class cl_tbreak_cmd: public cl_break_cmd
 {
 public:
-  cl_tbreak_cmd(char *aname,
+  cl_tbreak_cmd(const char *aname,
                 int  can_rep,
-                char *short_hlp,
-                char *long_hlp):
+                const char *short_hlp,
+                const char *long_hlp):
     cl_break_cmd(aname, can_rep, short_hlp, long_hlp) {perm=brkDYNAMIC;}
 };
 
index b0797b6f6b5eeaf39268633cdd40fedded63e933..7a93118e2883dc8fdd194f4eb50d1fe400b54e91 100644 (file)
@@ -74,7 +74,7 @@ conf_objects_cmd_print_node(class cl_console_base *con,
   int i;
   for (i= 0; i < indent; i++)
     con->dd_printf(" ");
-  char *name= node->get_name("unknown");
+  const char *name= node->get_name("unknown");
   con->dd_printf("%s\n", name);
   class cl_base *c= node->first_child();
   while (c)
index 8087e4a5f17f2bf0a7e3da39167c5f6037bc1670..ffd62ce9a126473612a7496d64989bc9196b8652 100644 (file)
@@ -726,7 +726,7 @@ do                                                              \
       YYGOTO(yybackup);                                            \
     }                                                           \
   else                                                          \
-    { YY_cl_ucsim_parser_ERROR ("syntax error: cannot back up"); YYERROR; }   \
+    { YY_cl_ucsim_parser_ERROR ((char *)"syntax error: cannot back up"); YYERROR; }   \
 while (0)
 
 #define YYTERROR        1
@@ -936,7 +936,7 @@ YYLABEL(yynewstate)
       /* Extend the stack our own way.  */
       if (yystacksize >= YYMAXDEPTH)
        {
-         YY_cl_ucsim_parser_ERROR("parser stack overflow");
+         YY_cl_ucsim_parser_ERROR((char *)"parser stack overflow");
          __ALLOCA_return(2);
        }
       yystacksize *= 2;
@@ -1161,7 +1161,7 @@ case 8:
 #line 92 "cmdpars.y"
 {
            if (yyvsp[0].number == 0)
-             yyerror("Divide by zero");
+             yyerror((char *)"Divide by zero");
            else
              yyval.number= yyvsp[-2].number / yyvsp[0].number;
          ;
@@ -1200,7 +1200,7 @@ case 16:
          yyval.number= yyvsp[0].bit.bit_address;
          if (yyval.number < 0)
            {
-             yyerror("Bit has no address.");
+             yyerror((char *)"Bit has no address.");
              yyval.number= 0;
            }
        ;
@@ -1323,11 +1323,11 @@ YYLABEL(yyerrlab)   /* here on detecting error */
              free(msg);
            }
          else
-           YY_cl_ucsim_parser_ERROR ("parse error; also virtual memory exceeded");
+           YY_cl_ucsim_parser_ERROR ((char *)"parse error; also virtual memory exceeded");
        }
       else
 #endif /* YY_cl_ucsim_parser_ERROR_VERBOSE */
-       YY_cl_ucsim_parser_ERROR("parse error");
+       YY_cl_ucsim_parser_ERROR((char *)"parse error");
     }
 
   YYGOTO(yyerrlab1);
index 2b106ac57a7215835d0643bbcc2af8bc62392efa..70f69b3a5bc4e745561e9faa0d4b50c6e97a2c59 100644 (file)
@@ -91,7 +91,7 @@ expression:
        | expression PTOK_SLASH expression
          {
            if ($3 == 0)
-             yyerror("Divide by zero");
+             yyerror((char *)"Divide by zero");
            else
              $$= $1 / $3;
          }
@@ -110,7 +110,7 @@ address_of_expression:
          $$= $2.bit_address;
          if ($$ < 0)
            {
-             yyerror("Bit has no address.");
+             yyerror((char *)"Bit has no address.");
              $$= 0;
            }
        }
index cdd40a584d8c54405fd4190a415d5497f4fc36dd..f52e370d2245cdedc8222b83fb4ea2a142e6ab01 100644 (file)
@@ -347,7 +347,7 @@ cl_cmdline::shift(void)
 int
 cl_cmdline::repeat(void)
 {
-  char *n;
+  const char *n;
   return((n= get_name()) &&
          *n == '\n');
 }
@@ -370,7 +370,7 @@ cl_cmdline::insert_param(int pos, class cl_cmd_arg *param)
 }
 
 bool
-cl_cmdline::syntax_match(class cl_uc *uc, char *syntax)
+cl_cmdline::syntax_match(class cl_uc *uc, const char *syntax)
 {
   if (!syntax)
     return(DD_FALSE);
@@ -383,7 +383,7 @@ cl_cmdline::syntax_match(class cl_uc *uc, char *syntax)
   if (!params->count)
     return(DD_FALSE);
   //printf("syntax %s?\n",syntax);
-  char *p= syntax;
+  const char *p= syntax;
   int iparam= 0;
   class cl_cmd_arg *parm= (class cl_cmd_arg *)(params->at(iparam));
   while (*p &&
@@ -511,10 +511,10 @@ cl_cmdline::set_data_list(class cl_cmd_arg *parm, int *iparm)
  */
 
 cl_cmd::cl_cmd(enum cmd_operate_on op_on,
-               char *aname,
+               const char *aname,
                int can_rep,
-               char *short_hlp,
-               char *long_hlp):
+               const char *short_hlp,
+               const char *long_hlp):
   cl_base()
 {
   operate_on= op_on;
@@ -536,21 +536,17 @@ cl_cmd::cl_cmd(enum cmd_operate_on op_on,
 cl_cmd::~cl_cmd(void)
 {
   delete names;
-  if (short_help)
-    free(short_help);
-  if (long_help)
-    free(long_help);
 }
 
 void
-cl_cmd::add_name(char *nam)
+cl_cmd::add_name(const char *nam)
 {
   if (nam)
     names->add(strdup(nam));
 }
 
 int
-cl_cmd::name_match(char *aname, int strict)
+cl_cmd::name_match(const char *aname, int strict)
 {
   int i;
   
@@ -715,7 +711,7 @@ cl_cmdset::get_cmd(class cl_cmdline *cmdline, bool accept_last)
 }
 
 class cl_cmd *
-cl_cmdset::get_cmd(char *cmd_name)
+cl_cmdset::get_cmd(const char *cmd_name)
 {
   int i;
 
@@ -767,10 +763,10 @@ cl_cmdset::replace(char *nam, class cl_cmd *cmd)
  *____________________________________________________________________________
  */
 
-cl_super_cmd::cl_super_cmd(char *aname,
+cl_super_cmd::cl_super_cmd(const char *aname,
                            int  can_rep,
-                           char *short_hlp,
-                           char *long_hlp,
+                           const char *short_hlp,
+                           const char *long_hlp,
                            class cl_cmdset *acommands):
   cl_cmd(operate_on_none, aname, can_rep, short_hlp, long_hlp)
 {
index 7a3a332ad02814387d8ea87e0e0113adb5e47e42..6de3a687cb945502d2be84d083b77bf7a0cd675c 100644 (file)
@@ -57,7 +57,7 @@ public:
   //char *name;
   class cl_list *params;
   class cl_ustrings *tokens;
-  char *matched_syntax;
+  const char *matched_syntax;
   class cl_console_base *con;
 
 public:
@@ -76,7 +76,7 @@ public:
   virtual int repeat(void);
   virtual class cl_cmd_arg *param(int num);
   virtual void insert_param(int pos, class cl_cmd_arg *param);
-  virtual bool syntax_match(class cl_uc *uc, char *syntax);
+  virtual bool syntax_match(class cl_uc *uc, const char *syntax);
   virtual bool set_data_list(class cl_cmd_arg *parm, int *iparm);
   virtual int nuof_params(void) { return(params->get_count()); }
 private:
@@ -97,20 +97,20 @@ public:
   enum cmd_operate_on operate_on;
   class cl_strings *names;
   int  can_repeat;
-  char *short_help;
-  char *long_help;
+  const char *short_help;
+  const char *long_help;
 
 public:
   cl_cmd(enum cmd_operate_on opon,
-         char *aname,
+         const char *aname,
          int  can_rep,
-         char *short_hlp,
-         char *long_hlp);
+         const char *short_hlp,
+         const 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 void add_name(const char *nam);
+  virtual int name_match(const char *aname, int strict);
   virtual int name_match(class cl_cmdline *cmdline, int strict);
   virtual int syntax_ok(class cl_cmdline *cmdline);
   virtual int work(class cl_app *app,
@@ -133,38 +133,38 @@ class CLASS_NAME : public ANCESTOR \
 
 #define COMMAND_METHODS(CLASS_NAME) \
 public:\
-  CLASS_NAME (char *aname,\
+  CLASS_NAME (const char *aname,\
               int  can_rep,\
-              char *short_help,\
-              char *long_help):\
+              const char *short_help,\
+              const char *long_help):\
     cl_cmd(operate_on_none, aname, can_rep, short_help, long_help) {}\
   virtual int do_work(class cl_cmdline *cmdline, class cl_console_base *con);
 
 #define COMMAND_METHODS_ON(ON,CLASS_NAME) \
 public:\
-  CLASS_NAME (char *aname,\
+  CLASS_NAME (const char *aname,\
               int  can_rep,\
-              char *short_help,\
-              char *long_help):\
+              const char *short_help,\
+              const char *long_help):\
     cl_cmd(operate_on_ ## ON, aname, can_rep, short_help, long_help) {}\
   virtual int do_work(class cl_ ## ON * ON ,\
                       class cl_cmdline *cmdline, class cl_console_base *con);
 
 #define COMMAND_METHODS_ANCESTOR(CLASS_NAME,ANCESTOR) \
 public:\
-  CLASS_NAME (char *aname,\
+  CLASS_NAME (const char *aname,\
               int  can_rep,\
-              char *short_help,\
-              char *long_help):\
+              const char *short_help,\
+              const char *long_help):\
     ANCESTOR (aname, can_rep, short_help, long_help) {}\
   virtual int do_work(class cl_cmdline *cmdline, class cl_console_base *con);
 
 #define COMMAND_METHODS_ANCESTOR_ON(ON,CLASS_NAME,ANCESTOR) \
 public:\
-  CLASS_NAME (char *aname,\
+  CLASS_NAME (const char *aname,\
               int  can_rep,\
-              char *short_help,\
-              char *long_help):\
+              const char *short_help,\
+              const char *long_help):\
     ANCESTOR (aname, can_rep, short_help, long_help) {}\
   virtual int do_work(class cl_ ## ON * ON ,\
                       class cl_cmdline *cmdline, class cl_console_base *con); \
@@ -239,7 +239,7 @@ public:
   //cl_cmdset(class cl_sim *asim);
 
   virtual class cl_cmd *get_cmd(class cl_cmdline *cmdline, bool accept_last);
-  virtual class cl_cmd *get_cmd(char *cmd_name);
+  virtual class cl_cmd *get_cmd(const char *cmd_name);
   virtual void del(char *nam);
   virtual void replace(char *nam, class cl_cmd *cmd);
 };
@@ -251,10 +251,10 @@ public:
   class cl_cmdset *commands;
 
 public:
-  cl_super_cmd(char *aname,
+  cl_super_cmd(const char *aname,
                int  can_rep,
-               char *short_hlp,
-               char *long_hlp,
+               const char *short_hlp,
+               const char *long_hlp,
                class cl_cmdset *acommands);
   virtual ~cl_super_cmd(void);
 
index f5e5c9a0a8d9dccecfe8a118dd87d67e552b8d71..3355443b9391dbe11e730ce6a026bf94a959c219 100644 (file)
@@ -172,7 +172,7 @@ cl_console_base::print_prompt(void)
 }
 
 int
-cl_console_base::dd_printf(char *format, ...)
+cl_console_base::dd_printf(const char *format, ...)
 {
   va_list ap;
   int ret= 0;
@@ -185,7 +185,7 @@ cl_console_base::dd_printf(char *format, ...)
 }
 
 int
-cl_console_base::debug(char *format, ...)
+cl_console_base::debug(const char *format, ...)
 {
   if ((flags & CONS_DEBUG) == 0)
     return(0);
@@ -421,7 +421,7 @@ cl_commander_base::deactivate_console(class cl_console_base *console)
  */
 
 int
-cl_commander_base::all_printf(char *format, ...)
+cl_commander_base::all_printf(const char *format, ...)
 {
   va_list ap;
   int i, ret= 0;
@@ -454,7 +454,7 @@ cl_commander_base::prompt(void)
  */
 
 int
-cl_commander_base::dd_printf(char *format, va_list ap)
+cl_commander_base::dd_printf(const char *format, va_list ap)
 {
   int ret= 0;
   class cl_console_base *con;
@@ -479,7 +479,7 @@ cl_commander_base::dd_printf(char *format, va_list ap)
 }
 
 int
-cl_commander_base::dd_printf(char *format, ...)
+cl_commander_base::dd_printf(const char *format, ...)
 {
   va_list ap;
   int ret= 0;
@@ -496,7 +496,7 @@ cl_commander_base::dd_printf(char *format, ...)
  */
 
 int
-cl_commander_base::debug(char *format, ...)
+cl_commander_base::debug(const char *format, ...)
 {
   va_list ap;
   int i, ret= 0;
@@ -515,7 +515,7 @@ cl_commander_base::debug(char *format, ...)
 }
 
 int
-cl_commander_base::debug(char *format, va_list ap)
+cl_commander_base::debug(const char *format, va_list ap)
 {
   int i, ret= 0;
 
@@ -531,7 +531,7 @@ cl_commander_base::debug(char *format, va_list ap)
 }
 
 int
-cl_commander_base::flag_printf(int iflags, char *format, ...)
+cl_commander_base::flag_printf(int iflags, const char *format, ...)
 {
   va_list ap;
   int i, ret= 0;
index 49ae8cf4363f2f9cf376e95dd70d556761cec96c..6bff5b1078084c045ffdce8a866799f7d192af93 100644 (file)
@@ -113,7 +113,7 @@ public:
 
   virtual void redirect(char *fname, char *mode) = 0;
   virtual void un_redirect(void) = 0;
-  virtual int cmd_do_print(char *format, va_list ap) = 0;
+  virtual int cmd_do_print(const char *format, va_list ap) = 0;
   virtual bool is_tty(void) const = 0;
   virtual bool is_eof(void) const = 0;
   virtual int input_avail(void) = 0;
@@ -124,8 +124,8 @@ public:
   virtual int proc_input(class cl_cmdset *cmdset);
 
   void print_prompt(void);
-  int dd_printf(char *format, ...);
-  int debug(char *format, ...);
+  int dd_printf(const char *format, ...);
+  int debug(const char *format, ...);
   void print_bin(long data, int bits);
   void print_char_octal(char c);
 
@@ -168,12 +168,12 @@ public:
   void deactivate_console(class cl_console_base *console);
 
   void prompt(void);
-  int all_printf(char *format, ...);        // print to all consoles
-  int dd_printf(char *format, va_list ap);  // print to actual_console
-  int dd_printf(char *format, ...);         // 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 all_printf(const char *format, ...);        // print to all consoles
+  int dd_printf(const char *format, va_list ap);  // print to actual_console
+  int dd_printf(const char *format, ...);         // print to actual_console
+  int debug(const char *format, ...);             // print consoles with debug flag set
+  int debug(const char *format, va_list ap);      // print consoles with debug flag set
+  int flag_printf(int iflags, const char *format, ...);
   int input_avail_on_frozen(void);
   void exec_on(class cl_console_base *cons, char *file_name);
 
index 51c975e9c7f660a6560542363738b0c23ceabc4d..f74d6e3c2c3355f7f6597ad31740cea703d54acf 100644 (file)
@@ -72,7 +72,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  *____________________________________________________________________________
  */
 
-cl_console::cl_console(char *fin, char *fout, class cl_app *the_app)
+cl_console::cl_console(const char *fin, const char *fout, class cl_app *the_app)
 {
   FILE *f;
 
@@ -181,7 +181,7 @@ cl_console::un_redirect(void)
 }
 
 int
-cl_console::cmd_do_print(char *format, va_list ap)
+cl_console::cmd_do_print(const char *format, va_list ap)
 {
   int ret;
   FILE *f = get_out();
index 08501674d0beeb0dad0d539873eeac0f52e86ab8..5050d2f4899888c72e649a999a97118fdae74150 100644 (file)
@@ -44,9 +44,9 @@ protected:
 
 public:
   cl_console(void) { in = out = rout = 0; }
-  cl_console(char *fin, char *fout, class cl_app *the_app);
+  cl_console(const char *fin, const char *fout, class cl_app *the_app);
   cl_console(FILE *fin, FILE *fout, class cl_app *the_app);
-  int cmd_do_print(char *format, va_list ap);
+  int cmd_do_print(const char *format, va_list ap);
 
   virtual ~cl_console(void);
   virtual class cl_console *clone_for_exec(char *fin);
index 460b04d0dda870264f6ad86ddd832619b10dd217..a4973aa7012f85b3d01fad4d3052a9c717c4cd53 100644 (file)
@@ -114,7 +114,7 @@ cl_channel::close(void)
  *____________________________________________________________________________
  */
 
-cl_console::cl_console(char *fin, char *fout, class cl_app *the_app)
+cl_console::cl_console(const char *fin, const char *fout, class cl_app *the_app)
 {
   FILE *f;
 
@@ -231,7 +231,7 @@ cl_console::un_redirect(void)
 }
 
 int
-cl_console::cmd_do_print(char *format, va_list ap)
+cl_console::cmd_do_print(const char *format, va_list ap)
 {
   FILE *f = get_out()->get_fp();
 
index 522a89c8b45f938d23109f6b2cd5bbc7244edb8d..bdb85609233ab4821c83768fe6bf4ae47202d157 100644 (file)
@@ -74,11 +74,11 @@ protected:
 
 public:
   cl_console(void) { in = cl_channel(); out = cl_channel(); rout = cl_channel(); }
-  cl_console(char *fin, char *fout, class cl_app *the_app);
+  cl_console(const char *fin, const char *fout, class cl_app *the_app);
   cl_console(FILE *fin, FILE *fout, class cl_app *the_app);
   cl_console(cl_channel _in, cl_channel _out, class cl_app *the_app);
 
-  int cmd_do_print(char *format, va_list ap);
+  int cmd_do_print(const char *format, va_list ap);
 
   virtual ~cl_console(void);
   virtual class cl_console *clone_for_exec(char *fin);
index 9ef2c66e30f636a8b3de5aa1658e8eb02e9a2a27..28763745f69bf92e254d532bce022638495f0618 100644 (file)
@@ -140,7 +140,7 @@ show_error_cmd_print_node(class cl_console_base *con,
   int i;
   for (i= 0; i < indent; i++)
     con->dd_printf(" ");
-  char *name= node->get_name("unknown");
+  const 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",
index 6ee865f4cd094e9440966651ec9d86c21df83aad..fbda1e0c411fc24f9f95550b1f68894b1fd60246 100755 (executable)
@@ -12503,10 +12503,6 @@ if test "$ucsim_cv_CXXpipe" = "yes"; then
   CXXFLAGS="$CXXFLAGS -pipe"
 fi
 
-# temporary solution to supress GCC 4.2.0 c++ warning:
-# deprecated conversion from string constant to `char *'
-CXXFLAGS="$CXXFLAGS -Wno-write-strings"
-
 PICOPT=""
 SHAREDLIB="no"
 
index 7a86a697218eabebf3c46eba98bb01aa31869153..339cdc0acafa61b5314b5aa11109cd3336c4d0d0 100644 (file)
@@ -477,10 +477,6 @@ if test "$ucsim_cv_CXXpipe" = "yes"; then
   CXXFLAGS="$CXXFLAGS -pipe"
 fi
 
-# temporary solution to supress GCC 4.2.0 c++ warning:
-# deprecated conversion from string constant to `char *'
-CXXFLAGS="$CXXFLAGS -Wno-write-strings"
-
 PICOPT=""
 SHAREDLIB="no"
 DD_COPT_NO_IGNORE(CXX, fPIC)
index 8494cdd24cebb1d5c62f8c651614772ee0bf1dbb..eea6639175bdd0860df24654ea12bd4e62f2ade3 100644 (file)
@@ -52,7 +52,7 @@ class cl_list *cl_error_registry::registered_errors= NIL;
 /*
  */
 
-cl_error_class::cl_error_class(enum error_type typ, char *aname,
+cl_error_class::cl_error_class(enum error_type typ, const char *aname,
                                enum error_on_off be_on/* = ERROR_PARENT*/):
   cl_base()
 {
@@ -61,7 +61,7 @@ cl_error_class::cl_error_class(enum error_type typ, char *aname,
   set_name(aname, "not-known");
 }
 
-cl_error_class::cl_error_class(enum error_type typ, char *aname,
+cl_error_class::cl_error_class(enum error_type typ, const char *aname,
                                class cl_error_class *parent,
                                enum error_on_off be_on/* = ERROR_PARENT*/):
   cl_base()
@@ -109,7 +109,7 @@ cl_error_class::get_name(void)
   return(name);
 }*/
 
-char *
+const char *
 cl_error_class::get_type_name()
 {
   return(get_id_string(error_type_names, type, "untyped"));
@@ -172,7 +172,7 @@ cl_error::print(class cl_commander_base *c)
   c->dd_printf("%s\n", get_type_name());
 }
 
-char *
+const char *
 cl_error::get_type_name()
 {
   enum error_type type= get_type();
index 91d821f3a5d6c90034ce953471fa12d437caf080..ae3e284e4a19b8246b996c97dcc31580223cfecb 100644 (file)
@@ -53,9 +53,9 @@ protected:
   //char *name;
   enum error_on_off on;
 public:
-  cl_error_class(enum error_type typ, char *aname,
+  cl_error_class(enum error_type typ, const char *aname,
                  enum error_on_off be_on= ERROR_PARENT);
-  cl_error_class(enum error_type typ, char *aname,
+  cl_error_class(enum error_type typ, const char *aname,
                  class cl_error_class *parent,
                  enum error_on_off be_on= ERROR_PARENT);
   
@@ -63,7 +63,7 @@ public:
   void set_on(enum error_on_off val);
   bool is_on(void);
   enum error_type get_type(void);
-  char *get_type_name(void);
+  const char *get_type_name(void);
   //char *get_name(void);
 };
 
@@ -71,11 +71,11 @@ class cl_error_registry
 {
 public:
   cl_error_registry(void);
-  class cl_error_class *find(char *type_name)
+  class cl_error_class *find(const char *type_name)
   {
     if (NIL == registered_errors)
       return NIL;
-    return static_cast<class cl_error_class *>(registered_errors->first_that(compare, static_cast<void *>(type_name)));
+    return static_cast<class cl_error_class *>(registered_errors->first_that(compare, type_name));
   }
   static class cl_list *get_list(void)
   {
@@ -93,9 +93,9 @@ protected:
 
 private:
   static class cl_list *registered_errors;
-  static int compare(void *obj1, void *obj2)
+  static int compare(void *obj1, const void *obj2)
   {
-    return (static_cast<class cl_base *>(obj1))->is_named(static_cast<char *>(obj2));
+    return (static_cast<class cl_base *>(obj1))->is_named(static_cast<const char *>(obj2));
   }
 };
 
@@ -120,7 +120,7 @@ public:
   virtual class cl_error_class *get_class(void) { return(classification); }
 
   virtual void print(class cl_commander_base *c);
-  virtual char *get_type_name();
+  virtual const char *get_type_name();
 };
 
 #endif
index d6d93583dea493a8b71e1e0a2edfab2a82df19b9..56a934c72be1b2d61b5c3b17c695d5a824a8dff5 100644 (file)
@@ -73,7 +73,7 @@ struct id_element error_type_names[]= {
 };
 
 
-char *warranty= 
+const char *warranty= 
 "                            NO WARRANTY\n"
 "\n"
 "  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n"
@@ -98,7 +98,7 @@ char *warranty=
 ;
 
 
-char *copying=
+const char *copying=
 "                  GNU GENERAL PUBLIC LICENSE\n"
 "                     Version 2, June 1991\n"
 "\n"
index 40dd7e2fce1ce045b7d6449e6951d2f758a5d809..ed318ea16e997e227d30861b7baa3a53a16a9286 100644 (file)
@@ -98,7 +98,7 @@ cl_hc08::reset(void)
 }
 
 
-char *
+const char *
 cl_hc08::id_string(void)
 {
   return("unspecified HC08");
@@ -177,9 +177,8 @@ int
 cl_hc08::inst_length(t_addr addr)
 {
   int len = 0;
-  char *s;
 
-  s = get_disasm_info(addr, &len, NULL, NULL);
+  get_disasm_info(addr, &len, NULL, NULL);
 
   return len;
 }
@@ -188,9 +187,8 @@ int
 cl_hc08::inst_branch(t_addr addr)
 {
   int b;
-  char *s;
 
-  s = get_disasm_info(addr, NULL, &b, NULL);
+  get_disasm_info(addr, NULL, &b, NULL);
 
   return b;
 }
@@ -202,13 +200,13 @@ cl_hc08::longest_inst(void)
 }
 
 
-char *
+const char *
 cl_hc08::get_disasm_info(t_addr addr,
                         int *ret_len,
                         int *ret_branch,
                         int *immed_offset)
 {
-  char *b = NULL;
+  const char *b = NULL;
   uint code;
   int len = 0;
   int immed_n = 0;
@@ -263,11 +261,12 @@ cl_hc08::get_disasm_info(t_addr addr,
   return b;
 }
 
-char *
+const char *
 cl_hc08::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20];
-  char *buf, *p, *b, *t;
+  const char *b;
+  char *buf, *p, *t;
   int len = 0;
   int immed_offset = 0;
 
@@ -354,10 +353,10 @@ cl_hc08::disass(t_addr addr, char *sep)
     buf= (char *)malloc(6+strlen(p)+1);
   else
     buf= (char *)malloc((p-work)+strlen(sep)+strlen(p)+1);
-  for (p= work, b= buf; *p != ' '; p++, b++)
-    *b= *p;
+  for (p= work, t= buf; *p != ' '; p++, t++)
+    *t= *p;
   p++;
-  *b= '\0';
+  *t= '\0';
   if (sep == NULL)
     {
       while (strlen(buf) < 6)
index 20bf4c319369966dbd72981bf312a89bfa7e8701..1cc69719d6c9b52f22087c022ddc182ed74f67fa 100644 (file)
@@ -46,7 +46,7 @@ public:
 public:
   cl_hc08(class cl_sim *asim);
   virtual int init(void);
-  virtual char *id_string(void);
+  virtual const char *id_string(void);
 
   //virtual t_addr get_mem_size(enum mem_class type);
   virtual void mk_hw_elements(void);
@@ -56,12 +56,12 @@ public:
   virtual int inst_length(t_addr addr);
   virtual int inst_branch(t_addr addr);
   virtual int longest_inst(void);
-  virtual char *disass(t_addr addr, char *sep);
+  virtual const char *disass(t_addr addr, char *sep);
   virtual void print_regs(class cl_console_base *con);
 
   virtual int exec_inst(void);
 
-  virtual char * get_disasm_info(t_addr addr,
+  virtual const char *get_disasm_info(t_addr addr,
                         int *ret_len,
                         int *ret_branch,
                         int *immed_offset);
index 01b7db0ce383f6f4aa463dc5ddff2a22d15a0b8c..83bccf754d008bb1d6d78f295c7a9c851a91dd38 100644 (file)
@@ -60,7 +60,7 @@
  *
  */
 
-cl_option::cl_option(class cl_base *the_creator, char *aname, char *Ihelp):
+cl_option::cl_option(class cl_base *the_creator, const char *aname, const char *Ihelp):
   cl_base()
 {
   creator= the_creator;
@@ -218,24 +218,16 @@ cl_option::set_value(double opt)
  * List of options
  */
 
-void *
+const void *
 cl_options::key_of(void *item)
 {
   return(((class cl_base *)item)->get_name());
 }
 
 int
-cl_options::compare(void *key1, void *key2)
+cl_options::compare(const void *key1, const void *key2)
 {
-  //class cl_option *k1, *k2;
-  int i;
-  char *k1, *k2;
-
-  k1= /*(class cl_option *)*/(char *)key1;
-  k2= /*(class cl_option *)*/(char *)key2;
-  if ((i= strcmp(k1, k2)) != 0)
-    return(i);
-  return(i);
+  return(strcmp(static_cast<const char *>(key1), static_cast<const char *>(key2)));
 }
 
 void
@@ -253,7 +245,7 @@ cl_options::del_option(class cl_option *opt)
 }
 
 class cl_option *
-cl_options::get_option(char *the_name)
+cl_options::get_option(const char *the_name)
 {
   t_index idx;
 
@@ -263,7 +255,7 @@ cl_options::get_option(char *the_name)
 }
 
 class cl_option *
-cl_options::get_option(char *the_name, class cl_base *creator)
+cl_options::get_option(const char *the_name, class cl_base *creator)
 {
   t_index idx;
   class cl_option *o;
@@ -301,7 +293,7 @@ cl_options::get_option(char *the_name, class cl_base *creator)
 }
 
 class cl_option *
-cl_options::get_option(char *the_name, char *creator)
+cl_options::get_option(const char *the_name, char *creator)
 {
   t_index idx;
   class cl_option *o;
@@ -376,7 +368,7 @@ cl_options::nuof_options(char *the_name, char *creator)
 }
 
 class cl_option *
-cl_options::set_value(char *the_name, cl_base *creator, bool value)
+cl_options::set_value(const char *the_name, cl_base *creator, bool value)
 {
   class cl_option *o= get_option(the_name, creator);
 
@@ -386,7 +378,7 @@ cl_options::set_value(char *the_name, cl_base *creator, bool value)
 }
 
 class cl_option *
-cl_options::set_value(char *the_name, cl_base *creator, char *value)
+cl_options::set_value(const char *the_name, cl_base *creator, char *value)
 {
   class cl_option *o= get_option(the_name, creator);
 
@@ -396,7 +388,7 @@ cl_options::set_value(char *the_name, cl_base *creator, char *value)
 }
 
 class cl_option *
-cl_options::set_value(char *the_name, cl_base *creator, void *value)
+cl_options::set_value(const char *the_name, cl_base *creator, void *value)
 {
   class cl_option *o= get_option(the_name, creator);
 
@@ -406,7 +398,7 @@ cl_options::set_value(char *the_name, cl_base *creator, void *value)
 }
 
 class cl_option *
-cl_options::set_value(char *the_name, cl_base *creator, long value)
+cl_options::set_value(const char *the_name, cl_base *creator, long value)
 {
   class cl_option *o= get_option(the_name, creator);
 
@@ -416,7 +408,7 @@ cl_options::set_value(char *the_name, cl_base *creator, long value)
 }
 
 class cl_option *
-cl_options::set_value(char *the_name, cl_base *creator, double value)
+cl_options::set_value(const char *the_name, cl_base *creator, double value)
 {
   class cl_option *o= get_option(the_name, creator);
 
@@ -461,7 +453,7 @@ cl_optref::~cl_optref(void)
 class cl_option *
 cl_optref::create(class cl_base *creator,
                   enum option_type type,
-                  char *the_name, char *help)
+                  const char *the_name, const char *help)
 {
   if (option)
     option->del_reference(this);
@@ -500,7 +492,7 @@ cl_optref::create(class cl_base *creator,
 }
 
 void
-cl_optref::default_option(char *the_name)
+cl_optref::default_option(const char *the_name)
 {
   class cl_option *o= application->options->get_option(the_name, application);
 
@@ -527,7 +519,7 @@ cl_optref::use(void)
 }
 
 class cl_option *
-cl_optref::use(char *the_name)
+cl_optref::use(const char *the_name)
 {
   if (option)
     option->del_reference(this);
@@ -564,7 +556,7 @@ cl_optref::get_value(bool)
 }
 
 char *
-cl_optref::get_value(char *)
+cl_optref::get_value(const char *)
 {
   if (!option)
     {
@@ -639,7 +631,7 @@ cl_optref::get_value(double)
  */
 
 cl_bool_option::cl_bool_option(class cl_base *the_creator,
-                               char *aname, char *Ihelp):
+                               const char *aname, const char *Ihelp):
   cl_option(the_creator, aname, Ihelp)
 {}
 
@@ -678,7 +670,7 @@ cl_bool_option::set_value(char *s)
  */
 
 cl_string_option::cl_string_option(class cl_base *the_creator,
-                                   char *aname, char *Ihelp):
+                                   const char *aname, const char *Ihelp):
   cl_option(the_creator, aname, Ihelp)
 {}
 
@@ -708,7 +700,7 @@ cl_string_option::print(class cl_console_base *con)
  */
 
 cl_pointer_option::cl_pointer_option(class cl_base *the_creator,
-                                     char *aname, char *Ihelp):
+                                     const char *aname, const char *Ihelp):
   cl_option(the_creator, aname, Ihelp)
 {}
 
@@ -797,7 +789,7 @@ cl_cons_debug_opt::set_value(char *s)
  */
 
 cl_number_option::cl_number_option(class cl_base *the_creator,
-                                   char *aname, char *Ihelp):
+                                   const char *aname, const char *Ihelp):
   cl_option(the_creator, aname, Ihelp)
 {}
 
@@ -823,7 +815,7 @@ cl_number_option::set_value(char *s)
  */
 
 cl_float_option::cl_float_option(class cl_base *the_creator,
-                                 char *aname, char *Ihelp):
+                                 const char *aname, const char *Ihelp):
   cl_option(the_creator, aname, Ihelp)
 {}
 
index b8b298ca6a36007f1d3bde0c3457272581d6a423..2e8ad8a1ac326de84dd953d36a338e4add2678f4 100644 (file)
@@ -70,7 +70,7 @@ public:
   bool hidden;
 
 public:
-  cl_option(class cl_base *the_creator, char *aname, char *Ihelp);
+  cl_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual class cl_option &operator=(class cl_option &o);
   virtual ~cl_option(void);
   virtual void pre_remove(void);
@@ -80,7 +80,7 @@ public:
   virtual void show(void) { hidden= DD_FALSE; }
 
   virtual void print(class cl_console_base *con) {}
-  virtual char *get_type_name(void) { return("non"); }
+  virtual const char *get_type_name(void) { return("non"); }
 
   virtual union option_value *get_value(void) { return(&value); }
   virtual void get_value(bool *val);
@@ -104,26 +104,26 @@ class cl_options: public cl_sorted_list
 {
 public:
   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 const void *key_of(void *item);
+  virtual int compare(const void *key1, const void *key2);
   virtual void new_option(class cl_option *opt);
   virtual void del_option(class cl_option *opt);
-  virtual class cl_option *get_option(char *the_name);
-  virtual class cl_option *get_option(char *the_name, class cl_base *creator);
-  virtual class cl_option *get_option(char *the_name, char *creator);
+  virtual class cl_option *get_option(const char *the_name);
+  virtual class cl_option *get_option(const char *the_name, class cl_base *creator);
+  virtual class cl_option *get_option(const char *the_name, char *creator);
   virtual class cl_option *get_option(int idx);
   virtual int nuof_options(char *the_name);
   virtual int nuof_options(char *the_name, char *creator);
 
-  virtual class cl_option *set_value(char *the_name, cl_base *creator,
+  virtual class cl_option *set_value(const char *the_name, cl_base *creator,
                                      bool value);
-  virtual class cl_option *set_value(char *the_name, cl_base *creator,
+  virtual class cl_option *set_value(const char *the_name, cl_base *creator,
                                      char *value);
-  virtual class cl_option *set_value(char *the_name, cl_base *creator,
+  virtual class cl_option *set_value(const char *the_name, cl_base *creator,
                                      void *value);
-  virtual class cl_option *set_value(char *the_name, cl_base *creator,
+  virtual class cl_option *set_value(const char *the_name, cl_base *creator,
                                      long value);
-  virtual class cl_option *set_value(char *the_name, cl_base *creator,
+  virtual class cl_option *set_value(const char *the_name, cl_base *creator,
                                      double value);
 };
 
@@ -140,16 +140,16 @@ public:
 
   virtual class cl_option *create(class cl_base *creator,
                                   enum option_type type,
-                                  char *the_name, char *help);
-  virtual void default_option(char *the_name);
+                                  const char *the_name, const char *help);
+  virtual void default_option(const char *the_name);
   virtual class cl_option *use(void);
-  virtual class cl_option *use(char *the_name);
+  virtual class cl_option *use(const char *the_name);
   virtual void option_changed(void) {}
   virtual void option_removing(void);
   virtual class cl_base *get_owner(void) { return(owner); }
 
   virtual bool get_value(bool);
-  virtual char *get_value(char *);
+  virtual char *get_value(const char *);
   virtual void *get_value(void *);
   virtual long get_value(long);
   virtual double get_value(double);
@@ -159,9 +159,9 @@ public:
 class cl_bool_option: public cl_option
 {
 public:
-  cl_bool_option(class cl_base *the_creator, char *aname, char *Ihelp);
+  cl_bool_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual void print(class cl_console_base *con);
-  virtual char *get_type_name(void) { return("boolean"); }
+  virtual const char *get_type_name(void) { return("boolean"); }
   virtual void set_value(char *s);
 };
 
@@ -169,29 +169,29 @@ public:
 class cl_string_option: public cl_option
 {
 public:
-  cl_string_option(class cl_base *the_creator, char *aname, char *Ihelp);
+  cl_string_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual class cl_option &operator=(class cl_option &o);
   virtual void print(class cl_console_base *con);
-  virtual char *get_type_name(void) { return("string"); }
+  virtual const 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);
+  cl_pointer_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual class cl_option &operator=(class cl_option &o);
   virtual void print(class cl_console_base *con);
-  virtual char *get_type_name(void) { return("pointer"); }
+  virtual const char *get_type_name(void) { return("pointer"); }
 };
 
 
 class cl_number_option: public cl_option
 {
 public:
-  cl_number_option(class cl_base *the_creator, char *aname, char *Ihelp);
+  cl_number_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual void print(class cl_console_base *con);
-  virtual char *get_type_name(void) { return("integer"); }
+  virtual const char *get_type_name(void) { return("integer"); }
   virtual void set_value(char *s);
 };
 
@@ -199,9 +199,9 @@ public:
 class cl_float_option: public cl_option
 {
 public:
-  cl_float_option(class cl_base *the_creator, char *aname, char *Ihelp);
+  cl_float_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
   virtual void print(class cl_console_base *con);
-  virtual char *get_type_name(void) { return("float"); }
+  virtual const char *get_type_name(void) { return("float"); }
   virtual void set_value(char *s);
 };
 
index 126e14db5d7e31c6f33610938cfc7f22bcfe38a7..e32deed6a03105499583afb7a53432995192e88a 100644 (file)
@@ -76,16 +76,16 @@ cl_base::~cl_base(void)
 
 int cl_base::init(void) {return(0);}
 
-char *
-cl_base::get_name(char *def)
+const char *
+cl_base::get_name(const char *def)
 {
   if (!name)
     return(def);
   return(name);
 }
 
-char *
-cl_base::set_name(char *new_name)
+const char *
+cl_base::set_name(const char *new_name)
 {
   if (name)
     free(name);
@@ -98,8 +98,8 @@ cl_base::set_name(char *new_name)
   return(name);
 }
 
-char *
-cl_base::set_name(char *new_name, char *def_name)
+const char *
+cl_base::set_name(const char *new_name, const char *def_name)
 {
   char *def;
 
@@ -120,7 +120,7 @@ cl_base::set_name(char *new_name, char *def_name)
 }
 
 bool
-cl_base::is_named(char *the_name)
+cl_base::is_named(const char *the_name)
 {
   if (!name ||
       !*name ||
@@ -131,7 +131,7 @@ cl_base::is_named(char *the_name)
 }
 
 bool
-cl_base::is_inamed(char *the_name)
+cl_base::is_inamed(const char *the_name)
 {
   if (!name ||
       !*name ||
@@ -265,7 +265,7 @@ cl_event::~cl_event(void)
  * Initializing a collection
  */
 
-cl_list::cl_list(t_index alimit, t_index adelta, char *aname):
+cl_list::cl_list(t_index alimit, t_index adelta, const char *aname):
   cl_base()
 {
   count= 0;
@@ -460,7 +460,7 @@ cl_list::error(t_index code, t_index info)
  */
 
 void *
-cl_list::first_that(match_func test, void *arg)
+cl_list::first_that(match_func test, const void *arg)
 {
   for (t_index i= 0; i < count; i++)
     {
@@ -677,7 +677,7 @@ cl_list::set_limit(t_index alimit)
  * Initilizing the sorted collection
  */
 
-cl_sorted_list::cl_sorted_list(t_index alimit, t_index adelta, char *aname):
+cl_sorted_list::cl_sorted_list(t_index alimit, t_index adelta, const char *aname):
   cl_list(alimit, adelta, aname)
 {
   Duplicates= DD_FALSE;
@@ -691,7 +691,7 @@ cl_sorted_list::~cl_sorted_list(void) {}
  * Get the address of the key field in an item.
  */
 
-void *
+const void *
 cl_sorted_list::key_of(void *item)
 {
   return(item);
@@ -746,7 +746,7 @@ cl_sorted_list::add(void *item)
  */
 
 bool
-cl_sorted_list::search(void *key, t_index &index)
+cl_sorted_list::search(const void *key, t_index &index)
 {
   t_index l  = 0;
   t_index h  = count - 1;
@@ -784,7 +784,7 @@ cl_sorted_list::search(void *key, t_index &index)
  * Initilizing the string collection
  */
 
-cl_strings::cl_strings(t_index alimit, t_index adelta, char *aname):
+cl_strings::cl_strings(t_index alimit, t_index adelta, const char *aname):
   cl_sorted_list(alimit, adelta, aname)
 {
   Duplicates= DD_TRUE;
@@ -799,9 +799,9 @@ cl_strings::~cl_strings(void) {}
  */
 
 int
-cl_strings::compare(void *key1, void *key2)
+cl_strings::compare(const void *key1, const void *key2)
 {
-  return(strcmp((char *)key1, (char *)key2));
+  return(strcmp(static_cast<const char *>(key1), static_cast<const char *>(key2)));
 }
 
 
@@ -827,7 +827,7 @@ cl_strings::free_item(void* item)
  * Initilizing the unsorted string collection
  */
 
-cl_ustrings::cl_ustrings(t_index alimit, t_index adelta, char *aname):
+cl_ustrings::cl_ustrings(t_index alimit, t_index adelta, const char *aname):
   cl_strings(alimit, adelta, aname)
 {}
 
@@ -840,7 +840,7 @@ cl_ustrings::~cl_ustrings(void) {}
  */
 
 int
-cl_ustrings::compare(void *key1, void *key2)
+cl_ustrings::compare(const void *key1, const void *key2)
 {
   return(-1);
 }
@@ -851,11 +851,11 @@ cl_ustrings::compare(void *key1, void *key2)
  */
 
 bool
-cl_ustrings::search(void *key, t_index& index)
+cl_ustrings::search(const void *key, t_index& index)
 {
   t_index i    = 0;
   bool    found= DD_FALSE;
-  void    *Actual;
+  const void *Actual;
 
   if ((count) && key)
     {
index 317d1ce8d1fe102b384fdbe561b56badada54b9c..692eb73d1f21ae9de7a2e29a44061a1f0c206511 100644 (file)
@@ -58,14 +58,14 @@ public:
   virtual ~cl_base(void);
 
   virtual int init(void);
-  virtual char *get_name(void) { return(name); }
-  virtual char *get_name(char *def);
+  virtual const char *get_name(void) { return(name); }
+  virtual const char *get_name(const char *def);
   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);
+  const char *set_name(const char *new_name);
+  const char *set_name(const char *new_name, const char *def_name);
+  bool is_named(const char *the_name);
+  bool is_inamed(const char *the_name);
 
   class cl_base *get_parent(void) { return(parent); }
   int nuof_children(void);
@@ -118,7 +118,7 @@ protected:
   t_index         Delta;
 
 public:
-  cl_list(t_index alimit, t_index adelta, char *aname);
+  cl_list(t_index alimit, t_index adelta, const char *aname);
   virtual ~cl_list(void);
 
          void     *at(t_index index);
@@ -145,7 +145,7 @@ public:
   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);
+         void     *first_that(match_func test, const void *arg);
          void     *last_that(match_func test, void *arg);
          void     for_each(iterator_func action, void *arg);
 
@@ -167,15 +167,15 @@ class cl_sorted_list: public cl_list
 public:
   bool            Duplicates;
 public:
-  cl_sorted_list(t_index alimit, t_index adelta, char *aname);
+  cl_sorted_list(t_index alimit, t_index adelta, const char *aname);
   virtual ~cl_sorted_list(void);
   
-  virtual bool    search(void *key, t_index& index);
+  virtual bool    search(const void *key, t_index& index);
   virtual t_index  index_of(void *item);
   virtual t_index  add(void *item);
-  virtual void    *key_of(void *item);
+  virtual const void *key_of(void *item);
 private:
-  virtual int     compare(void *key1, void *key2)= 0;
+  virtual int     compare(const void *key1, const void *key2)= 0;
 };
 
 
@@ -189,11 +189,11 @@ private:
 class cl_strings: public cl_sorted_list
 {
 public:
-  cl_strings(t_index alimit, t_index adelta, char *aname);
+  cl_strings(t_index alimit, t_index adelta, const char *aname);
   virtual ~cl_strings(void);
   
 private:
-  virtual int     compare(void *key1, void *key2);
+  virtual int     compare(const void *key1, const void *key2);
   virtual void    free_item(void *item);
 };
 
@@ -208,12 +208,12 @@ private:
 class cl_ustrings: public cl_strings
 {
 public:
-  cl_ustrings(t_index alimit, t_index adelta, char *aname);
+  cl_ustrings(t_index alimit, t_index adelta, const char *aname);
   virtual ~cl_ustrings(void);
   
 private:
-  virtual int     compare(void *key1, void *key2);
-  virtual bool    search(void *key, t_index &index);
+  virtual int     compare(const void *key1, const void *key2);
+  virtual bool    search(const void *key, t_index &index);
 };
 
 
index 3b87988959dde552802f454616be1dab93586be3..45e7e6115da1214a6e0956b8776801bdb5626677 100644 (file)
@@ -37,7 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #endif
 
 typedef int    t_index;
-typedef int    (*match_func)(void *, void *);
+typedef int    (*match_func)(void *, const void *);
 typedef void   (*iterator_func)(void *, void *);
 
 #define max_list_size (0x10000/sizeof(void *))
index dde27150741d47cddbdf41dca6961f96c202aed9..e36fb422b05d924451a3f461a045e1ab97a12759 100644 (file)
@@ -449,7 +449,7 @@ cl_serial::happen(class cl_hw *where, enum hw_event he, void *params)
 void
 cl_serial::print_info(class cl_console_base *con)
 {
-  char *modes[]= { "Shift, fixed clock",
+  const char *modes[]= { "Shift, fixed clock",
                    "8 bit UART timer clocked",
                    "9 bit UART fixed clock",
                    "9 bit UART timer clocked" };
index e4c281df590e74b312c6b8b543d4ab0e3f3b33ed..f929aecb1fc2e3c42b27cfa7797d0b285c93befb 100644 (file)
@@ -57,7 +57,7 @@ class cl_uc *
 cl_sim51::mk_controller(void)
 {
   int i;
-  char *typ= NIL;
+  const char *typ= NIL;
   class cl_optref type_option(this);
 
   type_option.init();
index 6eea6faca7173d97427c91772e6d86a497d09e4c..5024c9e320eb4d1dd8325cd6bca6485c3d751a28 100644 (file)
@@ -30,7 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "types51.h"
 
 
-cl_timer0::cl_timer0(class cl_uc *auc, int aid, char *aid_string):
+cl_timer0::cl_timer0(class cl_uc *auc, int aid, const char *aid_string):
   cl_hw(auc, HW_TIMER, aid, aid_string)
 {
   cell_tmod= cell_tcon= 0;
@@ -372,7 +372,7 @@ cl_timer0::happen(class cl_hw *where, enum hw_event he, void *params)
 void
 cl_timer0::print_info(class cl_console_base *con)
 {
-  char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "2x8 bit" };
+  const 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);
index f0628fb4e1944d55cd3ab79a053b5c898f3d67cc..a34846ec824c4b6fc3b7b0706dee3c267ec357b1 100644 (file)
@@ -46,7 +46,7 @@ protected:
   t_addr addr_tl, addr_th;
   int mode, GATE, C_T, TR, INT, T_edge;
 public:
-  cl_timer0(class cl_uc *auc, int aid, char *aid_string);
+  cl_timer0(class cl_uc *auc, int aid, const char *aid_string);
   virtual int init(void);
 
   virtual void added_to_uc(void);
index ec6398694a3a7e220c349e3f4588906f2ac5bbaa..54739aa36f0886b4d89e0f89ef2c86489481becc 100644 (file)
@@ -29,7 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "regs51.h"
 
 
-cl_timer1::cl_timer1(class cl_uc *auc, int aid, char *aid_string):
+cl_timer1::cl_timer1(class cl_uc *auc, int aid, const char *aid_string):
   cl_timer0(auc, aid, aid_string)
 {
   make_partner(HW_UART, 0);
@@ -63,7 +63,7 @@ cl_timer1::overflow(void)
 void
 cl_timer1::print_info(class cl_console_base *con)
 {
-  char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "stop" };
+  const 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);
index cd182327e2f8bbdd160c384edd92d2f66583dafb..33c6e09ca7a3709bfe458f96ffc6ea2ea49e6104 100644 (file)
@@ -39,7 +39,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 class cl_timer1: public cl_timer0
 {
 public:
-  cl_timer1(class cl_uc *auc, int aid, char *aid_string);
+  cl_timer1(class cl_uc *auc, int aid, const char *aid_string);
   //virtual int init(void);
 
   //virtual void new_hw_added(class cl_hw *new_hw);
index a238179f93d30bc322524b94e4d50e5bb83328cd..93738acfe60eae140e6299c19176f9568d4cf4aa 100644 (file)
@@ -30,7 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "types51.h"
 
 
-cl_timer2::cl_timer2(class cl_uc *auc, int aid, char *aid_string,
+cl_timer2::cl_timer2(class cl_uc *auc, int aid, const char *aid_string,
                      int afeatures):
   cl_timer0(auc, /*2*/aid, /*"timer2"*/aid_string)
 {
index 15d2d26479fa6c8e8169e09be7c45493e36c5590..b0cd339e3f1f6ec6e791a591119b9277c412575a 100644 (file)
@@ -63,7 +63,7 @@ protected:
   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);
+  cl_timer2(class cl_uc *auc, int aid, const char *aid_string, int afeautres);
   virtual int init(void);
 
   virtual void added_to_uc(void);
index 3d2ad4f58fb289d4ac447df65b6acbd47ef3f5b0..c258787474136de2db86770832d3e287c47b230c 100644 (file)
@@ -445,7 +445,7 @@ cl_uc390::clear_sfr(void)
 
 
 t_mem
-cl_uc390::read_mem(char *id/*enum mem_class type*/, t_addr addr)
+cl_uc390::read_mem(const char *id/*enum mem_class type*/, t_addr addr)
 {
 
   if (strcmp(/*type*/id,/* == */MEM_XRAM_ID)==0 &&
@@ -459,7 +459,7 @@ cl_uc390::read_mem(char *id/*enum mem_class type*/, t_addr addr)
 }
 
 t_mem
-cl_uc390::get_mem (char *id/*enum mem_class type*/, t_addr addr)
+cl_uc390::get_mem (const char *id/*enum mem_class type*/, t_addr addr)
 {
   if (strcmp(/*type*/id/* == */,MEM_XRAM_ID)==0 &&
       addr >= 0x400000 &&
@@ -472,7 +472,7 @@ cl_uc390::get_mem (char *id/*enum mem_class type*/, t_addr addr)
 }
 
 void
-cl_uc390::write_mem (char *id/*enum mem_class type*/, t_addr addr, t_mem val)
+cl_uc390::write_mem (const char *id/*enum mem_class type*/, t_addr addr, t_mem val)
 {
   if (strcmp(/*type ==*/id, MEM_XRAM_ID)==0 &&
       addr >= 0x400000 &&
@@ -485,7 +485,7 @@ cl_uc390::write_mem (char *id/*enum mem_class type*/, t_addr addr, t_mem val)
 }
 
 void
-cl_uc390::set_mem (/*enum mem_class type*/char *id, t_addr addr, t_mem val)
+cl_uc390::set_mem (/*enum mem_class type*/const char *id, t_addr addr, t_mem val)
 {
   if (/*type == */strcmp(id,MEM_XRAM_ID)==0 &&
       addr >= 0x400000 &&
@@ -1084,7 +1084,8 @@ char *
 cl_uc390::disass (t_addr addr, char *sep)
 {
   char work[256], temp[20], c[2];
-  char *buf, *p, *b, *t;
+  const char *b;
+  char *buf, *p, *t;
   t_mem code;
 
   if (! (sfr->get (ACON) & 0x02)) /* AM1 set: 24-bit flat? */
@@ -1181,10 +1182,10 @@ cl_uc390::disass (t_addr addr, char *sep)
     buf = (char *) malloc (6 + strlen (p) + 1);
   else
     buf = (char *) malloc ((p - work) + strlen (sep) + strlen (p) + 1);
-  for (p = work, b = buf; *p != ' '; p++, b++)
-    *b = *p;
+  for (p = work, t = buf; *p != ' '; p++, t++)
+    *t = *p;
   p++;
-  *b = '\0';
+  *t = '\0';
   if (sep == NULL)
     while (strlen (buf) < 6)
       strcat (buf, " ");
index 399a937f443ad6ca7f523f92c5495d2bb3163ad9..009487f0e089f5bed5a1dcdbeefa9d2198f4c1cc 100644 (file)
@@ -46,10 +46,10 @@ public:
   //virtual t_addr get_mem_size (enum mem_class type);
 
   // manipulating memories
-  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);
+  virtual t_mem read_mem (const char *id/*enum mem_class type*/, t_addr addr);
+  virtual t_mem get_mem (const char *id/*enum mem_class type*/, t_addr addr);
+  virtual void  write_mem (const char *id/*enum mem_class type*/, t_addr addr, t_mem val);
+  virtual void  set_mem (const char *id/*enum mem_class type*/, t_addr addr, t_mem val);
 
   /* mods for dual-dptr */
   virtual int inst_inc_dptr(uchar code);
index aec033ac788bb08edf74d516f553d7f7a8bed0b9..29012a2715ca65fad25fef619f91d496a001c622 100644 (file)
@@ -123,11 +123,10 @@ cl_51core::init(void)
   return(0);
 }
 
-static char id_string_51[100];
-
-char *
+const char *
 cl_51core::id_string(void)
 {
+  static char id_string_51[100];
   int i;
 
   for (i= 0; cpus_51[i].type_str != NULL && cpus_51[i].type != type; i++) ;
@@ -319,7 +318,8 @@ char *
 cl_51core::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20], c[2];
-  char *buf, *p, *b, *t;
+  const char *b;
+  char *buf, *p, *t;
   t_mem code= rom->get(addr);
 
   p= work;
@@ -409,10 +409,10 @@ cl_51core::disass(t_addr addr, char *sep)
     buf= (char *)malloc(6+strlen(p)+1);
   else
     buf= (char *)malloc((p-work)+strlen(sep)+strlen(p)+1);
-  for (p= work, b= buf; *p != ' '; p++, b++)
-    *b= *p;
+  for (p= work, t= buf; *p != ' '; p++, t++)
+    *t= *p;
   p++;
-  *b= '\0';
+  *t= '\0';
   if (sep == NULL)
     {
       while (strlen(buf) < 6)
index 58950df2d807d46d705375d151ca03085cef426a..e961385ee7101bf884397f50ad909db31f7afff8 100644 (file)
@@ -88,7 +88,7 @@ public:
   cl_51core(int Itype, int Itech, class cl_sim *asim);
   virtual ~cl_51core(void);
   virtual int    init(void);
-  virtual char  *id_string(void);
+  virtual const char *id_string(void);
   virtual void mk_hw_elements(void);
   virtual void build_cmdset(class cl_cmdset *cmdset);
   //virtual class cl_m *mk_mem(enum mem_class type, char *class_name);
index e38ae65dc95938344b2af88a0eff9fd1e16c5486..816d54d317f5b5633de128c71a52bf3898751647 100644 (file)
@@ -55,7 +55,7 @@ cl_arg::cl_arg(long lv):
   s_value= 0;
 }
 
-cl_arg::cl_arg(char *sv):
+cl_arg::cl_arg(const char *sv):
   cl_base()
 {
   s_value= sv?strdup(sv):0;
@@ -243,7 +243,7 @@ cl_cmd_int_arg::as_string(void)
 
 /* Symbol */
 
-cl_cmd_sym_arg::cl_cmd_sym_arg(/*class cl_uc *iuc,*/ char *sym):
+cl_cmd_sym_arg::cl_cmd_sym_arg(/*class cl_uc *iuc,*/ const char *sym):
   cl_cmd_arg(/*iuc,*/ sym)
 {}
 
@@ -323,7 +323,7 @@ cl_cmd_sym_arg::as_hw(class cl_uc *uc)
 
 /* String */
 
-cl_cmd_str_arg::cl_cmd_str_arg(/*class cl_uc *iuc,*/ char *str):
+cl_cmd_str_arg::cl_cmd_str_arg(/*class cl_uc *iuc,*/ const char *str):
   cl_cmd_arg(/*iuc,*/ str)
 {
 }
index c829d92e2fcc66ed3fbcea99bdaa283d653a125a..4b7d1363456501dc352488a2c1a431ee10a43efd 100644 (file)
@@ -49,7 +49,7 @@ public:
 
 public:  
   cl_arg(long lv);
-  cl_arg(char *lv);
+  cl_arg(const char *lv);
   cl_arg(double fv);
   cl_arg(void *pv);
   virtual ~cl_arg(void);
@@ -102,7 +102,7 @@ public:
 public:
   cl_cmd_arg(/*class cl_uc *iuc,*/ long i): cl_arg(i)
   { /*uc= iuc;*/ interpreted_as_string= DD_FALSE; }
-  cl_cmd_arg(/*class cl_uc *iuc,*/ char *s): cl_arg(s)
+  cl_cmd_arg(/*class cl_uc *iuc,*/ const char *s): cl_arg(s)
   { /*uc= iuc;*/ interpreted_as_string= DD_FALSE; }
   virtual ~cl_cmd_arg(void);
 
@@ -133,7 +133,7 @@ public:
 class cl_cmd_sym_arg: public cl_cmd_arg
 {
 public:
-  cl_cmd_sym_arg(/*class cl_uc *iuc,*/ char *sym);
+  cl_cmd_sym_arg(/*class cl_uc *iuc,*/ const char *sym);
 
   virtual bool get_address(class cl_uc *uc, t_addr *addr);
   virtual bool get_bit_address(class cl_uc *uc, // input
@@ -149,7 +149,7 @@ public:
 class cl_cmd_str_arg: public cl_cmd_arg
 {
 public:
-  cl_cmd_str_arg(/*class cl_uc *iuc,*/ char *str);
+  cl_cmd_str_arg(/*class cl_uc *iuc,*/ const char *str);
 
   virtual int is_string(void) { return(1); }
   virtual bool as_number(void) { return(DD_FALSE); }
index f28ccc62343a08f008b28d80bb6f38fd67d792a2..12b87d6c034adb7d8ecbb078ffe61ed92dabe5c6 100644 (file)
@@ -160,7 +160,7 @@ brk_coll::brk_coll(t_index alimit, t_index adelta,
   rom= arom;
 }
 
-void *
+const void *
 brk_coll::key_of(void *item)
 {
   return((void *)&(((class cl_brk *)(item))->nr));
@@ -168,7 +168,7 @@ brk_coll::key_of(void *item)
 
 
 int
-brk_coll::compare(void *key1, void *key2)
+brk_coll::compare(const void *key1, const void *key2)
 {
   int k1, k2;
 
index 0b93c72586964ff5e66f983bf3cd906660907995..aa7738840fc7f45bdf2f333245f6ce0fd7606e38 100644 (file)
@@ -116,8 +116,8 @@ public:
   class cl_address_space/*rom*/ *rom;
 public:
   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);
+  virtual const void *key_of(void *item);
+  virtual int  compare(const void *key1, const void *key2);
 
   virtual bool there_is_event(enum brk_event ev);
   //virtual int make_new_nr(void);
index ea4c5f4efca910f383c2933ecd17dbb63a768124..143e9b94b2de76020df5b50d174727aa7f55bf1a 100644 (file)
@@ -111,7 +111,7 @@ cl_used_cell::address_space_added(class cl_address_space *amem,
  *____________________________________________________________________________
  */
 
-cl_hw::cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, char *aid_string):
+cl_hw::cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, const char *aid_string):
   cl_guiobj()
 {
   flags= HWF_INSIDE;
index d573010b456ac1ca0ca620fda63b7132234236f5..39f3b68e83db86fafd48ac9e845fb303d51f13e2 100644 (file)
@@ -100,7 +100,7 @@ protected:
   class cl_list *partners;
   class cl_list *watched_cells;
 public:
-  cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, char *aid_string);
+  cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, const char *aid_string);
   virtual ~cl_hw(void);
 
   virtual void new_hw_adding(class cl_hw *new_hw);
index ad17146d9ef5d8b2ef0a27237883173946a4e503..32fc69594fccd7018b6ec354fbc2f4ee1fa66f5f 100644 (file)
@@ -46,7 +46,7 @@ cl_it_src::cl_it_src(uchar Iie_mask,
                     uchar Isrc_mask,
                     uint  Iaddr,
                     bool  Iclr_bit,
-                    char  *Iname,
+                    const char  *Iname,
                     int   apoll_priority):
   cl_base()
 {
@@ -99,7 +99,7 @@ cl_irqs::cl_irqs(t_index alimit, t_index adelta):
   Duplicates= DD_TRUE;
 }
 
-void *
+const void *
 cl_irqs::key_of(void *item)
 {
   class cl_it_src *itsrc= (class cl_it_src *)item;
@@ -107,13 +107,13 @@ cl_irqs::key_of(void *item)
 }
 
 int
-cl_irqs::compare(void *key1, void *key2)
+cl_irqs::compare(const void *key1, const void *key2)
 {
-  int *k1= (int*)key1, *k2= (int*)key2;
+  const int k1= *static_cast<const int *>(key1), k2= *static_cast<const int *>(key2);
 
-  if (*k1 == *k2)
+  if (k1 == k2)
     return(0);
-  else if (*k1 < *k2)
+  else if (k1 < k2)
     return(-1);
   return(1);
 }
index 7f9bd7efb51557d92ad40121e9d269ba84315469..673a96e86c6cae18a85f0863b2c542952e0c3232 100644 (file)
@@ -53,7 +53,7 @@ public:
            uchar Isrc_mask,
            uint  Iaddr,
            bool  Iclr_bit,
-           char  *Iname,
+           const char  *Iname,
            int   apoll_priority);
   virtual ~cl_it_src(void);
 
@@ -68,8 +68,8 @@ class cl_irqs: public cl_sorted_list
 {
 public:
   cl_irqs(t_index alimit, t_index adelta);
-  virtual void *key_of(void *item); 
-  virtual int compare(void *key1, void *key2);
+  virtual const void *key_of(void *item); 
+  virtual int compare(const void *key1, const void *key2);
 };
 
 
index 9d27714d2f75019d7cefa70701ebfbe390d3679c..b0bc0d4146d927a0b5ce7054a4667c3d913580b1 100644 (file)
@@ -54,7 +54,7 @@ static class cl_mem_error_registry mem_error_registry;
  *                                                3rd version of memory system
  */
 
-cl_memory::cl_memory(char *id, t_addr asize, int awidth):
+cl_memory::cl_memory(const char *id, t_addr asize, int awidth):
   cl_base()
 {
   size= asize;
@@ -696,7 +696,7 @@ cl_dummy_cell::set(t_mem val)
  *                                                                Address space
  */
 
-cl_address_space::cl_address_space(char *id,
+cl_address_space::cl_address_space(const char *id,
                                    t_addr astart, t_addr asize, int awidth):
   cl_memory(id, asize, awidth)
 {
@@ -1056,7 +1056,7 @@ cl_address_space_list::add(class cl_address_space *mem)
  *                                                                  Memory chip
  */
 
-cl_memory_chip::cl_memory_chip(char *id, int asize, int awidth, int initial):
+cl_memory_chip::cl_memory_chip(const char *id, int asize, int awidth, int initial):
   cl_memory(id, asize, awidth)
 {
   array= (t_mem *)malloc(size * sizeof(t_mem));
@@ -1313,7 +1313,7 @@ cl_decoder_list::cl_decoder_list(t_index alimit, t_index adelta, bool bychip):
   by_chip= bychip;
 }
 
-void *
+const void *
 cl_decoder_list::key_of(void *item)
 {
   class cl_address_decoder *d= (class cl_address_decoder *)item;
@@ -1324,9 +1324,9 @@ cl_decoder_list::key_of(void *item)
 }
 
 int
-cl_decoder_list::compare(void *key1, void *key2)
+cl_decoder_list::compare(const void *key1, const void *key2)
 {
-  t_addr k1= *((t_addr*)key1), k2= *((t_addr*)key2);
+  const t_addr k1= *(static_cast<const t_addr *>(key1)), k2= *(static_cast<const t_addr*>(key2));
   if (k1 == k2)
     return(0);
   else if (k1 > k2)
index e647f5ea1095d8555578cadde42933d5ff995783..9ebf3c148afe3918cdab7756bd9385f3cd15171b 100644 (file)
@@ -81,7 +81,7 @@ public:
 protected:
   t_addr dump_finished;
 public:
-  cl_memory(char *id, t_addr asize, int awidth);
+  cl_memory(const char *id, t_addr asize, int awidth);
   virtual ~cl_memory(void);
   virtual int init(void);
 
@@ -278,7 +278,7 @@ protected:
 public:
   class cl_decoder_list *decoders;
 public:
-  cl_address_space(char *id, t_addr astart, t_addr asize, int awidth);
+  cl_address_space(const char *id, t_addr astart, t_addr asize, int awidth);
   virtual ~cl_address_space(void);
 
   virtual bool is_address_space(void) { return(DD_TRUE); }
@@ -340,7 +340,7 @@ protected:
   t_mem *array;
   int init_value;
 public:
-  cl_memory_chip(char *id, int asize, int awidth, int initial= -1);
+  cl_memory_chip(const char *id, int asize, int awidth, int initial= -1);
   virtual ~cl_memory_chip(void);
   virtual int init(void);
 
@@ -395,8 +395,8 @@ protected:
 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);
+  virtual const void *key_of(void *item);
+  virtual int compare(const void *key1, const void *key2);
 };
 
 
index e40fb4a45942581b94fd6dbdf0abff6d7e3b29ef..60e13ad16dfa8bafb6d62939e086697be541006d 100644 (file)
@@ -78,7 +78,7 @@ cl_stack_op::info(class cl_console_base *con, class cl_uc *uc)
   //con->dd_printf("\n");
 }
 
-char *
+const char *
 cl_stack_op::get_op_name(void)
 {
   return("op");
@@ -157,7 +157,7 @@ cl_stack_call::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_call::get_op_name(void)
 {
   return("call");
@@ -169,7 +169,7 @@ cl_stack_call::print_info(class cl_console_base *con)
   con->dd_printf("0x%06"_A_"x", called_addr);
 }
 
-char *
+const char *
 cl_stack_call::get_matching_name(void)
 {
   return("ret");
@@ -208,7 +208,7 @@ cl_stack_intr::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_intr::get_op_name(void)
 {
   return("intr");
@@ -220,7 +220,7 @@ cl_stack_intr::print_info(class cl_console_base *con)
   con->dd_printf("0x%06"_A_"x", called_addr);
 }
 
-char *
+const char *
 cl_stack_intr::get_matching_name(void)
 {
   return("iret");
@@ -257,13 +257,13 @@ cl_stack_push::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_push::get_op_name(void)
 {
   return("push");
 }
 
-char *
+const char *
 cl_stack_push::get_matching_name(void)
 {
   return("pop");
@@ -307,13 +307,13 @@ cl_stack_ret::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_ret::get_op_name(void)
 {
   return("ret");
 }
 
-char *
+const char *
 cl_stack_ret::get_matching_name(void)
 {
   return("call");
@@ -350,13 +350,13 @@ cl_stack_iret::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_iret::get_op_name(void)
 {
   return("iret");
 }
 
-char *
+const char *
 cl_stack_iret::get_matching_name(void)
 {
   return("intr");
@@ -393,13 +393,13 @@ cl_stack_pop::mk_copy(void)
   return(so);
 }
 
-char *
+const char *
 cl_stack_pop::get_op_name(void)
 {
   return("pop");
 }
 
-char *
+const char *
 cl_stack_pop::get_matching_name(void)
 {
   return("push");
index 9b25d61e8cfd14f1b53e211b1f66667d23ba1d14..bd2f357c00ff458c9a0387fd6bb8bf9daf9eb359 100644 (file)
@@ -62,8 +62,8 @@ public:
 protected:
   virtual void print_info(class cl_console_base *con);
 public:
-  virtual char *get_op_name(void);
-  virtual char *get_matching_name(void) { return("unknown"); }
+  virtual const char *get_op_name(void);
+  virtual const 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);
@@ -86,10 +86,10 @@ public:
                 t_addr iSP_before, t_addr iSP_after);
   virtual class cl_stack_op *mk_copy(void);
 protected:
-  virtual char *get_op_name(void);
+  virtual const char *get_op_name(void);
   virtual void print_info(class cl_console_base *con);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
@@ -102,10 +102,10 @@ public:
                 t_addr iSP_before, t_addr iSP_after);
   virtual class cl_stack_op *mk_copy(void);
 protected:
-  virtual char *get_op_name(void);
+  virtual const char *get_op_name(void);
   virtual void print_info(class cl_console_base *con);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
@@ -119,10 +119,10 @@ 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 const char *get_op_name(void);
   virtual void print_info(class cl_console_base *con);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
@@ -134,9 +134,9 @@ 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);
+  virtual const char *get_op_name(void);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
@@ -148,9 +148,9 @@ 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);
+  virtual const char *get_op_name(void);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
@@ -162,9 +162,9 @@ 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);
+  virtual const char *get_op_name(void);
 public:
-  virtual char *get_matching_name(void);
+  virtual const char *get_matching_name(void);
   virtual enum stack_op get_matching_op(void);
   virtual bool match(class cl_stack_op *op);
 };
index 4d57c0c7c5023066950cf7dbb9fb170881d580e8..4550bb09494e559f8edfd27b73e08d6bc570c238 100644 (file)
@@ -62,7 +62,7 @@ static class cl_uc_error_registry uc_error_registry;
  * Clock counter
  */
 
-cl_ticker::cl_ticker(int adir, int in_isr, char *aname)
+cl_ticker::cl_ticker(int adir, int in_isr, const char *aname)
 {
   options= TICK_RUN;
   if (in_isr)
@@ -221,7 +221,7 @@ cl_uc::init(void)
   return(0);
 }
 
-char *
+const char *
 cl_uc::id_string(void)
 {
   return("unknown microcontroller");
@@ -593,7 +593,7 @@ cmd->init();*/
  */
 
 t_mem
-cl_uc::read_mem(char *id, t_addr addr)
+cl_uc::read_mem(const char *id, t_addr addr)
 {
   class cl_address_space *m= address_space(id);
 
@@ -601,7 +601,7 @@ cl_uc::read_mem(char *id, t_addr addr)
 }
 
 t_mem
-cl_uc::get_mem(char *id, t_addr addr)
+cl_uc::get_mem(const char *id, t_addr addr)
 {
   class cl_address_space *m= address_space(id);
 
@@ -609,7 +609,7 @@ cl_uc::get_mem(char *id, t_addr addr)
 }
 
 void
-cl_uc::write_mem(char *id, t_addr addr, t_mem val)
+cl_uc::write_mem(const char *id, t_addr addr, t_mem val)
 {
   class cl_address_space *m= address_space(id);
 
@@ -618,7 +618,7 @@ cl_uc::write_mem(char *id, t_addr addr, t_mem val)
 }
 
 void
-cl_uc::set_mem(char *id, t_addr addr, t_mem val)
+cl_uc::set_mem(const char *id, t_addr addr, t_mem val)
 {
   class cl_address_space *m= address_space(id);
 
@@ -642,7 +642,7 @@ cl_uc::mem(enum mem_class type)
 */
 
 class cl_address_space *
-cl_uc::address_space(char *id)
+cl_uc::address_space(const char *id)
 {
   int i;
 
@@ -662,7 +662,7 @@ cl_uc::address_space(char *id)
 }
 
 class cl_memory *
-cl_uc::memory(char *id)
+cl_uc::memory(const char *id)
 {
   int i;
 
@@ -1029,7 +1029,7 @@ cl_uc::bit_tbl(void)
 }
 
 char *
-cl_uc::disass(t_addr addr, char *sep)
+cl_uc::disass(t_addr addr, const char *sep)
 {
   char *buf;
 
index 332092cb3f7702924c32a01584ce0093220daedb..54f4f605f5ca79f9b01eac905e90b41123bddf05 100644 (file)
@@ -53,7 +53,7 @@ public:
   int dir;
   //char *name;
 
-  cl_ticker(int adir, int in_isr, char *aname);
+  cl_ticker(int adir, int in_isr, const char *aname);
   virtual ~cl_ticker(void);
   
   virtual int tick(int nr);
@@ -119,7 +119,7 @@ public:
   cl_uc(class cl_sim *asim);
   virtual ~cl_uc(void);
   virtual int init(void);
-  virtual char *id_string(void);
+  virtual const char *id_string(void);
   virtual void reset(void);
 
   // making objects
@@ -131,12 +131,12 @@ public:
   virtual void build_cmdset(class cl_cmdset *cmdset);
 
   // manipulating memories
-  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);
+  virtual t_mem read_mem(const char *id, t_addr addr);
+  virtual t_mem get_mem(const char *id, t_addr addr);
+  virtual void write_mem(const char *id, t_addr addr, t_mem val);
+  virtual void set_mem(const char *id, t_addr addr, t_mem val);
+  virtual class cl_address_space *address_space(const char *id);
+  virtual class cl_memory *memory(const char *id);
 
   // file handling
   virtual long read_hex_file(const char *nam);
@@ -197,7 +197,7 @@ public:
   virtual void check_events(void);
 
   // disassembling and symbol recognition
-  virtual char *disass(t_addr addr, char *sep);
+  virtual char *disass(t_addr addr, const char *sep);
   virtual struct dis_entry *dis_tbl(void);
   virtual struct name_entry *sfr_tbl(void);
   virtual struct name_entry *bit_tbl(void);
index a80b241f4b172f6230500eb7ab8b43e901e499e8..f7380609495b3c3546231f9185f72a29bed29310 100644 (file)
@@ -41,7 +41,7 @@ typedef TYPE_WORD     t_smem;         /* signed 16 bit memory */
 struct id_element
 {
   int id;
-  char *id_string;
+  const char *id_string;
 };
 
 enum error_type {
@@ -56,21 +56,21 @@ struct dis_entry
   uint  code, mask;
   char  branch;
   uchar length;
-  char  *mnemonic;
+  const char *mnemonic;
 };
 
 // table entry of SFR and BIT names
 struct name_entry
 {
-  int          cpu_type;
-  t_addr       addr;
-  char         *name;
+  int cpu_type;
+  t_addr addr;
+  const char *name;
 };
 
 
 struct cpu_entry
 {
-  char *type_str;
+  const char *type_str;
   int  type;
   int  technology;
 };
index a46aebc460ad40a7c362e27e840f64fcc5370fb2..eb648e7ff56e8cf0447cf425f2c25778b32d2d66 100644 (file)
@@ -67,7 +67,7 @@ get_sub_opt(char **option, const char * const *tokens, char **valuep)
 }
 
 
-char *
+const char *
 get_id_string(struct id_element *ids, int id)
 {
   int i= 0;
@@ -77,16 +77,16 @@ get_id_string(struct id_element *ids, int id)
   return(ids[i].id_string);
 }
 
-char *
-get_id_string(struct id_element *ids, int id, char *def)
+const char *
+get_id_string(struct id_element *ids, int id, const char *def)
 {
-  char *s= get_id_string(ids, id);
+  const char *s= get_id_string(ids, id);
 
   return(s?s:def);
 }
 
 int
-get_string_id(struct id_element *ids, char *str)
+get_string_id(struct id_element *ids, const char *str)
 {
   int i= 0;
 
@@ -96,7 +96,7 @@ get_string_id(struct id_element *ids, char *str)
 }
 
 int
-get_string_id(struct id_element *ids, char *str, int def)
+get_string_id(struct id_element *ids, const char *str, int def)
 {
   int i= 0;
 
@@ -110,7 +110,7 @@ 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);
 
 char *
-format_string(char *format, ...)
+format_string(const char *format, ...)
 {
   va_list ap;
 
@@ -135,10 +135,10 @@ format_string(char *format, ...)
 }
 
 
-char *
+const char *
 object_name(class cl_base *o)
 {
-  char *name= 0;
+  const char *name= 0;
 
   if (o)
     name= o->get_name();
@@ -149,7 +149,7 @@ object_name(class cl_base *o)
 
 
 char *
-case_string(enum letter_case lcase, char *str)
+case_string(enum letter_case lcase, const char *str)
 {
   char *p= strdup(str);
   char *s= p;
@@ -182,7 +182,7 @@ case_string(enum letter_case lcase, char *str)
   return(s);
 }
 
-/*char *
+/*const char *
 case_string(enum letter_case lcase, const char *str)
 {
   char *p= NIL;
index f0cecff1f969c896351ae9ed1b222e116f2b5494..796654d76b80d0f618624ff5257df648a568f5eb 100644 (file)
@@ -39,13 +39,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 
 extern int get_sub_opt(char **option, const char * const *tokens, char **valuep);
-extern char *get_id_string(struct id_element *ids, int id);
-extern char *get_id_string(struct id_element *ids, int id, char *def);
-extern int get_string_id(struct id_element *ids, char *str);
-extern int get_string_id(struct id_element *ids, char *str, int def);
-extern char *format_string(char *format, ...);
-extern char *object_name(class cl_base *o);
-extern char *case_string(enum letter_case lcase, char *str);
+extern const char *get_id_string(struct id_element *ids, int id);
+extern const char *get_id_string(struct id_element *ids, int id, const char *def);
+extern int get_string_id(struct id_element *ids, const char *str);
+extern int get_string_id(struct id_element *ids, const char *str, int def);
+extern char *format_string(const char *format, ...);
+extern const char *object_name(class cl_base *o);
+extern char *case_string(enum letter_case lcase, const char *str);
 
 
 #endif
index 46c5654d2675e04027564b8e8d988fea87d30317..0c1af70c15ff0d56e94e9d9de4c286f5ff0b7f9d 100644 (file)
@@ -79,7 +79,7 @@ cl_z80::init(void)
   return(0);
 }
 
-char *
+const char *
 cl_z80::id_string(void)
 {
   return("unspecified Z80");
@@ -159,9 +159,8 @@ int
 cl_z80::inst_length(t_addr addr)
 {
   int len = 0;
-  char *s;
 
-  s = get_disasm_info(addr, &len, NULL, NULL);
+  get_disasm_info(addr, &len, NULL, NULL);
 
   return len;
 }
@@ -170,9 +169,8 @@ int
 cl_z80::inst_branch(t_addr addr)
 {
   int b;
-  char *s;
 
-  s = get_disasm_info(addr, NULL, &b, NULL);
+  get_disasm_info(addr, NULL, &b, NULL);
 
   return b;
 }
@@ -184,13 +182,13 @@ cl_z80::longest_inst(void)
 }
 
 
-char *
+const char *
 cl_z80::get_disasm_info(t_addr addr,
                         int *ret_len,
                         int *ret_branch,
                         int *immed_offset)
 {
-  char *b = NULL;
+  const char *b = NULL;
   uint code;
   int len = 0;
   int immed_n = 0;
@@ -310,11 +308,12 @@ cl_z80::get_disasm_info(t_addr addr,
   return b;
 }
 
-char *
+const char *
 cl_z80::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20];
-  char *buf, *p, *b, *t;
+  const char *b;
+  char *buf, *p, *t;
   int len = 0;
   int immed_offset = 0;
 
@@ -373,10 +372,10 @@ cl_z80::disass(t_addr addr, char *sep)
     buf= (char *)malloc(6+strlen(p)+1);
   else
     buf= (char *)malloc((p-work)+strlen(sep)+strlen(p)+1);
-  for (p= work, b= buf; *p != ' '; p++, b++)
-    *b= *p;
+  for (p= work, t= buf; *p != ' '; p++, t++)
+    *t= *p;
   p++;
-  *b= '\0';
+  *t= '\0';
   if (sep == NULL)
     {
       while (strlen(buf) < 6)
index 4d66aef9c7a6abeddd94cd7755779cc244a32686..2010d48ce1c7bb0222dbe4d504a28408cf241334 100644 (file)
@@ -46,7 +46,7 @@ public:
 public:
   cl_z80(class cl_sim *asim);
   virtual int init(void);
-  virtual char *id_string(void);
+  virtual const char *id_string(void);
 
   //virtual t_addr get_mem_size(enum mem_class type);
   virtual void mk_hw_elements(void);
@@ -56,12 +56,12 @@ public:
   virtual int inst_length(t_addr addr);
   virtual int inst_branch(t_addr addr);
   virtual int longest_inst(void);
-  virtual char *disass(t_addr addr, char *sep);
+  virtual const char *disass(t_addr addr, char *sep);
   virtual void print_regs(class cl_console_base *con);
 
   virtual int exec_inst(void);
 
-  virtual char * get_disasm_info(t_addr addr,
+  virtual const char *get_disasm_info(t_addr addr,
                         int *ret_len,
                         int *ret_branch,
                         int *immed_offset);