diff --git a/vpi_user.h b/vpi_user.h index 7dbe6da81..3d5811835 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -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 diff --git a/vvp/codes.h b/vvp/codes.h index 1ca329810..e7632d5b2 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -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; }; diff --git a/vvp/event.cc b/vvp/event.cc index c3f28c000..30ffa6f7c 100644 --- a/vvp/event.cc +++ b/vvp/event.cc @@ -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; diff --git a/vvp/event.h b/vvp/event.h index ad812234b..96841d53a 100644 --- a/vvp/event.h +++ b/vvp/event.h @@ -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); diff --git a/vvp/sfunc.cc b/vvp/sfunc.cc index 1c7e85d8e..1a00ab1d3 100644 --- a/vvp/sfunc.cc +++ b/vvp/sfunc.cc @@ -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); diff --git a/vvp/stop.cc b/vvp/stop.cc index b25a432fc..1313d9700 100644 --- a/vvp/stop.cc +++ b/vvp/stop.cc @@ -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; diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index f7071de3b..532fb4424 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -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; } diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 615a5f6e0..51854651e 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -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); /* diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index 07341fe8b..6b45e8307 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -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; diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 31695764d..0e10fe99f 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -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; diff --git a/vvp/vvp_cleanup.h b/vvp/vvp_cleanup.h index c223f46dc..9fcc2f7a5 100644 --- a/vvp/vvp_cleanup.h +++ b/vvp/vvp_cleanup.h @@ -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);