Use result buf for event and scope names.
This commit is contained in:
parent
31bd3e6056
commit
329e943e4e
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: vpi_event.cc,v 1.3 2002/07/05 17:14:15 steve Exp $"
|
#ident "$Id: vpi_event.cc,v 1.4 2002/07/12 18:23:30 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vpi_priv.h"
|
# include "vpi_priv.h"
|
||||||
|
|
@ -36,10 +36,20 @@ static char* named_event_str(int code, vpiHandle ref)
|
||||||
|
|
||||||
struct __vpiNamedEvent*obj = (struct __vpiNamedEvent*)ref;
|
struct __vpiNamedEvent*obj = (struct __vpiNamedEvent*)ref;
|
||||||
|
|
||||||
|
char *bn = vpi_get_str(vpiFullName, &obj->scope->base);
|
||||||
|
const char *nm = obj->name;
|
||||||
|
|
||||||
|
char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 1, RBUF_STR);
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
||||||
|
case vpiFullName:
|
||||||
|
sprintf(rbuf, "%s.%s", bn, nm);
|
||||||
|
return rbuf;
|
||||||
|
|
||||||
case vpiName:
|
case vpiName:
|
||||||
return const_cast<char*>(obj->name);
|
strcpy(rbuf, nm);
|
||||||
|
return rbuf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,6 +124,9 @@ void vpip_run_named_event_callbacks(vpiHandle ref)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vpi_event.cc,v $
|
* $Log: vpi_event.cc,v $
|
||||||
|
* Revision 1.4 2002/07/12 18:23:30 steve
|
||||||
|
* Use result buf for event and scope names.
|
||||||
|
*
|
||||||
* Revision 1.3 2002/07/05 17:14:15 steve
|
* Revision 1.3 2002/07/05 17:14:15 steve
|
||||||
* Names of vpi objects allocated as vpip_strings.
|
* Names of vpi objects allocated as vpip_strings.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: vpi_scope.cc,v 1.16 2002/07/05 17:14:15 steve Exp $"
|
#ident "$Id: vpi_scope.cc,v 1.17 2002/07/12 18:23:30 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "compile.h"
|
# include "compile.h"
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#ifdef HAVE_MALLOC_H
|
#ifdef HAVE_MALLOC_H
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
# include <string.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
|
|
||||||
|
|
@ -45,8 +46,8 @@ vpiHandle vpip_make_root_iterator(void)
|
||||||
static char* scope_get_str(int code, vpiHandle obj)
|
static char* scope_get_str(int code, vpiHandle obj)
|
||||||
{
|
{
|
||||||
struct __vpiScope*ref = (struct __vpiScope*)obj;
|
struct __vpiScope*ref = (struct __vpiScope*)obj;
|
||||||
|
const char *n, *nn, *name = ref->name;
|
||||||
char *n, *nn;
|
char *rbuf = need_result_buf(strlen(name) + 1, RBUF_STR);
|
||||||
|
|
||||||
assert((obj->vpi_type->type_code == vpiModule)
|
assert((obj->vpi_type->type_code == vpiModule)
|
||||||
|| (obj->vpi_type->type_code == vpiFunction)
|
|| (obj->vpi_type->type_code == vpiFunction)
|
||||||
|
|
@ -56,10 +57,11 @@ static char* scope_get_str(int code, vpiHandle obj)
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case vpiFullName:
|
case vpiFullName:
|
||||||
return const_cast<char*>(ref->name);
|
strcpy(rbuf, name);
|
||||||
|
return rbuf;
|
||||||
|
|
||||||
case vpiName:
|
case vpiName:
|
||||||
nn = n = const_cast<char*>(ref->name);
|
nn = n = name;
|
||||||
while (*n)
|
while (*n)
|
||||||
if (*n=='\\' && *++n)
|
if (*n=='\\' && *++n)
|
||||||
++n;
|
++n;
|
||||||
|
|
@ -67,7 +69,8 @@ static char* scope_get_str(int code, vpiHandle obj)
|
||||||
nn = ++n;
|
nn = ++n;
|
||||||
else
|
else
|
||||||
++n;
|
++n;
|
||||||
return nn;
|
strcpy(rbuf, nn);
|
||||||
|
return rbuf;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
@ -389,6 +392,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vpi_scope.cc,v $
|
* $Log: vpi_scope.cc,v $
|
||||||
|
* Revision 1.17 2002/07/12 18:23:30 steve
|
||||||
|
* Use result buf for event and scope names.
|
||||||
|
*
|
||||||
* Revision 1.16 2002/07/05 17:14:15 steve
|
* Revision 1.16 2002/07/05 17:14:15 steve
|
||||||
* Names of vpi objects allocated as vpip_strings.
|
* Names of vpi objects allocated as vpip_strings.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue