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

# addphcon(3)

create a physical connector

## NAME

addphcon - create a physical connector

## SYNOPSYS

```
#include "mph.h"
phcon_list ∗addphcon(ptfig, orient, conname, x, y, layer, width)
phfig_list ∗ptfig;
char orient;
char ∗conname;
long x, y;
char layer;
long width;
```

## PARAMETERS

- *ptfig*

  Pointer to the figure in which the connector should be added

- *orient*

  Face of the connector

- *conname*

  Name of the connector

- *x, y*

  Absolute connector coordinates

- *layer*

  Connector symbolic layer

- *width*

  Connector symbolic width

## DESCRIPTION

**addphcon** creates a new connector called *conname* and adds it to the list of connectors pointed to by *ptfig-\>PHCON*. The new connector is  added in front of the list, and becomes itself the list head. \
 The parameters *conname*, *orient*, *x*, *y*, *layer*,  *width* fill respectivly the *NAME*, *ORIENT*, *XCON*, *YCON*, *LAYER*, *WIDTH* fields of the *phcon* structure. See [**phcon**(3)](/phcon/3.md) for details.\
 The *INDEX* field is computed by the **addphcon** function in order to warranty index unicity. A topological sort is performed, checking *x*, then *y*, then the *layer*. So for a given figure, each connector will have a constant *INDEX*.\
 The *x*, *y* coordinates must be placed inside the *butment box* of the figure.\
 The *width* is a layer extension that takes place in parallel to the  connector face.\
 For a list of valid *orient* and *layer*s, see [**locon**(3)](/locon/3.md).

## RETURN VALUE

**addphcon** returns a pointer to the newly created connector.

## ERRORS

**"∗∗∗ mbk error ∗∗∗ illegal addphcon unknow layer** *layer* **in** *conname***"**

The *layer* parameter is out of range, and does not represent a legal symbolic layer. See [**locon**(3)](/locon/3.md) for a complete list of layers.

**"∗∗∗ mbk error ∗∗∗ illegal addphcon connector** *conname* **not in** **abutment box"**

The connector coordinates are not included in the rectangle of the figure  *abutment* box. This means that the *abutment box* field of the *phfig* must be filled befor any call to **addphcon**.

**"∗∗∗ mbk error ∗∗∗ illegal addphcon orientation is** *orient* **in**  *conname***"**

The *orient* parameter is not in the set of legal values. See  [**locon**(3)](/locon/3.md) for the complete list of orientations.

## EXAMPLE

```
#include "mph.h"
phcon_list ∗du_con(ptfig, ptcon) /∗ duplicate connector ∗/
phfig_list ∗ptfig;
phcon_list ∗ptcon;
{
   /∗ the index depends from what's in ptfig->PHCON, not from me ∗/
   return addphcon(ptfig, ptcon->ORIENT, ptcon->NAME,
                   ptcon->XCON, ptcon->YCON,
                   ptcon->LAYER, ptcon->WIDTH);
}
```

## SEE ALSO

**mbk**(1), [**phfig**(3)](/phfig/3.md), [**phcon**(3)](/phcon/3.md), [**getphcon**(3)](/getphcon/3.md), [**delphcon**(3)](/delphcon/3.md), [**locon**(3)](/locon/3.md).
