+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
* 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>
*/
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"
int
-cl_app::dd_printf(char *format, ...)
+cl_app::dd_printf(const char *format, ...)
{
va_list ap;
}
int
-cl_app::debug(char *format, ...)
+cl_app::debug(const char *format, ...)
{
va_list ap;
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, ...);
};
return(0);
}
-char *
+const char *
cl_avr::id_string(void)
{
return("unspecified AVR");
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;
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)
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);
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;}
};
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)
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
/* 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;
#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;
;
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;
}
;
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);
| expression PTOK_SLASH expression
{
if ($3 == 0)
- yyerror("Divide by zero");
+ yyerror((char *)"Divide by zero");
else
$$= $1 / $3;
}
$$= $2.bit_address;
if ($$ < 0)
{
- yyerror("Bit has no address.");
+ yyerror((char *)"Bit has no address.");
$$= 0;
}
}
int
cl_cmdline::repeat(void)
{
- char *n;
+ const char *n;
return((n= get_name()) &&
*n == '\n');
}
}
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);
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 &&
*/
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;
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;
}
class cl_cmd *
-cl_cmdset::get_cmd(char *cmd_name)
+cl_cmdset::get_cmd(const char *cmd_name)
{
int i;
*____________________________________________________________________________
*/
-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)
{
//char *name;
class cl_list *params;
class cl_ustrings *tokens;
- char *matched_syntax;
+ const char *matched_syntax;
class cl_console_base *con;
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:
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,
#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); \
//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);
};
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);
}
int
-cl_console_base::dd_printf(char *format, ...)
+cl_console_base::dd_printf(const char *format, ...)
{
va_list ap;
int ret= 0;
}
int
-cl_console_base::debug(char *format, ...)
+cl_console_base::debug(const char *format, ...)
{
if ((flags & CONS_DEBUG) == 0)
return(0);
*/
int
-cl_commander_base::all_printf(char *format, ...)
+cl_commander_base::all_printf(const char *format, ...)
{
va_list ap;
int i, ret= 0;
*/
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;
}
int
-cl_commander_base::dd_printf(char *format, ...)
+cl_commander_base::dd_printf(const char *format, ...)
{
va_list ap;
int ret= 0;
*/
int
-cl_commander_base::debug(char *format, ...)
+cl_commander_base::debug(const char *format, ...)
{
va_list ap;
int i, ret= 0;
}
int
-cl_commander_base::debug(char *format, va_list ap)
+cl_commander_base::debug(const char *format, va_list ap)
{
int i, ret= 0;
}
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;
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;
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);
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);
*____________________________________________________________________________
*/
-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;
}
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();
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);
*____________________________________________________________________________
*/
-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;
}
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();
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);
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",
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"
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)
/*
*/
-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()
{
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()
return(name);
}*/
-char *
+const char *
cl_error_class::get_type_name()
{
return(get_id_string(error_type_names, type, "untyped"));
c->dd_printf("%s\n", get_type_name());
}
-char *
+const char *
cl_error::get_type_name()
{
enum error_type type= get_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, 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);
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);
};
{
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)
{
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));
}
};
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
};
-char *warranty=
+const char *warranty=
" NO WARRANTY\n"
"\n"
" 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n"
;
-char *copying=
+const char *copying=
" GNU GENERAL PUBLIC LICENSE\n"
" Version 2, June 1991\n"
"\n"
}
-char *
+const char *
cl_hc08::id_string(void)
{
return("unspecified HC08");
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;
}
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;
}
}
-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;
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;
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)
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);
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);
*
*/
-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;
* 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
}
class cl_option *
-cl_options::get_option(char *the_name)
+cl_options::get_option(const char *the_name)
{
t_index idx;
}
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;
}
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;
}
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);
}
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);
}
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);
}
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);
}
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);
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);
}
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);
}
class cl_option *
-cl_optref::use(char *the_name)
+cl_optref::use(const char *the_name)
{
if (option)
option->del_reference(this);
}
char *
-cl_optref::get_value(char *)
+cl_optref::get_value(const char *)
{
if (!option)
{
*/
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)
{}
*/
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)
{}
*/
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)
{}
*/
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)
{}
*/
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)
{}
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);
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);
{
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);
};
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);
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);
};
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);
};
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);
};
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);
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;
}
bool
-cl_base::is_named(char *the_name)
+cl_base::is_named(const char *the_name)
{
if (!name ||
!*name ||
}
bool
-cl_base::is_inamed(char *the_name)
+cl_base::is_inamed(const char *the_name)
{
if (!name ||
!*name ||
* 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;
*/
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++)
{
* 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;
* Get the address of the key field in an item.
*/
-void *
+const void *
cl_sorted_list::key_of(void *item)
{
return(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;
* 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;
*/
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)));
}
* 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)
{}
*/
int
-cl_ustrings::compare(void *key1, void *key2)
+cl_ustrings::compare(const void *key1, const void *key2)
{
return(-1);
}
*/
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)
{
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);
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);
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);
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;
};
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);
};
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);
};
#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 *))
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" };
cl_sim51::mk_controller(void)
{
int i;
- char *typ= NIL;
+ const char *typ= NIL;
class cl_optref type_option(this);
type_option.init();
#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;
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);
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);
#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);
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);
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);
#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)
{
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);
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 &&
}
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 &&
}
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 &&
}
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 &&
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? */
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, " ");
//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);
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++) ;
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;
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)
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);
s_value= 0;
}
-cl_arg::cl_arg(char *sv):
+cl_arg::cl_arg(const char *sv):
cl_base()
{
s_value= sv?strdup(sv):0;
/* 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)
{}
/* 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)
{
}
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);
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);
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
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); }
rom= arom;
}
-void *
+const void *
brk_coll::key_of(void *item)
{
return((void *)&(((class cl_brk *)(item))->nr));
int
-brk_coll::compare(void *key1, void *key2)
+brk_coll::compare(const void *key1, const void *key2)
{
int k1, k2;
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);
*____________________________________________________________________________
*/
-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;
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);
uchar Isrc_mask,
uint Iaddr,
bool Iclr_bit,
- char *Iname,
+ const char *Iname,
int apoll_priority):
cl_base()
{
Duplicates= DD_TRUE;
}
-void *
+const void *
cl_irqs::key_of(void *item)
{
class cl_it_src *itsrc= (class cl_it_src *)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);
}
uchar Isrc_mask,
uint Iaddr,
bool Iclr_bit,
- char *Iname,
+ const char *Iname,
int apoll_priority);
virtual ~cl_it_src(void);
{
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);
};
* 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;
* 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)
{
* 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));
by_chip= bychip;
}
-void *
+const void *
cl_decoder_list::key_of(void *item)
{
class cl_address_decoder *d= (class cl_address_decoder *)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)
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);
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); }
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);
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);
};
//con->dd_printf("\n");
}
-char *
+const char *
cl_stack_op::get_op_name(void)
{
return("op");
return(so);
}
-char *
+const char *
cl_stack_call::get_op_name(void)
{
return("call");
con->dd_printf("0x%06"_A_"x", called_addr);
}
-char *
+const char *
cl_stack_call::get_matching_name(void)
{
return("ret");
return(so);
}
-char *
+const char *
cl_stack_intr::get_op_name(void)
{
return("intr");
con->dd_printf("0x%06"_A_"x", called_addr);
}
-char *
+const char *
cl_stack_intr::get_matching_name(void)
{
return("iret");
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");
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");
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");
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");
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);
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);
};
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);
};
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);
};
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);
};
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);
};
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);
};
* 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)
return(0);
}
-char *
+const char *
cl_uc::id_string(void)
{
return("unknown microcontroller");
*/
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);
}
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);
}
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);
}
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);
*/
class cl_address_space *
-cl_uc::address_space(char *id)
+cl_uc::address_space(const char *id)
{
int i;
}
class cl_memory *
-cl_uc::memory(char *id)
+cl_uc::memory(const char *id)
{
int i;
}
char *
-cl_uc::disass(t_addr addr, char *sep)
+cl_uc::disass(t_addr addr, const char *sep)
{
char *buf;
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);
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
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);
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);
struct id_element
{
int id;
- char *id_string;
+ const char *id_string;
};
enum error_type {
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;
};
}
-char *
+const char *
get_id_string(struct id_element *ids, int id)
{
int i= 0;
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;
}
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;
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;
}
-char *
+const char *
object_name(class cl_base *o)
{
- char *name= 0;
+ const char *name= 0;
if (o)
name= o->get_name();
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;
return(s);
}
-/*char *
+/*const char *
case_string(enum letter_case lcase, const char *str)
{
char *p= NIL;
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
return(0);
}
-char *
+const char *
cl_z80::id_string(void)
{
return("unspecified Z80");
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;
}
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;
}
}
-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;
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;
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)
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);
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);