V0.9: back port of SunPro compiler support.

This patch combines all the changes needed to back port support for
the SunPro compilers to the stable branch.
This commit is contained in:
Cary R 2010-06-11 18:44:21 -07:00 committed by Stephen Williams
parent 22faa019d1
commit 34c34e33cf
41 changed files with 105 additions and 128 deletions

13
aclocal.m4 vendored
View File

@ -127,6 +127,13 @@ case "${host}" in
*-*-darwin*)
shared="-bundle -undefined suppress -flat_namespace"
;;
*-*-solaris*)
if test ${using_sunpro_c} = 1
then
shared="-G"
fi
;;
esac
AC_SUBST(shared)
AC_MSG_RESULT($shared)
@ -153,6 +160,12 @@ case "${host}" in
PICFLAG=+z
;;
*-*-solaris*)
if test ${using_sunpro_c} = 1
then
PICFLAG=-G
fi
;;
esac
AC_SUBST(PICFLAG)
AC_MSG_RESULT($PICFLAG)

View File

@ -1217,7 +1217,7 @@ static void macro_start_args()
def_argo[0] = 0;
def_argl[0] = 0;
def_argc = 1;
};
}
static void macro_add_to_arg(int is_white_space)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2010 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
@ -56,14 +56,11 @@ PLI_INT32 acc_fetch_type(handle obj)
case vpiModule:
return accModule;
}
default:
vpi_printf("acc_fetch_type: vpiType %d is what accType?\n",
(int)vpi_get(vpiType, obj));
return accUnknown;
}
return 0;
}
PLI_INT32 acc_fetch_fulltype(handle obj)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2010 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
@ -36,11 +36,8 @@ char* acc_fetch_type_str(PLI_INT32 type)
case accConstant:
return "accConstant";
default:
vpi_printf("XXXX acc_fetch_type_str(%d);\n", (int)type);
return "acc_fetch_type_str(unknown)";
}
return "";
vpi_printf("acc_fetch_type_str: type %d is what accType?\n", (int)type);
return "acc_fetch_type_str(unknown)";
}

View File

