Update __vpiHandle to use class vs struct

The clang compiler does not like mixing class and struct references. This
patch updates all the struct __vpiHandle, etc. to use class since that is
how they are now defined.
This commit is contained in:
Cary R 2012-01-21 14:47:42 -08:00
parent 2bba7ebbda
commit bb58ace6d6
11 changed files with 51 additions and 47 deletions

View File

@ -1,7 +1,7 @@
#ifndef __vpi_user_H
#define __vpi_user_H
/*
* Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2012 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
@ -46,7 +46,11 @@ EXTERN_C_START
# include "_pli_types.h"
#define ICARUS_VPI_CONST
#ifdef __cplusplus
typedef class __vpiHandle *vpiHandle;
#else
typedef struct __vpiHandle *vpiHandle;
#endif
/*
* This structure is created by the VPI application to provide hooks

View File

@ -1,7 +1,7 @@
#ifndef __codes_H
#define __codes_H
/*
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2012 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
@ -186,7 +186,7 @@ struct vvp_code_s {
vvp_net_t *net;
vvp_code_t cptr;
vvp_array_t array;
struct __vpiHandle*handle;
class __vpiHandle*handle;
struct __vpiScope*scope;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2012 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
@ -71,7 +71,7 @@ bool evctl::dec_and_run()
return ecount_ == 0;
}
evctl_real::evctl_real(struct __vpiHandle*handle, double value,
evctl_real::evctl_real(class __vpiHandle*handle, double value,
unsigned long ecount)
:evctl(ecount)
{
@ -88,7 +88,7 @@ void evctl_real::run_run()
vpi_put_value(handle_, &val, 0, vpiNoDelay);
}
void schedule_evctl(struct __vpiHandle*handle, double value,
void schedule_evctl(class __vpiHandle*handle, double value,
vvp_net_t*event, unsigned long ecount)
{
// Get the functor we are going to wait on.
@ -655,7 +655,7 @@ void vvp_fun_event_or_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
}
}
vvp_named_event::vvp_named_event(struct __vpiHandle*h)
vvp_named_event::vvp_named_event(class __vpiHandle*h)
{
handle_ = h;
}
@ -664,7 +664,7 @@ vvp_named_event::~vvp_named_event()
{
}
vvp_named_event_sa::vvp_named_event_sa(struct __vpiHandle*h)
vvp_named_event_sa::vvp_named_event_sa(class __vpiHandle*h)
: vvp_named_event(h), threads_(0)
{
}
@ -691,7 +691,7 @@ void vvp_named_event_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
vpip_run_named_event_callbacks(handle_);
}
vvp_named_event_aa::vvp_named_event_aa(struct __vpiHandle*h)
vvp_named_event_aa::vvp_named_event_aa(class __vpiHandle*h)
: vvp_named_event(h)
{
context_idx_ = vpip_add_item_to_context(this, vpip_peek_context_scope());
@ -851,7 +851,7 @@ void compile_named_event(char*label, char*name)
}
#ifdef CHECK_WITH_VALGRIND
void named_event_delete(struct __vpiHandle*handle)
void named_event_delete(class __vpiHandle*handle)
{
struct __vpiNamedEvent *obj = (struct __vpiNamedEvent *) handle;

View File

@ -1,7 +1,7 @@
#ifndef __event_H
#define __event_H
/*
* Copyright (c) 2004-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2012 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
@ -40,13 +40,13 @@ class evctl {
class evctl_real : public evctl {
public:
explicit evctl_real(struct __vpiHandle*handle, double value,
explicit evctl_real(class __vpiHandle*handle, double value,
unsigned long ecount);
virtual ~evctl_real() {}
void run_run();
private:
__vpiHandle*handle_;
class __vpiHandle*handle_;
double value_;
};
@ -95,7 +95,7 @@ class evctl_array_r : public evctl {
double value_;
};
extern void schedule_evctl(struct __vpiHandle*handle, double value,
extern void schedule_evctl(class __vpiHandle*handle, double value,
vvp_net_t*event, unsigned long ecount);
extern void schedule_evctl(vvp_net_ptr_t ptr, const vvp_vector4_t&value,
@ -357,11 +357,11 @@ class vvp_fun_event_or_aa : public vvp_fun_event_or, public automatic_hooks_s {
class vvp_named_event : public vvp_net_fun_t, public waitable_hooks_s {
public:
explicit vvp_named_event(struct __vpiHandle*eh);
explicit vvp_named_event(class __vpiHandle*eh);
~vvp_named_event();
protected:
struct __vpiHandle*handle_;
class __vpiHandle*handle_;
};
/*
@ -370,7 +370,7 @@ class vvp_named_event : public vvp_net_fun_t, public waitable_hooks_s {
class vvp_named_event_sa : public vvp_named_event {
public:
explicit vvp_named_event_sa(struct __vpiHandle*eh);
explicit vvp_named_event_sa(class __vpiHandle*eh);
~vvp_named_event_sa();
vthread_t add_waiting_thread(vthread_t thread);
@ -388,7 +388,7 @@ class vvp_named_event_sa : public vvp_named_event {
class vvp_named_event_aa : public vvp_named_event, public automatic_hooks_s {
public:
explicit vvp_named_event_aa(struct __vpiHandle*eh);
explicit vvp_named_event_aa(class __vpiHandle*eh);
~vvp_named_event_aa();
void alloc_instance(vvp_context_t context);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2006-2012 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
@ -74,7 +74,7 @@ void sfunc_core::recv_vec4_from_inputs(unsigned port)
void sfunc_core::recv_real_from_inputs(unsigned port)
{
vpiHandle vpi = argv_[port];
struct __vpiRealConst*obj = dynamic_cast<__vpiRealConst*>(vpi);
class __vpiRealConst*obj = dynamic_cast<__vpiRealConst*>(vpi);
assert(obj);
obj->value = value_r(port);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2012 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
@ -74,7 +74,7 @@ static bool interact_flag = true;
static void cmd_call(unsigned argc, char*argv[])
{
struct __vpiHandle**table;
class __vpiHandle**table;
unsigned ntable;
if (stop_current_scope == 0) {
@ -212,7 +212,7 @@ static void cmd_help(unsigned, char*[]);
static void cmd_list(unsigned, char*[])
{
struct __vpiHandle**table;
class __vpiHandle**table;
unsigned ntable;
if (stop_current_scope == 0) {
@ -314,7 +314,7 @@ static void cmd_push(unsigned argc, char* argv[])
{
for (unsigned idx = 1 ; idx < argc ; idx += 1) {
struct __vpiHandle**table;
class __vpiHandle**table;
unsigned ntable;
struct __vpiScope*child = 0;

View File

@ -240,7 +240,7 @@ __vpiHandle::free_object_fun_t __vpiStringConstTEMP::free_object_fun(void)
vpiHandle vpip_make_string_const(char*text, bool persistent_flag)
{
struct __vpiStringConst*obj;
class __vpiStringConst*obj;
obj = persistent_flag? new __vpiStringConst(text) : new __vpiStringConstTEMP(text);
@ -314,7 +314,7 @@ vpiHandle __vpiStringParam::vpi_handle(int code)
vpiHandle vpip_make_string_param(char*name, char*text,
long file_idx, long lineno)
{
struct __vpiStringParam*obj = new __vpiStringParam(text, name);
class __vpiStringParam*obj = new __vpiStringParam(text, name);
obj->scope = vpip_peek_current_scope();
obj->file_idx = (unsigned) file_idx;
obj->lineno = (unsigned) lineno;
@ -649,7 +649,7 @@ void __vpiRealConst::vpi_get_value(p_vpi_value val)
vpiHandle vpip_make_real_const(double value)
{
struct __vpiRealConst*obj = new __vpiRealConst(value);
class __vpiRealConst*obj = new __vpiRealConst(value);
return obj;
}

View File

@ -224,7 +224,7 @@ struct __vpiScope : public __vpiHandle {
struct __vpiScopedSTime scoped_stime;
struct __vpiScopedRealtime scoped_realtime;
/* Keep an array of internal scope items. */
struct __vpiHandle**intern;
class __vpiHandle**intern;
unsigned nintern;
/* Keep an array of items to be automatically allocated */
struct automatic_hooks_s**item;
@ -249,7 +249,7 @@ extern struct __vpiScope* vpip_peek_context_scope(void);
extern unsigned vpip_add_item_to_context(automatic_hooks_s*item,
struct __vpiScope*scope);
extern vpiHandle vpip_make_root_iterator(void);
extern void vpip_make_root_iterator(struct __vpiHandle**&table,
extern void vpip_make_root_iterator(class __vpiHandle**&table,
unsigned&ntable);
/*

View File

@ -41,7 +41,7 @@ vpiHandle vpip_make_root_iterator(void)
vpip_root_table_ptr, false);
}
void vpip_make_root_iterator(struct __vpiHandle**&table, unsigned&ntable)
void vpip_make_root_iterator(class __vpiHandle**&table, unsigned&ntable)
{
table = vpip_root_table_ptr;
ntable = vpip_root_table_cnt;

View File

@ -1173,7 +1173,7 @@ bool of_ASSIGN_WR(vthread_t thr, vvp_code_t cp)
del.type = vpiSimTime;
vpip_time_to_timestruct(&del, delay);
struct __vpiHandle*tmp = cp->handle;
class __vpiHandle*tmp = cp->handle;
t_vpi_value val;
val.format = vpiRealVal;
@ -1192,7 +1192,7 @@ bool of_ASSIGN_WRD(vthread_t thr, vvp_code_t cp)
del.type = vpiSimTime;
vpip_time_to_timestruct(&del, delay);
struct __vpiHandle*tmp = cp->handle;
class __vpiHandle*tmp = cp->handle;
t_vpi_value val;
val.format = vpiRealVal;
@ -1206,7 +1206,7 @@ bool of_ASSIGN_WRE(vthread_t thr, vvp_code_t cp)
{
assert(thr->event != 0);
unsigned index = cp->bit_idx[0];
struct __vpiHandle*tmp = cp->handle;
class __vpiHandle*tmp = cp->handle;
// If the count is zero then just put the value.
if (thr->ecount == 0) {
@ -3184,7 +3184,7 @@ bool of_LOAD_VP0_S(vthread_t thr, vvp_code_t cp)
bool of_LOAD_WR(vthread_t thr, vvp_code_t cp)
{
struct __vpiHandle*tmp = cp->handle;
class __vpiHandle*tmp = cp->handle;
t_vpi_value val;
val.format = vpiRealVal;

View File

@ -1,7 +1,7 @@
#ifndef __vvp_cleanup_H
#define __vvp_cleanup_H
/*
* Copyright (c) 2009-2011 Cary R. (cygcary@yahoo.com)
* Copyright (c) 2009-2012 Cary R. (cygcary@yahoo.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
@ -39,19 +39,19 @@ extern void vpi_handle_delete(void);
extern void vvp_net_pool_delete(void);
extern void ufunc_pool_delete(void);
extern void A_delete(struct __vpiHandle *item);
extern void PV_delete(struct __vpiHandle *item);
extern void constant_delete(struct __vpiHandle *item);
extern void A_delete(class __vpiHandle *item);
extern void PV_delete(class __vpiHandle *item);
extern void constant_delete(class __vpiHandle *item);
extern void contexts_delete(struct __vpiScope *scope);
extern void enum_delete(struct __vpiHandle *item);
extern void memory_delete(struct __vpiHandle *item);
extern void named_event_delete(struct __vpiHandle *item);
extern void parameter_delete(struct __vpiHandle *item);
extern void signal_delete(struct __vpiHandle *item);
extern void real_delete(struct __vpiHandle *item);
extern void thread_vthr_delete(struct __vpiHandle *item);
extern void thread_word_delete(struct __vpiHandle *item);
extern void vpi_call_delete(struct __vpiHandle *item);
extern void enum_delete(class __vpiHandle *item);
extern void memory_delete(class __vpiHandle *item);
extern void named_event_delete(class __vpiHandle *item);
extern void parameter_delete(class __vpiHandle *item);
extern void signal_delete(class __vpiHandle *item);
extern void real_delete(class __vpiHandle *item);
extern void thread_vthr_delete(class __vpiHandle *item);
extern void thread_word_delete(class __vpiHandle *item);
extern void vpi_call_delete(class __vpiHandle *item);
extern void exec_ufunc_delete(vvp_code_t euf_code);
extern void vthreads_delete(struct __vpiScope*scope);
extern void vvp_net_delete(vvp_net_t *item);