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

# 3

# LEF Reader Callback Routines

The Cadence® Library Exchange Format (LEF) reader calls all callback routines when it reads in the appropriate part of the LEF file. Some routines, such as the version callback, are called only once. Other routines can be called more than once.

This chapter contains the following sections:

| Callback Function Format

| Callback Types and Setting Routines

| User Callback Routines

## Callback Function Format

All callback functions have the following format:

int UserCallbackFunction(
  lefrCallbackType_e
callbackType
data_type* LEF_data
lefiUserData data)

Each user-supplied callback routine is passed three arguments.

### 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. For examples, see Appendix A, "LEF Reader and Writer Examples."

### LEF_Data

The LEF_data argument provides the data specified by the callback. Data types returned by the callbacks vary for each callback. Examples of the types of arguments passed include const char*, double, int, and defiProp. Two points to note:

| The data returned in the callback is not checked for validity.

| If you want to keep the data, you must make a copy of it.

### User Data

The data argument is a four-byte data item that is set by the user. The LEF reader contains only user data. The user data is most often set to a pointer to the library data so that it can be passed to the routines. This is more effective than using a global variable.

The callback functions can be set or reset at any time. If you want a callback to be available when the LEF file parsing begins, you must set the callback before you call lefrRead.

Note: You can unset a callback by using the set function with a null argument.

## Callback Types and Setting Routines

You must set a callback before you can use it. When you set a callback, the callback routine used for each type of LEF information is passed in the appropriate setting routine. Each callback routine returns a callback type.

The following table lists the LEF reader callback setting routines and the associated callback types. The contents of the setting routines are described in detail in the section "User Callback Routines".

LEF Information | Setting Routine | Callback Type
Bus Bit Characters | void lefrSetBusBitCharsCbk (lefrStringCbkFnType); | lefrBusBitCharsCbkType
Clearance Measure | void lefrSetClearanceMeasureCbk (lefrStringCbkFnType); | lefrClearanceMeasureCbkType
Density | void lefrSetDensityCbk (lefrDensityCbkFnType) | lefrDensityCbkType
Divider Character | void lefrSetDividerCharCbk (lefrStringCbkFnType); | lefrDividerCharCbkType
Extensions | void lefrSetExtensionCbk (lefrStringCbkFnType) | lefrExtensionCbkType
Fixed Mask | void lefrFixedMaskCbk (lefrIntergerCbkFnType) | lefrFixedMaskCbkType
Library End Statement | void lefrSetLibraryEndCbk (lefrVoidCbkFnType); | lefrLibraryEndCbkType
Layer | void lefrSetLayerCbk (lefrLayerCbkFnType); | lefrLayerCbkType
Macro Beginning | void lefrSetMacroBeginCbk (lefrStringCbkFnType); | lefrMacroBeginCbkType
Macro | void lefrSetMacroCbk (lefrMacroCbkFnType); | lefrMacroCbkType
Macro Class Type | void lefrSetMacroClassTypeCbk (lefrStringCbkFnType); | lefrMacroClassTypeCbkType
Macro End | void lefrSetMacroEnd (lefrStringCbkFnType) ; | lefrMacroEndCbkType
Macro Fixed Mask | void lefrMacroFixedMaskCbk (lefrIntergerCbkFnType) | lefrMacroFixedMaskCbkType
Macro Foreign | void lefrSetMacroForeignCbk (lefrMacroForeignCbkFnType); void lefrUnsetMacroForeignCbk(); | lefrMacroForeignCbkFnType
Macro Origin | void lefrSetMacroOriginCbk (lefrMacroNumCbkFnType) ; | lefrMacroOriginCbkType
Macro Obstruction | void lefrSetObstructionCbk (lefrObstructionCbkFnType); | lefrObstructionCbkType
Macro Pin | void lefrSetPinCbk (lefrPinCbkFnType); | lefrPinCbkType
Macro Site | void lefrSetMacroSiteCbk (lefrMacroSiteCbkFnType); void lefrUnsetMacroSiteCbk(); | lefrMacroSiteCbkFnType
Macro Size | void lefrSetMacroSizeCbk (lefrMacroNumCbkFnType) ; | lefrMacroSizeCbkType
Manufacturing Grid | void lefrSetManufacturingCbk (lefrDoubleCbkFnType); | lefrManufacturingCbkType
Maximum Via Stack | void lefrSetMaxStackViaCbk (lefrMaxStackViaCbkFnType) ; | lefrMaxStackViaCbkType
Nondefault Rules | void lefrSetNonDefaultCbk (lefrNonDefaultCbkFnType); | lefrNonDefaultCbkType
Property Definitions Beginning | void lefrSetPropBeginCbk (lefrVoidCbkFnType); | lefrPropBeginCbkType
Property Definitions | void lefrSetPropCbk (lefrPropCbkFnType); | lefrPropCbkType
Property Definitions End | void lefrSetPropEndCbk (lefrVoidCbkFnType); | lefrPropEndCbkType
Same-Net Spacing Beginning | void lefrSetSpacingBeginCbk (lefrVoidCbkFnType); | lefrSpacingBeginCbkType
Same-Net Spacing | void lefrSetSpacingCbk (lefrSpacingCbkFnType); | lefrSpacingCbkType
Same-Net Spacing End | void lefrSetSpacingEndCbk (lefrVoidCbkFnType); | lefrSpacingEndCbkType
Site | void lefrSetSiteCbk (lefrSiteCbkFnType); | lefrSiteCbkType
Units | void lefrSetUnitsCbk (lefrUnitsCbkFnType); | lefrUnitsCbkType
Use Min Spacing | void lefrSetUseMinSpacingCbk (lefrUseMinSpacingCbkFnType); | lefrUseMinSpacingCbkType
Version | void lefrSetVersionCbk (lefrDoubleCbkFnType); | lefrVersionCbkType
Version String | void lefrSetVersionStrCbk (lefrStringCbkFnType); | lefrVersionStrCbkType
Via | void lefrSetViaCbk (lefrViaCbkFnType); | lefrViaCbkType
Via Rule | void lefrSetViaRuleCbk (lefrViaRuleCbkFnType); | lefrViaRuleCbkType
Unused | void lefrSetUnusedCallbacks (lefrVoidCbkFnType func); | lefrUnspecifiedCbkType

### Examples

The following example shows how to create a setup routine so the reader can parse the LEF file and call the callback routines you defined.

int setupRoutine() {
  FILE* f;
  int res;
  int userData = 0x01020304;
  ...

  // Initialize the reader. This routine is called first.
  lefrInit();

  // Set the user callback routines
  lefrSetArrayBeginCbk(arrayBeginCB);
  lefrSetArrayCbk(arrayCB);
  lefrSetArrayEndCbk(arrayEndCB);
  lefrSetBusBitCharsCbk(busBitCharsCB);
  lefrSetCaseSensitiveCbk(caseSensCB);
  lefrSetDielectricCbk(dielectricCB);
  ...

  // Open the lef file for the reader to read
  if ((f = fopen("lefInputFileName","r")) == 0) {
  printf("Couldn't open input file '%s'\n",
  "lefInputFileName");
  return(2);
  }

// Invoke the parser
  res = lefrRead(f, "lefInputFileName", (void*)userData);
  if (res != 0) {
  printf("LEF parser returns an error\n");
  return(2);
  }

fclose(f);

return 0;}lefrUseMinSpacingCbkFnType

## User Callback Routines

This section describes the following user callback routines:

| lefrDensityCbkFnType

| lefrDoubleCbkFnType

| lefrIntergerCbkFnType

| lefrLayerCbkFnType

| lefrMacroCbkFnType

| lefrMacroForeignCbkFnType

| lefrMacroNumCbkFnType

| lefrMacroSiteCbkFnType

| lefrMaxStackViaCbkFnType

| lefrNonDefaultCbkFnType

| lefrObstructionCbkFnType

| lefrPinCbkFnType

| lefrPropCbkFnType

| lefrSiteCbkFnType

| lefrSpacingCbkFnType

| lefrStringCbkFnType

| lefrUnitsCbkFnType

| lefrUseMinSpacingCbkFnType

| lefrViaCbkFnType

| lefrViaRuleCbkFnType

| lefrVoidCbkFnType

### lefrDensityCbkFnType

Retrieves data from the DENSITY object from within the MACRO object. Use the arguments defined in the lefiDensity class to retrieve the data.

For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF Language Reference.

#### Syntax

int lefrDensityCbkFnType(
  lefrCallbackType_e
typ
lefiDensity* density
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrDensityCbkType type. This allows you to verify within your program that this is a correct callback.

lefiDensity

> Returns a pointer to a lefiDensity structure. For more information, see "lefiDensity".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrDoubleCbkFnType

Retrieves different kinds of LEF data. The format of the data returned is always the same, but the actual data represented varies depending on the calling routine.

For more information about LEF syntax, see the LEF/DEF Language Reference.

#### Syntax

int lefrDoubleCbkFnType(
  lefrCallbackType_e
typ,
  double number,
  lefiUserData* data)

#### Arguments

typ

> Returns a type that varies depending on the callback routine used. The following types can be returned.

LEF Data | Type Returned
Manufacturing Grid | lefrManufacturingCbkType
Version | lefrVersionCbkType

number

> Returns data that varies depending on the callback used. The following kinds of data can be returned.

LEF Data | Returns the Value of
Manufacturing Grid | value in the MANUFACTURINGGRID statement
Version | number in the VERSION statement

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrIntergerCbkFnType

Retrieves LEF data pertaining to fixed masks. The format of the data returned is always the same, but the actual data represented varies depending on the calling routine.

For more information about the FIXEDMASK statement, see "FIXEDMASK" in the LEF/DEF Language Reference.

#### Syntax

int lefrIntergerCbkFnType
  leftCallbackType_e
type,
  int number,
  lefiUserData* data)

#### Arguments

type

> Returns a type that varies depending on the callback routine used. The following types can be returned.

LEF Data | Type Returned
FixedMask | lefrFixedMaskCbkType
Macro FixedMask | lefrMacroFixedMaskCbkType

number

> Returns a type that varies depending on the callback used. The following kind of data can be returned.
> Fixed mask: Does not allow mask shifting. All the LEF MACRO PIN MASK assignments must be kept fixed and cannot be shifted to a different mask, (1indicates not allowed, and 0 allowed).
> Macro FixedMask: Indicates that the specified macro does not allow mask shifting. All the LEF PIN MASK assignments must be kept fixed and cannot be shifted to a different mask. (1 indicates not allowed, and 0 allowed).

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrLayerCbkFnType

Retrieves data from the LAYER object of the LEF file. Use the arguments defined in the lefiLayer class to retrieve the data.

For syntax information about the LEF LAYER statement, see "Layer (Cut)," "Layer (Masterslice or Overlap)," "Layer (Routing)," or "Layer (Implant)" in the LEF/DEF Language Reference.

#### Syntax

