getDefines: Find the constants defined via the pre-processor

Description Usage Arguments Author(s) See Also

Description

This attempts to find the definitions of literal constants that are created by the C/C++ pre-processor and not in the C/C++ language. This finds entries such as #define FOO 1 or #define STR "my string". It does not handle conditional definitions, i.e. within #ifdef statements.

This works by making a system call to grep on the files in the target directory. (It does not work recursively, but could easily do so if that was useful rather than excessive.) It discards lines that start with a C++ comment or with #include. Then it delegates the identification of literal constant definitions to the internal function processDefines which looks for all lines that start with #define.

A "better" approach is to use getCppDefines which works directly from the output of the pre-processor.

Usage

1
2
3
getDefines(dir = character(), pattern = ".*", files = "*",
           class = c("TopLevelConstants", "DefineConstants"),
           removeDuplicates = TRUE, getSkipped = FALSE)

Arguments

dir

the directory containing the header files

pattern

pattern for grep.

files

shell glob pattern to identify the files to search

class

the class of the resulting object. Currently ignored.

removeDuplicates

a logical value that controls whether to remove duplicate definitions, leaving the last ones.

getSkipped

a logical value.

Author(s)

Duncan Temple Lang

See Also

getCppDefines


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