# LEF 5.8 C/C++ Programming Interface -- 5
Describes the C/C++ programming interface used to read and write Library Exchange Format (LEF) files.
Author: Technical Publications

###
LEF 5.8 C/C++ Programming Interface (Open Licensing Program)

# 5

# LEF Writer Callback Routines

You can use the Cadence® Library Exchange Format (LEF) writer with callback routines, or you can call one writer function at a time.

When you use callback routines, the writer creates a LEF file in the sequence shown in the following table. The writer also checks which sections are required for the file. If you do not provide a callback for a required section, the writer uses a default routine. If no default routine is available for a required section, the writer generates an error message.

Section | Required | Default Available
Version | no | no
Bus Bit Characters | no | no
Divider Character | no | no
Units | no | no
Property Definitions | no | no
Layer | yes | no
Via | yes | no
Via Rule | yes | no
Nondefault Rules | no | no
Spacing | no | no
Site | yes | no
Macro | yes | no
Extensions | no | no
End Library | yes | no

## Callback Function Format

All callback functions use the following format.

int UserCallbackFunctions(
  lefwCallbackType_e
callBackType,
  lefiUserData data)

### Callback Type

The callBackType argument is a list of objects that contains a unique number assignment for each callback from the parser. This list allows you to use the same callback routine for different types of LEF data.

### User Data

The data argument is a four-byte data item that you set. The LEF writer contains only user data. The user data is most often set to a pointer to the design data so that it can be passed to the routines.

## Callback Types and Setting Routines

The following table lists the LEF writer callback-setting routines and the associated callback types.

LEF Information | Setting Routine | Callback Types
Bus Bit Characters | void lefwSetBusBitCharsCbk (lefwVoidCbkFnType); | lefwBusBitCharsCbkType
Clearance Measure | void lefwSetClearanceMeasureCbk (lefwVoidCbkFnType); | lefwClearanceMeasureCbkType
Divider Character | void lefwSetDividerCharCbk (lefwVoidCbkFnType); | lefwDividerCharCbkType
Extensions | void lefwSetExtCbk (lefwVoidCbkFnType); | lefwExtCbkType
End Library | void lefwSetEndLibCbk (lefwVoidCbkFnType); | lefwEndLibCbkType
Layer | void lefwSetLayerCbk (lefwVoidCbkFnType); | lefwLayerCbkType
Macro | void lefwSetMacroCbk (lefwVoidCbkFnType); | lefwMacroCbkType
Manufacturing Grid | void lefwSetManufacturingGridCbk (lefwVoidCbkFnType); | lefwManufacturingGridCbkType
Nondefault Rule | void lefwSetNonDefaultCbk (lefwVoidCbkFnType); | lefwNonDefaultCbkType
Property Definitions | void lefwSetPropDefCbk (lefwVoidCbkFnType); | lefwPropDefCbkType
Site | void lefwSetSiteCbk (lefwVoidCbkFnType); | lefwSiteCbkType
Spacing | void lefwSetSpacingCbk (lefwVoidCbkFnType); | lefwSpacingCbkType
Units | void lefwSetUnitsCbk (lefwVoidCbkFnType); | lefwUnitsCbkType
Use Min Spacing | void lefwSetUseMinSpacingCbk (lefwVoidCbkFnType); | lefwUseMinSpacingCbkType
Version | void lefwSetVersionCbk (lefwVoidCbkFnType); | lefwVersionCbkType
Via | void lefwSetViaCbk (lefwVoidCbkFnType); | lefwViaCbkType
Via Rule | void lefwSetViaRuleCbk (lefwVoidCbkFnType); | lefwViaRuleCbkType

Return to top of page

For support, see Cadence Online Support service.
Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.