int lefrLayerCbkFnType(
  lefrCallbackType_e
typ,
  lefiLayer* layer,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrLayerCbkType type. This allows you to verify within your program that this is a correct callback.

layer

> Returns a pointer to a lefiLayer structure. For more information, see "lefiLayer".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrMacroCbkFnType

Retrieves data from the MACRO object in the LEF file. Use the arguments defined in the lefiMacro class to retrieve the data.

For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF Language Reference.

#### Syntax

int lefrMacroCbkFnType(
  lefrCallbackType_e
typ,
  lefiMacro* macro,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrMacroCbkType type. This allows you to verify within your program that this is a correct callback.

macro

> Returns a pointer to a lefiMacro structure. For more information, see "lefiMacro".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrMacroForeignCbkFnType

Retrieves data for in-place processing of a MACRO FOREIGN statement. Use the arguments defined in the lefiMacroForeign class to retrieve the data.

For syntax information about the LEF MACRO FOREIGN statement, see "Macro" in the LEF/DEF Language Reference.

#### Syntax

int lefrMacroForeignCbkFnType(
  lefrCallbackType_e
typ,
  lefiMacroForeign* foreign,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrMacroForeignCbkType type. This allows you to verify within your program that this is a correct callback.

foreign

> Returns a pointer to a lefiMacroForeign structure. For more information, see lefiMacroForeign.

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrMacroNumCbkFnType

Retrieves different kinds of Macro LEF data. The format of the data returned is always the same, but the actual data represented varies depending on the calling routine.

For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF Language Reference.

#### Syntax

int lefrMacroNumCbkFnType(
  lefrCallbackType_e
typ,
  lefiNum num,
  lefiUserData* data)

#### Arguments

typ

> Returns a type that varies depending on the callback routine used. The following types can be returned.

LEF Data | Type Returned
Macro Origin | lefrMacroOriginCbkType
Macro Size | lefrMacroSizeCbkType

num

> Returns data that varies depending on the callback used. The following kinds of data can be returned.

LEF Data | Returns the Value of
Macro Origin | value for ORIGIN in the MACRO statement.
Macro Size | value for SIZE in the MACRO statement.

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrMacroSiteCbkFnType

Retrieves data for in-place processing of a MACRO SITE statement. Use the arguments defined in the lefiMacroSite class to retrieve the data.

For syntax information about the LEF MACRO FOREIGN statement, see "Macro" in the LEF/DEF Language Reference.

#### Syntax

int lefrMacroSiteCbkFnType(
  lefrCallbackType_e
typ,
  lefiMacroSite* site,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrMacroSiteCbkType type. This allows you to verify within your program that this is a correct callback.

site

> Returns a pointer to a lefiMacroSite structure. For more information, see lefiMacroSite.

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrMaxStackViaCbkFnType

Retrieves data from the MAXVIASTACK object in the LEF file. Use the arguments defined in the lefiMaxStackVia class to retrieve the data.

For syntax information about the LEF NONDEFAULTRULE statement, see "Maximum Via Stack" in the LEF/DEF Language Reference.

#### Syntax

lefrMaxStackViaCbkFnType(
  lefrCallbackType_e
typ,
  lefiMaxStackVia* maxStack,
  lefiUserData data)

#### Arguments

typ

> Returns the lefrMaxStackViaCbkType type. This allows you to verify within your program that this is a correct callback.

maxStack

> Returns a pointer to a lefiMaxStackVia structure. For more information, see "lefiMaxStackVia".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrNonDefaultCbkFnType

Retrieves data from the NONDEFAULTRULE object in the LEF file. Use the arguments defined in the lefiNonDefault class to retrieve the data.

For syntax information about the LEF NONDEFAULTRULE statement, see "Nondefault Rule" in the LEF/DEF Language Reference.

#### Syntax

lefrNonDefaultCbkFnType(
  lefrCallbackType_e
typ,
  lefiNonDefault* def,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrNonDefaultCbkType type. This allows you to verify within your program that this is a correct callback.

def

> Returns a pointer to a lefiNonDefault structure. For more information, see "lefiNonDefault".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrObstructionCbkFnType

Retrieves data from the OBS (macro obstruction) object within the MACRO object in the LEF file. Use the arguments defined in the lefiObstruction class to retrieve the data.

For syntax information about the LEF OBS statement, see "Macro Obstruction Statement" in the LEF/DEF Language Reference.

#### Syntax

int lefrObstructionCbkFnType(
  lefrCallbackType_e
typ,
  lefiObstruction* obs,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrObstructionCbkType type. This allows you to verify within your program that this is a correct callback.

obs

> Returns a pointer to a lefiObstruction structure. For more information, see "lefiObstruction".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrPinCbkFnType

Retrieves data from the PIN object within the MACRO object in the LEF file. Use the arguments defined in the lefiPin class to retrieve the data.

For syntax information about the LEF PIN statement, see "Macro Pin Statement" in the LEF/DEF Language Reference.

#### Syntax

int lefrPinCbkFnType(
  lefrCallbackType_e
typ,
  lefiPin* pin,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrPinCbkType type. This allows you to verify within your program that this is a correct callback.

pin

> Returns a pointer to a lefiPin structure. For more information, see "lefiPin".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrPropCbkFnType

Retrieves data from the PROPERTYDEFINITIONS object in the LEF file. Use the arguments defined in the lefiProp class to retrieve the data.

For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property Definitions" in the LEF/DEF Language Reference.

#### Syntax

lefrPropCbkFnType(
  lefrCallbackType_e
typ,
  lefiProp* prop,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrPropCbkType type. This allows you to verify within your program that this is a correct callback.

prop

> Returns a pointer to a lefiProp structure. For more information, see "lefiProp".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrSiteCbkFnType

Retrieves data from the SITE object in the LEF file. Use the arguments defined in the lefiSite class to retrieve the data.

For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language Reference.

#### Syntax

int lefrSiteCbkFnType(
  lefrCallbackType_e
typ,
  lefiSite* site,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrSiteCbkType type. This allows you to verify within your program that this is a correct callback.

site

> Returns a pointer to a lefiSite structure. For more information, see "lefiSite".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrSpacingCbkFnType

Retrieves data from the SPACING object of the LEF file. Use the arguments defined in the lefiSpacing class to retrieve the data.

For syntax information about the LEF SPACING statement, see "Samenet Spacing" in the LEF/DEF Language Reference.

#### Syntax

int lefrSpacingCbkFnType(
  lefrCallbackType_e
typ,
  lefiSpacing* spacing,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrSpacingCbkType type. This allows you to verify within your program that this is a correct callback.

spacing

> Returns a pointer to a lefiSpacing structure. For more information, see "lefiSpacing".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrStringCbkFnType

Retrieves different kinds of LEF data. The format of the data returned is always the same, but the actual data represented varies depending on the calling routine.

For more information about LEF syntax, see the LEF/DEF Language Reference.

#### Syntax

int lefrStringCbkFnType(
  lefrCallbackType_e
typ,
  const char* string,
  lefiUserData* data)

#### Arguments

typ

> Returns a type that varies depending on the callback routine used. The following types can be returned.

LEF Data | Type Returned
Bus Bit Characters | lefrBusBitCharsCbkType
Clearance Measure | lefrClearanceMeasureCbkType
Divider Character | lefrDividerCharCbkType
Extensions | lefrExtensionCbkType
Macro Beginning | lefrMacroBeginCbkType
Macro Class Type | lefrMacroClassTypeCbkType
Macro End | lefrMacroEndCbkType
Version String | lefrVersionStrCbkType

string

> Returns data that varies depending on the callback used. The following kinds of data can be returned.

LEF Data | Returns the value of
Bus Bit Characters | delimterPair in the BUSBITCHARS statement
Clearance Measure | Returns the string set for a CLEARANCEMEASURE statement
Divider Character | character in a DIVIDERCHAR statement
Extensions | Retruns the string set for an EXTENSION statement
Macro Beginning | macroName in a MACRO statement
Macro Class Type | Returns the string set for a CLASS statement in a MACRO statement
Macro End | END macroName in a MACRO statement
Version String | Returns the string set for a VERSION statement

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrUnitsCbkFnType

Retrieves data from the UNITS object in the LEF file. Use the arguments defined in the lefiUnits class to retrieve the data.

For syntax information about the LEF UNITS statement, see "Units" in the LEF/DEF Language Reference.

#### Syntax

int lefrUnitsCbkFnType(
  lefrCallbackType_e
typ,
  lefiUnits* units,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrUnitsCbkType type. This allows you to verify within your program that this is a correct callback.

units

> Returns a pointer to a lefiUnits structure. For more information, see "lefiUnits".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrUseMinSpacingCbkFnType

Retrieves data from the USEMINSPACING object in the LEF file. Use the arguments defined in the lefiUseMinSpacing class to retrieve data.

For information about the LEF USEMINSPACING statement, see "Use Min Spacing" in the
LEF/DEF Language Reference.

#### Syntax

int lefrUseMinSpacingCbkFnType(
  lefrCallbackType_e
typ,
  lefiUseMinSpacing* spacing,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrUseMinSpacingCbkFnType type. This allows you to verify within your program that this is a correct callback.

spacing

> Returns a pointer to a lefiUseMinSpacing structure. For more information, see "lefiUseMinSpacing"

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrViaCbkFnType

Retrieves data from the VIA object in the LEF file. Use the arguments defined in the lefiVia class to retrieve the data.

For syntax information about the LEF VIA statement, see "Via" in the LEF/DEF Language Reference.

#### Syntax

int lefrViaCbkFnType(
  lefrCallbackType_e
typ,
  lefiVia* via,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrViaCbkType type. This allows you to verify within your program that this is a correct callback.

via

> Returns a pointer to a lefiVia structure. For more information, see "lefiVia".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrViaRuleCbkFnType

Retrieves data from the VIARULE object in the LEF file. Use the arguments defined in the lefiViaRule class to retrieve the data.

For syntax information about the LEF VIARULE statement, see "Via Rule" in the LEF/DEF Language Reference.

#### Syntax

int lefrViaRuleCbkFnType(
  lefrCallbackType_e
typ,
  lefiViaRule* viaRule,
  lefiUserData* data)

#### Arguments

typ

> Returns the lefrViaRuleCbkType type. This allows you to verify within your program that this is a correct callback.

viaRule

> Returns a pointer to a lefiViaRule structure. For more information, see "lefiViaRule".

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### lefrVoidCbkFnType

Marks the beginning and end of LEF objects. The format of the data returned is always the same, but the actual data represented varies depending on the calling routine.

For more information about LEF syntax, see the LEF/DEF Language Reference.

#### Syntax

int lefrVoidCbkFnType(
  lefrCallbackType_e
typ,
  void* ptr,
  lefiUserData* data)

#### Arguments

typ

> Returns a type that varies depending on the callback routine used. The following types can be returned.

LEF Data | Type Returned
Library End | lefrLibraryEndCbkType
Property Begin | lefrPropBeginCbkType
Property End | lefrPropEndCbkType
Spacing Begin | lefrSpacingBeginCbkType
Spacing End | lefrSpacingEndCbkType
Unused | lefrUnspecifiedCbkType

ptr

> Returns nothing. (This is a placeholder value to meet the required three arguments for each routine).

data

> Returns four bytes of user-defined data. User data is set most often to a pointer to the design data.

### Examples

The following example shows a callback routine using lefrCallbackType_e, char*, and lefiUserData.

int macroBeginCB (lefrCallbackType_e type,
  const char *macroName,
  lefiUserData userData) {

// Incorrect type was passed in, expecting the type lefiMacroBeginCbkType

if (type != lefiMacroBeginCbkType) {
  printf("Type is not lefiMacroBeginCbkType,
  terminate parsing.\n");
  return 1;
  }

// Expect a non null char* macroName
  if (!macroName || !*macroName) {
  printf("Macro name is null, terminate parsing.\n");
  return 1;
  }

// Write out the macro name
  printf("Macro name is %s\n", macroName);
  return 0;}

The following callback routine has arguments of lefrCallbackType_e, void*, and lefiUserData.

int irdropEndCB (lefrCallbackType_e type,
  void* ptr,
  lefiUserData userData) {
  // Check if the type is correct
  if (type != lefrIRDropEndCbkType) {
  printf("Type is not lefrIRDropEndCbkType, terminate
  parsing.\n");
  return 1;
  }

printf("IRDROP END\n");
  return 0;}

Return to top of page

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