@ -218,14 +218,14 @@ map<perm_string,NetScope::param_expr_t>::iterator NetScope::find_parameter(perm_
map<perm_string,param_expr_t>::iterator idx;
idx = parameters.find(key);
if (idx != parameters.end())
return idx;
if (idx != parameters.end()) return idx;
idx = localparams.find(perm_string::literal(key));
if (idx != localparams.end())
return idx;
if (idx != localparams.end()) return idx;
return (map<perm_string,param_expr_t>::iterator) 0;
// To get here the parameter must already exist, so we should
// never get here.
assert(0);
}
NetScope::TYPE NetScope::type() const

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for processes.
*
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -83,7 +83,7 @@ static int generate_vhdl_process(vhdl_entity *ent, ivl_process_t proc)
return 0;
}
int draw_process(ivl_process_t proc, void *cd)
extern "C" int draw_process(ivl_process_t proc, void *cd)
{
ivl_scope_t scope = ivl_process_scope(proc);

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for scopes.
*
* Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -921,7 +921,7 @@ static void create_skeleton_entity_for(ivl_scope_t scope, int depth)
* A first pass through the hierarchy: create VHDL entities for
* each unique Verilog module type.
*/
static int draw_skeleton_scope(ivl_scope_t scope, void *_unused)
extern "C" int draw_skeleton_scope(ivl_scope_t scope, void *_unused)
{
static int depth = 0;
@ -949,7 +949,7 @@ static int draw_skeleton_scope(ivl_scope_t scope, void *_unused)
return rc;
}
static int draw_all_signals(ivl_scope_t scope, void *_parent)
extern "C" int draw_all_signals(ivl_scope_t scope, void *_parent)
{
if (!is_default_scope_instance(scope))
return 0; // Not interested in this instance
@ -981,7 +981,7 @@ static int draw_all_signals(ivl_scope_t scope, void *_parent)
/*
* Draw all tasks and functions in the hierarchy.
*/
static int draw_functions(ivl_scope_t scope, void *_parent)
extern "C" int draw_functions(ivl_scope_t scope, void *_parent)
{
if (!is_default_scope_instance(scope))
return 0; // Not interested in this instance
@ -1005,7 +1005,7 @@ static int draw_functions(ivl_scope_t scope, void *_parent)
* This also has the side effect of generating all the necessary
* nexus code.
*/
static int draw_constant_drivers(ivl_scope_t scope, void *_parent)
extern "C" int draw_constant_drivers(ivl_scope_t scope, void *_parent)
{
if (!is_default_scope_instance(scope))
return 0; // Not interested in this instance
@ -1080,7 +1080,7 @@ static int draw_constant_drivers(ivl_scope_t scope, void *_parent)
return 0;
}
static int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent)
extern "C" int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent)
{
if (!is_default_scope_instance(scope))
return 0; // Not interested in this instance
@ -1100,7 +1100,7 @@ static int draw_all_logic_and_lpm(ivl_scope_t scope, void *_parent)
return ivl_scope_children(scope, draw_all_logic_and_lpm, scope);
}
static int draw_hierarchy(ivl_scope_t scope, void *_parent)
extern "C" int draw_hierarchy(ivl_scope_t scope, void *_parent)
{
if (ivl_scope_type(scope) == IVL_SCT_MODULE && _parent) {
ivl_scope_t parent = static_cast<ivl_scope_t>(_parent);

View File

@ -1,7 +1,7 @@
/*
* Support functions for VHDL output.
*
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ enum support_function_t {
SF_TERNARY_SIGNED,
SF_LOGIC_TO_INTEGER,
SF_SIGNED_TO_LOGIC,
SF_UNSIGNED_TO_LOGIC,
SF_UNSIGNED_TO_LOGIC
};
class support_function : public vhdl_function {

View File

@ -1,7 +1,7 @@
/*
* VHDL abstract syntax elements.
*
* Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,7 +96,7 @@ enum vhdl_binop_t {
VHDL_BINOP_DIV,
VHDL_BINOP_MOD,
VHDL_BINOP_POWER,
VHDL_BINOP_SRA,
VHDL_BINOP_SRA
};
/*
@ -123,7 +123,7 @@ private:
enum vhdl_unaryop_t {
VHDL_UNARYOP_NOT,
VHDL_UNARYOP_NEG,
VHDL_UNARYOP_NEG
};
class vhdl_unaryop_expr : public vhdl_expr {
@ -206,7 +206,7 @@ enum time_unit_t {
TIME_UNIT_PS,
TIME_UNIT_NS,
TIME_UNIT_US,
TIME_UNIT_MS,
TIME_UNIT_MS
};
class vhdl_const_time : public vhdl_expr {
@ -397,7 +397,7 @@ enum vhdl_wait_type_t {
VHDL_WAIT_FOR, // Wait for a constant amount of time
VHDL_WAIT_FOR0, // Special wait for zero time
VHDL_WAIT_UNTIL, // Wait on an expression
VHDL_WAIT_ON, // Wait on a sensitivity list
VHDL_WAIT_ON // Wait on a sensitivity list
};
/*
@ -657,7 +657,7 @@ enum vhdl_port_mode_t {
VHDL_PORT_IN,
VHDL_PORT_OUT,
VHDL_PORT_INOUT,
VHDL_PORT_BUFFER,
VHDL_PORT_BUFFER
};
/*

View File

@ -15,7 +15,7 @@ void error(const char *fmt, ...);
void debug_msg(const char *fmt, ...);
int draw_scope(ivl_scope_t scope, void *_parent);
int draw_process(ivl_process_t net, void *cd);
extern "C" int draw_process(ivl_process_t net, void *cd);
int draw_stmt(vhdl_procedural *proc, stmt_container *container,
ivl_statement_t stmt, bool is_last = false);
int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm);

View File

@ -1,7 +1,7 @@
/*
* VHDL variable and signal types.
*
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,7 +34,7 @@ enum vhdl_type_name_t {
VHDL_TYPE_SIGNED,
VHDL_TYPE_UNSIGNED,
VHDL_TYPE_TIME,
VHDL_TYPE_ARRAY,
VHDL_TYPE_ARRAY
};
/*

View File

@ -583,19 +583,11 @@ static int show_stmt_assign(ivl_statement_t net)
lval = ivl_stmt_lval(net, 0);
sig = ivl_lval_sig(lval);
if (sig) switch (ivl_signal_data_type(sig)) {
case IVL_VT_REAL:
if (sig && (ivl_signal_data_type(sig) == IVL_VT_REAL)) {
return show_stmt_assign_sig_real(net);
default:
return show_stmt_assign_vector(net);
} else {
return show_stmt_assign_vector(net);
}
return 0;
return show_stmt_assign_vector(net);
}
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2010 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
@ -514,14 +514,13 @@ string verinum::as_string() const
if (char_val == '"' || char_val == '\\') {
char tmp[5];
snprintf(tmp, sizeof tmp, "\\\%03o", char_val);
snprintf(tmp, sizeof tmp, "\\%03o", char_val);
res = res + tmp;
} else if (char_val == ' ' || isgraph(char_val)) {
res = res + char_val;
} else {
char tmp[5];
snprintf(tmp, sizeof tmp, "\\\%03o", char_val);
snprintf(tmp, sizeof tmp, "\\%03o", char_val);
res = res + tmp;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
#include <assert.h>
#include <math.h>
#include <string.h>
#include <vpi_user.h>
#include "vpi_user.h"
/*
* This routine returns 1 if the argument supports has a numeric value,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2009 Michael Ruff (mruff at chiaro.com)
* Copyright (c) 2003-2010 Michael Ruff (mruff at chiaro.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
@ -17,8 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include "sys_priv.h"
# include <stdio.h>
# include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000 Stephan Boettcher <stephan@nevis.columbia.edu>
*
* This source code is free software; you can redistribute it
@ -18,8 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include "sys_priv.h"
# include <assert.h>
# include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 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
@ -17,9 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include "sys_priv.h"
# include <assert.h>
# include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2010 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
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_user.h"
# include "sys_priv.h"
# include <assert.h>
# include <ctype.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 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
@ -17,8 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "vpi_config.h"
#include "vpi_user.h"
#include "sys_priv.h"
#include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,9 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <assert.h>
#include <vpi_user.h>
#include "sys_priv.h"
#include <assert.h>
static PLI_INT32 finish_and_return_calltf(PLI_BYTE8* name)
{

View File

@ -17,17 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* The vpi_config.h include must be before the lxt_write.h include! */
# include "vpi_config.h"
# include "lxt_write.h"
/* The sys_priv.h include must be before the lxt_write.h include! */
# include "sys_priv.h"
# include "lxt_write.h"
# include "vcd_priv.h"
/*
* This file contains the implementations of the LXT related functions.
*/
# include "vpi_user.h"
# include <stdio.h>
# include <stdlib.h>
# include <string.h>

View File

@ -17,17 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* The vpi_config.h include must be before the lxt2_write.h include! */
# include "vpi_config.h"
# include "lxt2_write.h"
/* The sys_priv.h include must be before the lxt2_write.h include! */
# include "sys_priv.h"
# include "lxt2_write.h"
# include "vcd_priv.h"
/*
* This file contains the implementations of the LXT2 related functions.
*/
# include "vpi_user.h"
# include <stdio.h>
# include <stdlib.h>
# include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2010 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
@ -18,7 +18,6 @@
*/
# include "sys_priv.h"
# include <vpi_user.h>
# include <string.h>
# include <stdlib.h>
# include <assert.h>

View File

@ -17,11 +17,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "sys_priv.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "sys_priv.h"
PLI_UINT64 timerec_to_time64(const struct t_vpi_time*time)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2010 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
@ -20,7 +20,6 @@
# include "sys_priv.h"
# include "sys_random.h"
# include <vpi_user.h>
# include <assert.h>
# include <stdlib.h>
# include <math.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2010 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
@ -20,7 +20,6 @@
# include "sys_priv.h"
# include "sys_random.h"
# include <vpi_user.h>
# include <assert.h>
# include <stdlib.h>
# include <math.h>

View File

@ -17,9 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include "sys_priv.h"
# include <ctype.h>
# include <string.h>

View File

@ -21,7 +21,6 @@
# define _ISOC99_SOURCE 1
# define _SVID_SOURCE 1
# include "vpi_user.h"
# include "sys_priv.h"
# include <ctype.h>
# include <errno.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2010 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
@ -17,11 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include "sdf_priv.h"
# include "sys_priv.h"
# include "sdf_priv.h"
# include <stdlib.h>
# include <string.h>
# include <assert.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2010 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
@ -17,13 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "vpi_config.h"
#include "vpi_user.h"
#include "sys_priv.h"
#include <string.h>
#include <math.h>
#include <assert.h>
#include <sys_priv.h>
static PLI_INT32 sys_time_calltf(PLI_BYTE8*name)
{

View File

@ -24,7 +24,6 @@
* This file contains the implementations of the VCD related functions.
*/
# include "vpi_user.h"
# include <stdio.h>
# include <stdlib.h>
# include <string.h>

View File

@ -23,7 +23,6 @@
* This file contains do nothing stubs of all the VCD routines.
*/
# include "vpi_user.h"
# include <stdio.h>
# include <stdlib.h>
# include <string.h>

View File

@ -2,7 +2,7 @@
* Verilog-2005 math library for Icarus Verilog
* http://www.icarus.com/eda/verilog/
*
* Copyright (C) 2007-2009 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vpi_user.h>
#include "vpi_user.h"
/* Single argument functions. */
typedef struct s_single_data {

View File

@ -2,7 +2,7 @@
* Verilog-A math library for Icarus Verilog
* http://www.icarus.com/eda/verilog/
*
* Copyright (C) 2007-2009 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vpi_user.h>
#include "vpi_user.h"
/*
* Compile time options: (set in the Makefile.)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2009 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2008-2010 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,13 +16,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "sys_priv.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vpi_user.h>
#include "sys_priv.h"
#include "version_base.h"
/* Once we have real string objects replace this with a dynamic string. */

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include "vpi_config.h"
#include "sys_priv.h"
#include "vcd_priv.h"
#include <stdio.h>
#include <stdlib.h>
@ -25,7 +25,6 @@
#include <assert.h>
#include <ctype.h>
#include "stringheap.h"
#include <sys_priv.h>
int is_escaped_id(const char *name)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 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
@ -64,7 +64,7 @@ enum operand_e {
/* The operand is a second functor pointer */
OA_FUNC_PTR2,
/* The operand is a VPI handle */
OA_VPI_PTR,
OA_VPI_PTR
};
struct opcode_table_s {

View File

@ -369,7 +369,7 @@ bool schedule_stopped(void)
* These are the signal handling infrastructure. The SIGINT signal
* leads to an implicit $stop.
*/
static void signals_handler(int)
extern "C" void signals_handler(int)
{
schedule_stopped_flag = true;
}

View File

@ -19,7 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
// The SunPro C++ compiler is broken and does not define size_t in cstddef.
#ifdef __SUNPRO_CC
# include <stddef.h>
#else
# include <cstddef>
#endif
extern unsigned long count_opcodes;
extern unsigned long count_functors;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 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
@ -70,18 +70,19 @@ char*symbol_table_s::key_strdup_(const char*str)
const unsigned leaf_width = 254;
const unsigned node_width = 508;
struct tree_data_ {
char*key;
symbol_value_t val;
};
struct tree_node_ {
bool leaf_flag;
unsigned count;
struct tree_node_*parent;
union {
struct {
char*key;
symbol_value_t val;
} leaf[leaf_width];
struct tree_node_*child[node_width];
struct tree_data_ leaf[leaf_width];
struct tree_node_ *child[node_width];
};
};

View File

@ -1105,14 +1105,19 @@ static char* PV_get_str(int code, vpiHandle ref)
case vpiName:
case vpiFullName: {
const char*nm = vpi_get_str(code, rfp->parent);
char full[1024+strlen(nm)];
sprintf(full, "%s[%d:%d]", nm, (int)vpi_get(vpiLeftRange, ref),
size_t len = 256+strlen(nm);
char *full = (char *) malloc(len);
snprintf(full, len, "%s[%d:%d]", nm,
(int)vpi_get(vpiLeftRange, ref),
(int)vpi_get(vpiRightRange, ref));
return simple_set_rbuf_str(full);
full[len-1] = 0;
char *res = simple_set_rbuf_str(full);
free(full);
return res;
}
default:
fprintf(stderr, "PV_get_str: property %d is unknown\n", code);
fprintf(stderr, "PV_get_str: property %d is unknown.\n", code);
}
return 0;