Working with meta-data from C/C++ code in R: the RGCCTranslationUnit package
- 69 Downloads
This paper describes an R package that allows one to read and generate a description of C and C++ source code elements. These descriptions are meta-data about that C/C++ code and can be used for several different purposes. The most obvious application is to programmatically generate bindings/wrappers which are R functions and C routines that allow R users to invoke the original C/C++ routines from within R. We discuss the mechanics of the package and briefly outline one strategy for generating the mappings between R and arbitrary C/C++ code. We also illustrate how we can create new derived C++ classes, some or all of whose methods can be implemented in R via R functions. The meta-data can also be used to generate registration information for R’s dynamic symbol resolution, identify potential re-factoring for the removal of global variables (leading towards thread-safety), and generally collect data for software metrics and analysis. The package currently provides the primitives for reading and working with the meta-data, and has support for generating bindings for most of the common C and C++ constructs. Additional facilities such as determining memory management and computing call graphs from the body of a routine can be built on top of these primitives. Versions of the package are available at http://www.omegahat.org/RGCCTranslationUnit.
KeywordsSource Code Data Type Software Metrics Protected Method External Pointer
Unable to display preview. Download preview PDF.
- Beazley D et al (1998) SWIG—Simplified Wrapper Interface Generator. http://www.swig.org. Februrary 1998
- Insightful Corporation (2007) S-Plus. http://www.insightful.com
- King B (2004) GCC-XML. http://www.gccxml.org. February 2004
- Temple Lang D (2000) The RSPerl package for R. http://www.omegahat.org/RSPerl. October 2000
- R Development Core Team (2006) Writing R extensions, R foundation for statistical computing, Vienna, Austria, October 2006 (ISBN 3-900051-11-9). http://cran.r-project.org/doc/manuals/R-exts.pdf
- R Development Core Team (2008) R: A language and environment for statistical computing. ISBN 3-900051-07-0. http://www.R-project.org
- Steffen J, Bröker H-B (2000) cscope. http://cscope.sourceforge.net. April 2000
- Stallman RM, Tower L et al (1987) GNU compiler collection. http://gcc.gnu.org
- The MathWorks (2007) MATLAB. http://www.mathworks.com/products/matlab
- van Rossum G, Drake FL (eds) (2001) Python reference manual. PythonLabs, VA, USAGoogle Scholar
- Winters A (2003) GCC::TranslationUnit Perl Module. http://search.cpan.org/dist/GCC-TranslationUnit. September 2003