V0.9: Back port the down payment on const-correctness patch from Larry
This patch is a back port of the applicable changes made in the patch originally submitted by Larry for development on (9/27/2010).
This commit is contained in:
parent
dfedd3dda1
commit
d3f7e4f1e6
|
|
@ -1,6 +1,6 @@
|
|||
%{
|
||||
/*
|
||||
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -44,7 +44,7 @@ static void macro_start_args();
|
|||
static void macro_add_to_arg();
|
||||
static void macro_finish_arg();
|
||||
static void do_expand(int use_args);
|
||||
static char* macro_name();
|
||||
static const char* macro_name();
|
||||
|
||||
static void include_filename();
|
||||
static void do_include();
|
||||
|
|
@ -1201,7 +1201,7 @@ static int macro_needs_args(const char*text)
|
|||
}
|
||||
}
|
||||
|
||||
static char* macro_name()
|
||||
static const char* macro_name()
|
||||
{
|
||||
return cur_macro ? cur_macro->name : "";
|
||||
}
|
||||
|
|
|
|||
11
ivlpp/main.c
11
ivlpp/main.c
|
|
@ -1,5 +1,5 @@
|
|||
const char COPYRIGHT[] =
|
||||
"Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)";
|
||||
"Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)";
|
||||
/*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -124,12 +124,13 @@ static int flist_read_flags(const char*path)
|
|||
|
||||
if (strcmp(cp,"D") == 0) {
|
||||
char*val = strchr(arg, '=');
|
||||
if (val)
|
||||
const char *valo = "1";
|
||||
if (val) {
|
||||
*val++ = 0;
|
||||
else
|
||||
val = "1";
|
||||
valo = val;
|
||||
}
|
||||
|
||||
define_macro(arg, val, 0, 0);
|
||||
define_macro(arg, valo, 0, 0);
|
||||
|
||||
} else if (strcmp(cp,"I") == 0) {
|
||||
include_dir = realloc(include_dir,
|
||||
|
|
|
|||
12
main.cc
12
main.cc
|
|
@ -1,5 +1,5 @@
|
|||
const char COPYRIGHT[] =
|
||||
"Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)";
|
||||
"Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com)";
|
||||
|
||||
/*
|
||||
* This source code is free software; you can redistribute it
|
||||
|
|
@ -524,7 +524,7 @@ static void read_iconfig_file(const char*ipath)
|
|||
}
|
||||
|
||||
if (strcmp(buf, "basedir") == 0) {
|
||||
free((char *)basedir);
|
||||
free((void *)basedir);
|
||||
basedir = strdup(cp);
|
||||
|
||||
} else if (strcmp(buf, "debug") == 0) {
|
||||
|
|
@ -598,7 +598,7 @@ static void read_iconfig_file(const char*ipath)
|
|||
flags["VPI_MODULE_LIST"] = vpi_module_list;
|
||||
|
||||
} else if (strcmp(buf, "out") == 0) {
|
||||
free((char *)flags["-o"]);
|
||||
free((void *)flags["-o"]);
|
||||
flags["-o"] = strdup(cp);
|
||||
|
||||
} else if (strcmp(buf, "sys_func") == 0) {
|
||||
|
|
@ -709,17 +709,17 @@ static void EOC_cleanup(void)
|
|||
|
||||
for (list<const char*>::iterator suf = library_suff.begin() ;
|
||||
suf != library_suff.end() ; suf ++ ) {
|
||||
free((char *)*suf);
|
||||
free((void *)*suf);
|
||||
}
|
||||
library_suff.clear();
|
||||
|
||||
free((char *) basedir);
|
||||
free((void *) basedir);
|
||||
free(ivlpp_string);
|
||||
free(depfile_name);
|
||||
|
||||
for (map<string, const char*>::iterator flg = flags.begin() ;
|
||||
flg != flags.end() ; flg ++ ) {
|
||||
free((char *)flg->second);
|
||||
free((void *)flg->second);
|
||||
}
|
||||
flags.clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
static const char*version_string =
|
||||
"Icarus Verilog STUB Code Generator " VERSION " (" VERSION_TAG ")\n\n"
|
||||
"Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)\n\n"
|
||||
"Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)\n\n"
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms of the GNU General Public License as published by\n"
|
||||
" the Free Software Foundation; either version 2 of the License, or\n"
|
||||
|
|
@ -1525,7 +1525,7 @@ static void show_logic(ivl_net_logic_t net)
|
|||
static int show_scope(ivl_scope_t net, void*x)
|
||||
{
|
||||
unsigned idx;
|
||||
char *is_auto;
|
||||
const char *is_auto;
|
||||
|
||||
fprintf(out, "scope: %s (%u parameters, %u signals, %u logic)",
|
||||
ivl_scope_name(net), ivl_scope_params(net),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -219,7 +219,7 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix)
|
|||
unsigned word = 0;
|
||||
if (ivl_signal_dimensions(sig) > 0) {
|
||||
ivl_expr_t ixe;
|
||||
char*type = ivl_expr_signed(expr) ? "/s" : "";
|
||||
const char*type = ivl_expr_signed(expr) ? "/s" : "";
|
||||
|
||||
/* Detect the special case that this is a
|
||||
variable array. In this case, the ix/getv
|
||||
|
|
@ -246,7 +246,7 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix)
|
|||
break;
|
||||
}
|
||||
}
|
||||
char*type = ivl_signal_signed(sig) ? "/s" : "";
|
||||
const char*type = ivl_signal_signed(sig) ? "/s" : "";
|
||||
fprintf(vvp_out, " %%ix/getv%s %u, v%p_%u;\n", type, ix,
|
||||
sig, word);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -723,7 +723,7 @@ static int show_stmt_assign_nb(ivl_statement_t net)
|
|||
|
||||
if (cnt) {
|
||||
int count_index = allocate_word();
|
||||
char*type = ivl_expr_signed(cnt) ? "/s" : "";
|
||||
const char*type = ivl_expr_signed(cnt) ? "/s" : "";
|
||||
draw_eval_expr_into_integer(cnt, count_index);
|
||||
fprintf(vvp_out, " %%evctl%s %s, %d;\n", type, name,
|
||||
count_index);
|
||||
|
|
@ -1634,7 +1634,7 @@ static int show_stmt_repeat(ivl_statement_t net, ivl_scope_t sscope)
|
|||
unsigned lab_top = local_count++, lab_out = local_count++;
|
||||
ivl_expr_t expr = ivl_stmt_cond_expr(net);
|
||||
struct vector_info cnt = draw_eval_expr(expr, 0);
|
||||
char *sign = ivl_expr_signed(expr) ? "s" : "u";
|
||||
const char *sign = ivl_expr_signed(expr) ? "s" : "u";
|
||||
|
||||
/* Test that 0 < expr */
|
||||
fprintf(vvp_out, "T_%u.%u %%cmp/%s 0, %u, %u;\n", thread_count,
|
||||
|
|
|
|||
|
|
@ -996,8 +996,8 @@ if(rgh) lt_recurse_dictionary_free(lt, rgh);
|
|||
|
||||
static int lt_dictval_compare(const void *v1, const void *v2)
|
||||
{
|
||||
dslxt_Tree *s1 = *(dslxt_Tree **)v1;
|
||||
dslxt_Tree *s2 = *(dslxt_Tree **)v2;
|
||||
const dslxt_Tree *s1 = *(const dslxt_Tree * const *)v1;
|
||||
const dslxt_Tree *s2 = *(const dslxt_Tree * const *)v2;
|
||||
|
||||
if(s1->val > s2->val) return(1); else return(-1); /* they're *never* equal */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -879,6 +879,7 @@ static unsigned int get_numeric(char **rtn, struct strobe_cb_info *info,
|
|||
static char *get_display(unsigned int *rtnsz, struct strobe_cb_info *info)
|
||||
{
|
||||
char *result, *fmt, *rtn, *func_name;
|
||||
const char *cresult;
|
||||
s_vpi_value value;
|
||||
unsigned int idx, size, width;
|
||||
char buf[256];
|
||||
|
|
@ -999,10 +1000,10 @@ static char *get_display(unsigned int *rtnsz, struct strobe_cb_info *info)
|
|||
vpi_printf("WARNING: %s:%d: unknown argument type (%s) given to %s!\n",
|
||||
info->filename, info->lineno, vpi_get_str(vpiType, item),
|
||||
info->name);
|
||||
result = "<?>";
|
||||
width = strlen(result);
|
||||
cresult = "<?>";
|
||||
width = strlen(cresult);
|
||||
rtn = realloc(rtn, (size+width)*sizeof(char));
|
||||
memcpy(rtn+size-1, result, width);
|
||||
memcpy(rtn+size-1, cresult, width);
|
||||
break;
|
||||
}
|
||||
size += width;
|
||||
|
|
@ -1756,9 +1757,9 @@ static PLI_INT32 sys_timeformat_calltf(PLI_BYTE8*xx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char *pts_convert(int value)
|
||||
static const char *pts_convert(int value)
|
||||
{
|
||||
char *string;
|
||||
const char *string;
|
||||
switch (value) {
|
||||
case 0: string = "1s"; break;
|
||||
case -1: string = "100ms"; break;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2003-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -102,7 +102,7 @@ char *get_filename(vpiHandle callh, char *name, vpiHandle file)
|
|||
}
|
||||
|
||||
void check_for_extra_args(vpiHandle argv, vpiHandle callh, char *name,
|
||||
char *arg_str, unsigned opt)
|
||||
const char *arg_str, unsigned opt)
|
||||
{
|
||||
/* Check that there are no extra arguments. */
|
||||
if (vpi_scan(argv) != 0) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __vpi_sys_priv_H
|
||||
#define __vpi_sys_priv_H
|
||||
/*
|
||||
* Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2002-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -38,8 +38,8 @@ extern PLI_UINT64 timerec_to_time64(const struct t_vpi_time*timerec);
|
|||
extern char *as_escaped(char *arg);
|
||||
extern char *get_filename(vpiHandle callh, char *name, vpiHandle file);
|
||||
|
||||
extern void check_for_extra_args(vpiHandle argv, vpiHandle callh,
|
||||
char *name, char *arg_str, unsigned opt);
|
||||
extern void check_for_extra_args(vpiHandle argv, vpiHandle callh, char *name,
|
||||
const char *arg_str, unsigned opt);
|
||||
|
||||
struct timeformat_info_s {
|
||||
int units;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void sys_lxt_or_vcd_register()
|
|||
int idx;
|
||||
struct t_vpi_vlog_info vlog_info;
|
||||
|
||||
char*dumper;
|
||||
const char*dumper;
|
||||
|
||||
/* Get the dumper of choice from the IVERILOG_DUMPER
|
||||
environment variable. */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -710,7 +710,7 @@ static int draw_scope(vpiHandle item, vpiHandle callh)
|
|||
{
|
||||
int depth;
|
||||
const char *name;
|
||||
char *type;
|
||||
const char *type;
|
||||
|
||||
vpiHandle scope = vpi_handle(vpiScope, item);
|
||||
if (!scope) return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue