Apply a slightly modified user patch.

This commit is contained in:
Cary R 2011-12-05 19:52:49 -08:00
parent 46af6667dd
commit 95e25ad40f
3 changed files with 21 additions and 15 deletions

View File

@ -1016,7 +1016,11 @@ vpiHandle vpi_put_value(vpiHandle obj, s_vpi_value*vp,
vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref)
{
if (type == vpiSysTfCall) {
assert(ref == 0);
if (ref != 0) {
fprintf(stderr, "VPI error: vpi_handle(vpiSysTfCall, "
"ref!=0).\n");
return 0;
}
if (vpi_trace) {
fprintf(vpi_trace, "vpi_handle(vpiSysTfCall, 0) "
@ -1028,10 +1032,10 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref)
}
if (ref == 0) {
fprintf(stderr, "internal error: vpi_handle(type=%d, ref=0)\n",
fprintf(stderr, "VPI error: vpi_handle(type=%d, ref=0).\n",
(int)type);
return 0;
}
assert(ref);
if (ref->vpi_type->handle_ == 0) {

View File

@ -155,7 +155,7 @@ static int scope_get(int code, vpiHandle obj)
return (int) ref->is_automatic;
}
return 0;
return vpiUndefined;
}
static void construct_scope_fullname(struct __vpiScope*ref, char*buf)
@ -182,8 +182,8 @@ static const char* scope_get_type(int code)
case vpiNamedFork:
return "vpiNamedFork";
default:
fprintf(stderr, "ERROR: invalid code %d.", code);
assert(0);
fprintf(stderr, "VPI error: invalid scope type code %d.\n", code);
return NULL;
}
}
@ -223,9 +223,8 @@ static char* scope_get_str(int code, vpiHandle obj)
break;
default:
fprintf(stderr, "ERROR: invalid code %d.", code);
assert(0);
return 0;
fprintf(stderr, "VPI error: invalid scope string code %d.\n", code);
return NULL;
}
return simple_set_rbuf_str(p);
}

View File

@ -549,7 +549,7 @@ static int signal_get(int code, vpiHandle ref)
vpi_get_value(rfp->id.index, &vp);
return vp.value.integer;
} else {
return 0;
return vpiUndefined;
}
case vpiSize:
@ -562,7 +562,7 @@ static int signal_get(int code, vpiHandle ref)
if (ref->vpi_type->type_code==vpiNet)
return vpiWire;
else
return 0;
return vpiUndefined;
case vpiLeftRange:
return rfp->msb;
@ -577,11 +577,12 @@ static int signal_get(int code, vpiHandle ref)
if (rfp->msb == rfp->lsb)
return (int) (unsigned long) rfp->node;
else
return 0;
return vpiUndefined;
default:
fprintf(stderr, "signal_get: property %d is unknown\n", code);
return 0;
fprintf(stderr, "VPI error: unknow signal_get property %d.\n",
code);
return vpiUndefined;
}
}
@ -594,13 +595,15 @@ static char* signal_get_str(int code, vpiHandle ref)
return simple_set_rbuf_str(file_names[0]);
}
if (code != vpiName) return NULL;
char *nm, *ixs;
if (rfp->is_netarray) {
nm = strdup(vpi_get_str(vpiName, rfp->within.parent));
s_vpi_value vp;
vp.format = vpiDecStrVal;
vpi_get_value(rfp->id.index, &vp);
ixs = vp.value.str; /* do I need to strdup() this? */
ixs = vp.value.str; /* do I need to strdup() this? */
} else {
nm = strdup(rfp->id.name);
ixs = NULL;