RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RInsideAutoloads.r
Go to the documentation of this file.
1 #!/usr/bin/r
2 #
3 # This owes a lot to autoloads.R in the littler sources
4 
5 dp <- getOption("defaultPackages")
6 #dp <- dp[dp != 'datasets'] ## Rscript loads it too
7 #dp <- dp[dp != 'methods'] ## Rscript (in R 2.6.1) doesn't load methods either
8 
9 # Count of default packages
10 cat(" int packc = ",length(dp),";\n",sep='')
11 
12 # List of packages
13 cat(" const char *pack[] = {\n",paste(' "',dp,'"',sep='',collapse=",\n"),"\n };\n", sep="")
14 
15 packobjc <- array(0,dim=length(dp))
16 packobj <- NULL
17 for (i in 1:length(dp)){
18  obj = ls(paste("package:",dp[i],sep=''))
19  packobjc[i] = length(obj)
20  packobj = c(packobj,obj)
21 }
22 
23 # List of counts of objects per package
24 cat(" int packobjc[] = {\n ",paste(packobjc,sep='',collapse=",\n "),"\n };\n", sep="")
25 
26 # List of object names
27 cat(" const char *packobj[] = {\n ",paste('"',packobj,'"',sep='',collapse=",\n "),"\n };\n", sep="")