---
name: "loadphfig"
section: "3"
platform: "linux"
package: "alliance"
version: "5.1.1-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/loadphfig"
---

# loadphfig(3)

load a new physical cell model from disk

## NAME

loadphfig - load a new physical cell model from disk

## SYNOPSYS

```
#include "mph.h"
void loadphfig(ptfig, figname, mode)
phfig_list ∗ptfig;
char ∗figname;
char mode;
```

## PARAMETERS

- *ptfig*

  Pointer to an allocated but empty *phfig*

- *figname*

  Name of the figure to be loaded

- *mode*

  Loading mode

## DESCRIPTION

**loadphfig** fills the *phfig* pointed to by *ptfig* with the  contents of a disk file called *figname*. The loading mode may be either **'A'**, then the entire content is parsed, or **'P'** then only connectors, abutment box, and through routes are loaded, or **'C'**, that finishes to fill an already loaded figure in **'P'** mode, in order to have it all in memory. This last mode allows to keep the same *ptfig* pointer when reaccessing the same file.\
 The **loadphfig** function in fact performs a call to a parser, choosen by the [**MBK\_IN\_PH**(1)](/MBK_IN_PH/1.md) environment variable. The directories seached for the file are first the one set by [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md) and then, in the described order, the ones set by [**MBK\_CATA\_LIB**(1)](/MBK_CATA_LIB/1.md). See [**MBK\_IN\_PH**(1)](/MBK_IN_PH/1.md), [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md), [**MBK\_CATA\_LIB**(1)](/MBK_CATA_LIB/1.md) and [**mbkenv**(3)](/mbkenv/3.md) for details.

## ERRORS

Some errors resulting from a call to **loadphfig** are due to the parsers, and are prefixed by the parser format (pf). \
 **"∗∗∗ mbk error ∗∗∗ not supported physical input format 'xxx'"**

The environment variable *MBK\_IN\_PH* is not set to a legal physical format.

**"∗∗∗ mbk error ∗∗∗ pfloadphfig : could not open file** *figname***"**

No file called *figname.ext*, where *ext* is the file format extension, has been found in the directories set by the environment.

**"∗∗∗ mbk error ∗∗∗ pfloadphfig : syntax error line x parsing** *figname.ext***"**

Either the file has been corrupted and its syntax is not legal, or there is a bug in the given parser.

## EXAMPLE

```
#include "mph.h"
phfig_list ∗get_the_phfig(figname, mode)
char ∗figname;
char mode;
{
phfig_list ∗pt;
	for (pt = HEAD_PHFIG; pt; pt = pt->NEXT) /∗ scan figure list ∗/
		if (!strcmp(pt->NAME, figname))
			break;
	if (!pt) { /∗ figure doesn't exist ∗/
		pt = addphfig(figname);
		pt->MODE = mode == 'A' ? mode : 'P';
		loadphfig(pt, figname, pt->MODE);
		return pt;
	}
	if (ptfig->MODE != 'A') { /∗ figure exists interface only ∗/
		if (mode == 'A') {
			pt->MODE = 'A';
			loadphfig(pt, figname, 'C');
			return pt;
		} else
			return pt;
	} else /∗ figure exists interface and body ∗/
		return pt;
}
```

## SEE ALSO

**mbk**(1), [**mbkenv**(3)](/mbkenv/3.md), [**phfig**(3)](/phfig/3.md), [**addphfig**(3)](/addphfig/3.md), [**getphfig**(3)](/getphfig/3.md), [**delphfig**(3)](/delphfig/3.md), [**savephfig**(3)](/savephfig/3.md), [**flattenphfig**(3)](/flattenphfig/3.md), [**rflattenphfig**(3)](/rflattenphfig/3.md), [**MBK\_IN\_PH**(1)](/MBK_IN_PH/1.md), [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md), [**MBK\_CATA\_LIB**(1)](/MBK_CATA_LIB/1.md).
