From 49a8d46885ef4d6354aa027caf0887e680eaf23d Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 24 May 2003 03:02:04 +0000 Subject: [PATCH] Add implementation of acc_handle_by_name. --- acc_user.h | 6 +++- libveriuser/Makefile.in | 4 +-- libveriuser/a_handle_by_name.c | 60 ++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 libveriuser/a_handle_by_name.c diff --git a/acc_user.h b/acc_user.h index 02118143c..6626ece9d 100644 --- a/acc_user.h +++ b/acc_user.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: acc_user.h,v 1.12 2003/05/18 00:16:35 steve Exp $" +#ident "$Id: acc_user.h,v 1.13 2003/05/24 03:02:04 steve Exp $" #endif /* @@ -216,6 +216,7 @@ extern char* acc_fetch_type_str(PLI_INT32 type); extern char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value); +extern handle acc_handle_by_name(const char*name, handle scope); extern handle acc_handle_object(const char*name); extern handle acc_handle_parent(handle obj); @@ -243,6 +244,9 @@ EXTERN_C_END /* * $Log: acc_user.h,v $ + * Revision 1.13 2003/05/24 03:02:04 steve + * Add implementation of acc_handle_by_name. + * * Revision 1.12 2003/05/18 00:16:35 steve * Add PLI_TRACE tracing of PLI1 modules. * diff --git a/libveriuser/Makefile.in b/libveriuser/Makefile.in index f89a61362..0046f376b 100644 --- a/libveriuser/Makefile.in +++ b/libveriuser/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.23 2003/05/18 00:16:35 steve Exp $" +#ident "$Id: Makefile.in,v 1.24 2003/05/24 03:02:04 steve Exp $" # # SHELL = /bin/sh @@ -48,7 +48,7 @@ RANLIB = @RANLIB@ A = a_close.o a_configure.o a_fetch_argc.o a_fetch_argv.o a_fetch_fullname.o \ a_fetch_location.o a_fetch_param.o a_fetch_tfarg.o a_fetch_time.o \ a_fetch_type.o a_fetch_type_str.o a_fetch_value.o \ -a_handle_object.o a_handle_parent.o a_handle_tfarg.o \ +a_handle_by_name.o a_handle_object.o a_handle_parent.o a_handle_tfarg.o \ a_initialize.o a_next_topmod.o a_object_of_type.o a_product_version.o \ a_set_value.o a_vcl.o a_version.o O = asynch.o delay.o finish.o getcstringp.o getinstance.o getlongp.o \ diff --git a/libveriuser/a_handle_by_name.c b/libveriuser/a_handle_by_name.c new file mode 100644 index 000000000..f57afb540 --- /dev/null +++ b/libveriuser/a_handle_by_name.c @@ -0,0 +1,60 @@ +/* vi:sw=6 + * Copyright (c) 2003 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 + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifdef HAVE_CVS_IDENT +#ident "$Id: a_handle_by_name.c,v 1.1 2003/05/24 03:02:04 steve Exp $" +#endif + +# include +# include +# include "priv.h" +# include +# include + +/* + * acc_handle_by_name implemented using VPI interface + */ +handle acc_handle_by_name(const char*obj_name, handle scope) +{ + vpiHandle sys_h; + vpiHandle res; + + /* if no scope provided, use tasks scope */ + if (!scope) { + sys_h = vpi_handle(vpiSysTfCall, 0 /* NULL */); + scope = vpi_handle(vpiScope, sys_h); + } + + res = vpi_handle_by_name(obj_name, scope); + + if (pli_trace) { + fprintf(pli_trace, "acc_handle_by_name(\"%s\", scope=%s) " + " --> %p\n", obj_name, + vpi_get_str(vpiFullName, scope), res); + fflush(pli_trace); + } + + return res; +} + +/* + * $Log: a_handle_by_name.c,v $ + * Revision 1.1 2003/05/24 03:02:04 steve + * Add implementation of acc_handle_by_name. + * + */