Main Content

setReservedIdentifiers

Register reserved identifiers to associate with code replacement library

Description

setReservedIdentifiers(hTable,ids) registers reserved identifier structures in a code replacement table.

In a code replacement table, the code generator registers each function implementation name defined by a table entry as a reserved identifier. You can register additional reserved identifiers for the table on a per-header-file basis. Providing additional reserved identifiers can help prevent duplicate symbols and other identifier-related compile and link issues.

The setReservedIdentifiers function lets you register up to four reserved identifier structures in a code replacement table. One set of reserved identifiers can be associated with a code replacement library, while the other three (if present) must be associated with libraries named ANSI_C, ISO_C, ISO_C++, or GNU.

For information about generating a list of reserved identifiers for the code replacement library that you use to generate code, see Reserved Identifiers and Code Replacement.

example

Examples

collapse all

This example shows how to use the setReservedIdentifiers function to register four reserved identifier structures, for 'ANSI_C', 'ISO_C','ISO_C++', and 'My Custom CRL', respectively.

hLib = RTW.TflTable;

% Create and register CRL entries here

.
.
.

% Create and register reserved identifiers
d{1}.LibraryName = 'ANSI_C';
d{1}.HeaderInfos{1}.HeaderName = 'math.h';
d{1}.HeaderInfos{1}.ReservedIds = {'a', 'b'}; 
d{1}.HeaderInfos{2}.HeaderName = 'foo.h';
d{1}.HeaderInfos{2}.ReservedIds = {'c', 'd'};

d{2}.LibraryName = 'ISO_C';
d{2}.HeaderInfos{1}.HeaderName = 'math.h';
d{2}.HeaderInfos{1}.ReservedIds = {'a', 'b'}; 
d{2}.HeaderInfos{2}.HeaderName = 'foo.h';
d{2}.HeaderInfos{2}.ReservedIds = {'c', 'd'};

d{3}.LibraryName = 'ISO_C++';
d{3}.HeaderInfos{1}.HeaderName = 'math.h';
d{3}.HeaderInfos{1}.ReservedIds = {'a', 'b'}; 
d{3}.HeaderInfos{2}.HeaderName = 'foo.h';
d{3}.HeaderInfos{2}.ReservedIds = {'c', 'd'};

d{4}.LibraryName = 'My Custom CRL';
d{4}.HeaderInfos{1}.HeaderName = 'my_math_lib.h';
d{4}.HeaderInfos{1}.ReservedIds = {'y1', 'u1'}; 
d{4}.HeaderInfos{2}.HeaderName = 'my_oper_lib.h';
d{4}.HeaderInfos{2}.ReservedIds = {'foo', 'bar'};

setReservedIdentifiers(hLib, d);

Input Arguments

collapse all

The hTable is a handle to a code replacement table previously returned by hTable = RTW.TflTable.

Example: hLib

The ids is a structure specifying reserved keywords to be registered for a library. The structure must contain:

  • LibraryName element, a character vector or string scalar that specifies 'ANSI_C', 'ISO_C', 'ISO_C++', 'GNU'.

  • HeaderInfos element, a structure or cell array of structures containing:

    • HeaderName element, a character vector or string scalar that specifies the header file in which the identifiers are declared.

    • ReservedIds element, a cell array of character vectors or string array that specifies the names of the identifiers to be registered as reserved keywords.

Example: d

Version History

Introduced in R2008a