DMFINDPROJKEY(5ICD)

NAME
dmFindProjKey - find project key and remote name for (imported) cell

SYNOPSIS

#include "dmincl.h"
DM_PROJECT *dmFindProjKey (loc_imp, local_name, fa_proj, rem_namep, view)
int loc_imp;
char *local_name, *view;
DM_PROJECT *fa_proj;
char **rem_namep;

PARAMETERS

loc_imp
    indicates whether it concerns a local or an imported cell. Accepted values are LOCAL and IMPORTED, as predefined in "dmincl.h".

local_name
    is either the name of a local cell or the alias (local name) of an imported cell.

fa_proj
    is the key of the project in which the local name is defined.

rem_namep
    is a pointer to which the actual cell name will be attached.

view
    is the view in which the cell is defined.

DESCRIPTION
Function dmFindProjKey() illustrates how higher level functions can be build on top of the standard DDM Interface to support specific features of the interaction between the tools and the Data Management System. Function dmFindProjKey() supports the tool in performing a context switch to another project from which a cell has to be obtained.

In the project that is identified by fa_proj the cell is known as local_name. If this local_name is an alias for an imported cell, as indicated by loc_imp, dmFindProjKey() will resolve the corresponding project and remote name from the imported celllist that is present in the father project. If necessary, the son project will be opened. Function dmFindProjKey() will attach the remote name to rem_namep and return the key of the son project. If loc_imp is LOCAL, dmFindProjKey() assumes the son cell is situated in the father project and will return the father project key and the cell name (== local name) immediately.

Function dmFindProjKey() greatly facilitates expansion in a multi-project environment, where son cells may be called from other projects than their own. During the expansion process the tool may obtain aliases for imported cells. By simply calling dmFindProjKey() the tool can obtain all the necessary information for a dmCheckOut() of the son cell. By calling dmFindProjKey() in both the LOCAL and IMPORTED situation, no explicit testing will be necessary in the tool.

The loc_imp value could of course be resolved by searching the "celllist" and "impcelllist" in fixed order. For efficiency and simplicity reasons, however, this value is explicitly part of the MC formats as well as the argument list of dmFindProjKey().

DIAGNOSTICS
If properly executed, dmFindProjKey() will return a pointer to a DM_PROJECT. If dmFindProjKey() fails 0 will be returned, after dmerrno is set to indicate the error and a call to dmError() is done. This might happen in the following cases:

DME_BADARG
    Invalid argument.

DME_BADVIEW
    Invalid view argument.

DME_NOCELL
    Alias not found in imported celllist.

Errors might also result from calls to dmGetMetaDesignData(IMPORTEDCELLIST, ...) and dmOpenProject() that are performed by dmFindProjKey().

SEE ALSO
dmGetMetaDesignData(5ICD), dmOpenProject(5ICD).