getNativeDeclaration: Compute C/C++ declaration for specified variable

Description Usage Arguments Value Author(s)

Description

This function is responsible for creating the text that declares a C/C++ variable of the specified type so that it can be used as a parameter in a C/C++ routine or as a local variable within the routine. It combines a type and a symbol name to create the declaration code. It can optionally put a ; at the end of the code.

Usage

1
getNativeDeclaration(name, v, variableNames, addSemiColon = TRUE, const = NA)

Arguments

name

the name for the variable or parameter

v

a description of the type of the variable being declared. This is typically obtained by resolving a type definition from the translation unit using resolveType but can be created manually.

variableNames

the names of other known variables in the routine definition which could be used to avoid conflicts.

addSemiColon

a logical value indicating whether to add a ‘;’ at the end of the generated declaration code. When generating parameter declarations for a routine, we don't want the ;. But for local variables, we do.

const

this is used in some of the methods to qualify the declaration as being a constant/immutable "variable". This information can also be determined in many cases from the type v. If this is NA, the value is determined from v. Otherwise, it should be a logical value with TRUE indicating to add a const qualifier to the generated code declaration.

Value

A string (character vector of length 1) giving the declaration for the code.

Author(s)

Duncan Temple Lang


omegahat/RGCCTranslationUnit documentation built on May 24, 2019, 1:53 p.m.