Rcpp/ 0000755 0001762 0000144 00000000000 15130420312 011145 5 ustar ligges users Rcpp/tests/ 0000755 0001762 0000144 00000000000 15125252117 012321 5 ustar ligges users Rcpp/tests/tinytest.R 0000644 0001762 0000144 00000004730 15125252117 014333 0 ustar ligges users
if (requireNamespace("tinytest", quietly=TRUE)) {
## if OMP_THREAD_LIMIT is set, and its value is 2, we have a good
## idea of where we are and we likely do not want to run all tests
if (Sys.getenv("OMP_THREAD_LIMIT", unset="") == "2") { # set and 2
if (Sys.getenv("RunAllRcppTests", "") != "") { # if unset
Sys.setenv("RunAllRcppTests"="no")
}
if (Sys.getenv("RunVerboseRcppTests", "") != "") { # if unset
Sys.setenv("RunVerboseRcppTests"="no")
}
}
## Force tests to be executed if in dev release which we define as
## having a sub-release, eg 0.9.15.5 is one whereas 0.9.16 is not
if (length(strsplit(format(packageVersion("Rcpp")), "\\.")[[1]]) > 3) { # dev rel, and
if (Sys.getenv("RunAllRcppTests") != "no") { # if env.var not yet set
message("Setting \"RunAllRcppTests\"=\"yes\" for development release")
Sys.setenv("RunAllRcppTests"="yes")
}
if (Sys.getenv("RunVerboseRcppTests") != "no") { # if env.var not yet set
message("Setting \"RunVerboseRcppTests\"=\"yes\" for development release")
Sys.setenv("RunVerboseRcppTests"="yes")
}
}
## On Travis also always set tests; see
## https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
## GitHub Action also set CI variable; see
## https://docs.github.com/en/actions/reference/environment-variables
## And we set it in 'docker run' call
## Ensure Codecov runs full tests too
if ((Sys.getenv("CI") == "true") ||
(Sys.getenv("TRAVIS") == "true") ||
(Sys.getenv("CONTINUOUS_INTEGRATION") == "true") ||
(Sys.getenv("CODECOV_TOKEN") != "")) {
if (Sys.getenv("RunAllRcppTests") != "no") { # if env.var not yet set
message("Always enabling \"RunAllRcppTests\"=\"yes\" in CI\n")
Sys.setenv("RunAllRcppTests"="yes")
}
if (Sys.getenv("RunVerboseRcppTests") != "no") { # if env.var not yet set
message("Always enabling \"RunVerboseRcppTests\"=\"yes\" in CI\n")
Sys.setenv("RunVerboseRcppTests"="yes")
}
}
## there are several more granular ways to test files in a tinytest directory,
## see its package vignette; tests can also run once the package is installed
## using the same command `test_package(pkgName)`, or by director or file
tinytest::test_package("Rcpp")
}
Rcpp/.Rinstignore 0000644 0001762 0000144 00000000114 12457514534 013470 0 ustar ligges users inst/doc/Makefile
inst/doc/jss.bst
inst/doc/RJournal.sty
inst/unitTests/src
Rcpp/MD5 0000644 0001762 0000144 00000136453 15130420312 011471 0 ustar ligges users f78cc2f0e2e03e422eef8622dacc0bd3 *ChangeLog
73723f375e8e68e4b2ba06acd19919da *DESCRIPTION
f5ef3825b44e121e64fae1d52cd37960 *NAMESPACE
ad57518c2d1d3d66fc26b6c214ed13e1 *R/00_classes.R
f9a4ffb4d0fcec3eec6ef6c229ff1bba *R/01_show.R
5ad59a1671fd934a15f614a96331c56a *R/02_completion.R
3eafac927ff4e744b84675639ff48078 *R/03_prompt.R
6125cc12496c4829c7dd64506dfe81a3 *R/Attributes.R
c1b4afd8ea21a0f240f582f6edba96f9 *R/Module.R
fa056e0e6a9359e9b633fb4bceb05bfd *R/Rcpp.package.skeleton.R
ac2a0d66a4892308a3a23eaedc726f84 *R/RcppClass.R
12df7da684a31c8e2a2bd255746a5c38 *R/RcppLdpath.R
c93a9fd21b34322477a2c5bbdebea7dc *R/asis.R
87bff7adced70c835fbbbbb25fbc2199 *R/bib.R
37b16d5ad05cc80baaf047c77d53aeec *R/exceptions.R
7e3a5dfefbb7c092bf34b7ad06e761b0 *R/exposeClass.R
822cc71b4ec821510ce30bcb40496d4d *R/inline.R
564309455e4d2828ec51ecdd31c9d726 *R/loadModule.R
02c1cb554af89184c6c5c46e1ee49e17 *R/populate.R
66c49e653c7fcbcefb611cc8aef5e61c *R/tools.R
2944e270961ab2bac4aea5ea0eb2a67e *R/zzz.R
8e1eb90577f4baf3701d6f1c58d86b44 *README.md
dcfe968628d24168fc5bb54a66631158 *TODO
76e123f5dcc8dee07678412adc0a2a84 *build/partial.rdb
c83d8049d910b43001bc85c2d3a9d992 *build/vignette.rds
5f5ee7e3fd8749aaef75bba7b8382326 *cleanup
7599bada89d38a2474389682f552755e *inst/CITATION
a2db4f0600daead03c5baf9f01eca898 *inst/NEWS.Rd
7a9967333ad85931cc6d2051f4dff76e *inst/announce/ANNOUNCE-0.10.0.txt
734d037a2ac31af4659fb3b2e1a778ad *inst/announce/ANNOUNCE-0.11.0.txt
7d85af8d096e473821a3f001d3128b01 *inst/announce/ANNOUNCE-0.6.0.txt
f61c7e9e1460eac25702b24c1af30442 *inst/announce/ANNOUNCE-0.7.0.txt
a198e05a9b004dfc1f8ea67629f2f6c7 *inst/announce/ANNOUNCE-0.8.0.txt
3e8a171f22548f5da208b58e66b48e6c *inst/announce/ANNOUNCE-0.9.0.txt
4a5c2d9b6540f0f1827c2f8706de524f *inst/bib/Rcpp.bib
6f1e3b1f4f75e04af65bb9daf94e9630 *inst/discovery/cxx0x.R
72b76daed876cb173ab5c0ca6f60d932 *inst/doc/Rcpp-FAQ.pdf
2c2689d950eb3637391d5e5194839450 *inst/doc/Rcpp-FAQ.pdf.asis
09fa346b6931f16547f2e77f72b868f9 *inst/doc/Rcpp-attributes.pdf
24c4fcaeb37c15721e72e3dd6bc7dc9d *inst/doc/Rcpp-attributes.pdf.asis
d248328c309bff0489fbfb1ff2757f6f *inst/doc/Rcpp-extending.pdf
c515df15a755d66c1379ddf796af9752 *inst/doc/Rcpp-extending.pdf.asis
e5a7edd89235bcc8e5080e05fc11a52e *inst/doc/Rcpp-introduction.pdf
679d43b484ca77aa763998c23cf3dd0c *inst/doc/Rcpp-introduction.pdf.asis
1ae36767b7db7bd74641291a5a85663e *inst/doc/Rcpp-jss-2011.pdf
a270710de3e1d34603ddb2a8a08cacac *inst/doc/Rcpp-jss-2011.pdf.asis
3a8126023ebf4ea2365635bcde5d3988 *inst/doc/Rcpp-libraries.pdf
ca9f5769c657167c46792a6dba766b0d *inst/doc/Rcpp-libraries.pdf.asis
3e39f5dc300021010c5225b11a9c81d4 *inst/doc/Rcpp-modules.pdf
4b0839ade8b38ffd1b37d859ab55b1f2 *inst/doc/Rcpp-modules.pdf.asis
6f22860718c97abe7ebe58a1aa1135c4 *inst/doc/Rcpp-package.pdf
130153aaa5142d4c2fb8e72796c3beed *inst/doc/Rcpp-package.pdf.asis
925090364509e217eb2958e029d15df8 *inst/doc/Rcpp-quickref.pdf
e8dafda3b4bdfd6a49846cfaa381f34d *inst/doc/Rcpp-quickref.pdf.asis
9d4e8110e95fbb99771058c638905d8c *inst/doc/Rcpp-sugar.pdf
775fbd27e89db3d4232edce372fc00d0 *inst/doc/Rcpp-sugar.pdf.asis
35fa971232b8c9fb0bbb9dfc2ad3de7a *inst/examples/Attributes/Depends.cpp
a9aa3aceea0b49525155a2c43296318b *inst/examples/Attributes/Export.cpp
c6c9969e0067a1321827369cba1cc566 *inst/examples/Attributes/cppFunction.R
ae6383cbe35d7fd9f03a47b16fe084e4 *inst/examples/Attributes/sourceCpp.R
d8ad7f81287bfb38184962408e21dc4b *inst/examples/ConvolveBenchmarks/GNUmakefile
4e5da9b0fe573983765dacbdd4888f71 *inst/examples/ConvolveBenchmarks/buildAndRun.sh
3b726172d475beb1a950a60c963abdd6 *inst/examples/ConvolveBenchmarks/convolve10_cpp.cpp
7b5f52647bb1401e5ca51ae24a99d9ab *inst/examples/ConvolveBenchmarks/convolve10_cpp.h
198737bb5588686872b7bf92c575b44d *inst/examples/ConvolveBenchmarks/convolve11_cpp.cpp
c2326ac51bb20278c7d200c0217af192 *inst/examples/ConvolveBenchmarks/convolve12_cpp.cpp
ec15a3f27dda294c1ba0e85bc7975001 *inst/examples/ConvolveBenchmarks/convolve13_cpp.cpp
c2934f803727f1f9145f2eaacf7fb783 *inst/examples/ConvolveBenchmarks/convolve14_cpp.cpp
02ae1ae1c668a0037f228a316a9b9717 *inst/examples/ConvolveBenchmarks/convolve2_c.c
41c3477fb3c135e372f7dcee7a00b1fe *inst/examples/ConvolveBenchmarks/convolve3_cpp.cpp
6094f474b9bada3d489b5e9e1eed40db *inst/examples/ConvolveBenchmarks/convolve4_cpp.cpp
570d28eceab6c8e21061abaa932a57b7 *inst/examples/ConvolveBenchmarks/convolve5_cpp.cpp
160f9ca0f7a5e8ce599d5a731e33a302 *inst/examples/ConvolveBenchmarks/convolve7_c.c
feac91b32652ac87f9fca99cb65babef *inst/examples/ConvolveBenchmarks/convolve8_cpp.cpp
b653d0cab1e9c200527c631486b21b22 *inst/examples/ConvolveBenchmarks/convolve9_cpp.cpp
e211fa941ea87850f28aafd93dbaea01 *inst/examples/ConvolveBenchmarks/exampleRCode.r
83e612c4f034144d20769da6a98ab430 *inst/examples/ConvolveBenchmarks/loopmacro.h
a39297262c26fcf0016a007c8729f7ed *inst/examples/ConvolveBenchmarks/overhead.r
695db9645074a40edf199a3f6e7b99d9 *inst/examples/ConvolveBenchmarks/overhead.sh
41a7585097bb0330a19163f63b9eb582 *inst/examples/ConvolveBenchmarks/overhead_1.cpp
70bc5f4cab64d21baa5efd44371d6c06 *inst/examples/ConvolveBenchmarks/overhead_2.c
f98ba450080bf7ededba779a9eb9ef08 *inst/examples/FastLM/benchmark.r
187ff739229daa658a997db7361cf79a *inst/examples/FastLM/benchmarkLongley.r
57e3f462b6e57f6d4781d93ad0b5a0f0 *inst/examples/FastLM/fastLMviaArmadillo.r
96177e5073669fce0ada1a133a4b528a *inst/examples/FastLM/fastLMviaGSL.r
bed809fc1187686e9c3f031da7ecc03a *inst/examples/FastLM/lmArmadillo.R
e90e71260dd32a062301a565b0ceb78a *inst/examples/FastLM/lmGSL.R
dee16ee1aaf90787c0d3fe441b57e572 *inst/examples/Misc/fibonacci.r
51b7f11bdc147d595d3d7de4a7b88129 *inst/examples/Misc/ifelseLooped.r
80df7f84cd6c98c9d3b45ceaa62b6325 *inst/examples/Misc/newFib.r
3028009739751d645a3f3c1e65c335b1 *inst/examples/Misc/piBySimulation.r
b6d55aea50fdd5a95b36f006bfa9bbdf *inst/examples/Misc/piSugar.cpp
b28eef52d9c70bdc3bc1c7c4af74a705 *inst/examples/OpenMP/GNUmakefile
6ac8a4754e7a6c968f910b775837981b *inst/examples/OpenMP/OpenMPandInline.r
1fb803a50758e7abccccbacf6df79bb9 *inst/examples/OpenMP/check.R
33d174735e08ffcbfe8b14f77be6467e *inst/examples/OpenMP/piWithInterrupts.cpp
ee8c42a72f8ed650b8ac32443890c01b *inst/examples/RcppGibbs/RcppGibbs.R
cefdedf5f9c0d671bcf465e948198a29 *inst/examples/RcppGibbs/RcppGibbs_Updated.R
a57feb54c968ab827c78c5c18c1d1408 *inst/examples/RcppGibbs/timeRNGs.R
e8a89fe0eebf8ec758806abc84e42d8d *inst/examples/RcppInline/RObject.r
07260e8bebfc924ed834ac9adc10ed3e *inst/examples/RcppInline/RcppInlineExample.r
0e55533b689b5cc21d6e48ed89e39f50 *inst/examples/RcppInline/RcppInlineWithLibsExamples.r
8d8b770eaeee86bcb2a7b0939a3c75f3 *inst/examples/RcppInline/RcppSimpleExample.r
af8de22ca53be6cde070ad079bcc0560 *inst/examples/RcppInline/UncaughtExceptions.r
04094741972fda044af2c1982433f37a *inst/examples/RcppInline/external_pointer.r
924087b70f9e658de341442f27c787ee *inst/examples/SugarPerformance/Timer.h
ddfeedc53f53f33a3da83660c9bc022e *inst/examples/SugarPerformance/Timertest.cpp
8be8229bd89b2ea3a760d1112f7a7054 *inst/examples/SugarPerformance/sugarBenchmarks.R
4b5eef1853e02850de35d4799c7392ef *inst/examples/functionCallback/README
f55a0d78225fef3970fc5f54fddb5801 *inst/examples/functionCallback/newApiExample.r
2b3ff26140686d910b4fe51505b817a3 *inst/examples/performance/extractors.R
33c7adefe3137cae65b189490c958c6a *inst/examples/performance/performance.R
c43702432a8138a32aaee079bbf6e0cd *inst/include/Rcpp.h
36e44ff21273d50c3eaff4a46bb572ac *inst/include/Rcpp/Benchmark/Timer.h
285e526ec9b12a6ca4790b65416368c3 *inst/include/Rcpp/DataFrame.h
e4195b2fee650b67d709d7bd529f3de6 *inst/include/Rcpp/Dimension.h
c09874c5a20d27730a542566017a70a0 *inst/include/Rcpp/DottedPair.h
8ae8df6f92f7d17625b543348c9c035c *inst/include/Rcpp/DottedPairImpl.h
83104802463347135d3d78f9b87c6328 *inst/include/Rcpp/Environment.h
719d99509ff3398d24d31a4964dc6beb *inst/include/Rcpp/Extractor.h
0e673291cac4bf839157946880772c1d *inst/include/Rcpp/Fast.h
1836fe44282438109267ce447debae1a *inst/include/Rcpp/Formula.h
06aa54bae2ddd4733cd4bebb940e17ba *inst/include/Rcpp/Function.h
6ad1b0148d43fd84f39d8e030e39a871 *inst/include/Rcpp/InputParameter.h
a33639e3b142e20c4c5f87b8c252c860 *inst/include/Rcpp/InternalFunction.h
c1a30ee157262261c65ec27ef0435ce7 *inst/include/Rcpp/InternalFunctionWithStdFunction.h
4f649deb041fc8b0ff2680d1a75a49db *inst/include/Rcpp/Interrupt.h
10b9d367e8df67dc986c558e9f142681 *inst/include/Rcpp/Language.h
4df6c1501ce42ce8669ed6e6473653d5 *inst/include/Rcpp/Light
7423a0c0e22f136a8cde2ee861349d13 *inst/include/Rcpp/Lighter
831f454f66395440e5c4b805917f2b9d *inst/include/Rcpp/Lightest
60b8862b777a3c9df3cf2ebd031b1fa3 *inst/include/Rcpp/Module.h
e54ff3fb24c5fb5c00e35804b4043177 *inst/include/Rcpp/Na_Proxy.h
30a357c1b1bf0a4b7b3c06aec6ac6891 *inst/include/Rcpp/Named.h
09c3d2e030266a2716c465005fddb8ad *inst/include/Rcpp/Nullable.h
355e849d93981b9ab17b965b1d79dab6 *inst/include/Rcpp/Pairlist.h
c299955262d228fc372294633ecb10a9 *inst/include/Rcpp/Promise.h
c7c202116cb2d8f9993f2d2879a48339 *inst/include/Rcpp/RNGScope.h
19d73d0c48066eab27b7e21f016aca39 *inst/include/Rcpp/RObject.h
7eaef3d46101154d1492c710f3cad3bf *inst/include/Rcpp/Rcpp
0708f78d2a5868bd0036bdffc92557eb *inst/include/Rcpp/Reference.h
c185e3eca4880197e5d2eb9dc8967402 *inst/include/Rcpp/Rmath.h
50e0c588180dfd77f8c516d708e0614a *inst/include/Rcpp/S4.h
b479ccd53c1917ce1140ee0a17bb3d21 *inst/include/Rcpp/StretchyList.h
3d953b8ddb44689beaf90a435dd26141 *inst/include/Rcpp/String.h
16eb3c24a812321d0c985c26ecb14e0b *inst/include/Rcpp/StringTransformer.h
4ae144e903ebcf2054f4a3ecb4430610 *inst/include/Rcpp/Symbol.h
e8984721738317caff337c1076b25cce *inst/include/Rcpp/Vector.h
eed9bf9af10a68be9cd55e5a5cdaa36a *inst/include/Rcpp/WeakReference.h
c84d37569cc5094df6e4c8600530d110 *inst/include/Rcpp/XPtr.h
2eff8a753ede96fbcf538eab9eb22889 *inst/include/Rcpp/algo.h
72757004433f52c06c4c7fd2bdb6c268 *inst/include/Rcpp/algorithm.h
3fa2caaea31d12b63d0a049c1da3c878 *inst/include/Rcpp/api/bones/Date.h
560684b180bc9eb1aaaf6f427ea97063 *inst/include/Rcpp/api/bones/Datetime.h
4d936b49167638e86368f4b8e26c13cc *inst/include/Rcpp/api/bones/bones.h
49f3c640f64681d80bfd2395309a4ddb *inst/include/Rcpp/api/bones/wrap_extra_steps.h
738de61f646f72b06810142fcb09af6f *inst/include/Rcpp/api/meat/DataFrame.h
80788c003d6b95f633d53db11b4c42e0 *inst/include/Rcpp/api/meat/Date.h
64e00680fbc6a82bbd1dd0e100e10673 *inst/include/Rcpp/api/meat/Datetime.h
13355fb54111f51930877bcddb41d50c *inst/include/Rcpp/api/meat/Dimension.h
26477794f8170b533113dcf620d64d1c *inst/include/Rcpp/api/meat/DottedPairImpl.h
006fb9ab61399d07b7f7bbd8ae6cf92f *inst/include/Rcpp/api/meat/Environment.h
963d8e4d71e666b2688f716a1f0697a3 *inst/include/Rcpp/api/meat/Rcpp_eval.h
a8b20b3c2b1e123172ab3a1eb78e04b0 *inst/include/Rcpp/api/meat/S4.h
9fd69c4ef0c1780784322f902305d1c7 *inst/include/Rcpp/api/meat/StretchyList.h
eded8a0a95dd5ecdcae8aa70aceb795c *inst/include/Rcpp/api/meat/Vector.h
a3e8a42322f0e644f1d6b6d4f55425e7 *inst/include/Rcpp/api/meat/as.h
f1b2b53b2851bbd3afb878ef3829f58f *inst/include/Rcpp/api/meat/export.h
cc1991e18d0c1d1e3470285fec935c36 *inst/include/Rcpp/api/meat/is.h
3ecf92371682f347f71c6da62730a05e *inst/include/Rcpp/api/meat/meat.h
b8b08db5250d9cd27130853ed04041bc *inst/include/Rcpp/api/meat/message.h
71c33d73cde9cdf7368627a9b00a8e7d *inst/include/Rcpp/api/meat/module/Module.h
d3e14b929d0b6cd092f52d1ced57b573 *inst/include/Rcpp/api/meat/protection.h
c9af45da88ea151bb2f8cd27900257e8 *inst/include/Rcpp/api/meat/proxy.h
12c775ee39ec274c4825219d25e04f43 *inst/include/Rcpp/api/meat/wrap.h
d6791dc3dda9eda2cd2afc16363e100b *inst/include/Rcpp/as.h
90c153091bc3fb1e123fef9dc40394e6 *inst/include/Rcpp/barrier.h
fa7b26bbe19f908b9c00ead2fe2717ac *inst/include/Rcpp/clone.h
1b3b2bee1fc9bd3f231c2a33ca572281 *inst/include/Rcpp/complex.h
31b71edd059c5fceaecde6634725613b *inst/include/Rcpp/config.h
b90e19134c5d4a4c0652f956c022d1e4 *inst/include/Rcpp/date_datetime/Date.h
e75130fc77dac6243e5c88639c940dea *inst/include/Rcpp/date_datetime/Datetime.h
0d754f1a9266c3e1bbc6946ba1304ab5 *inst/include/Rcpp/date_datetime/date_datetime.h
db56d4d2d82a3d6ae834d8157b0459e3 *inst/include/Rcpp/date_datetime/newDateVector.h
83d1e1f3e2fc38cf2708402b6baaeccd *inst/include/Rcpp/date_datetime/newDatetimeVector.h
eeaacae019fe68c8acbd3e9fbea29a3d *inst/include/Rcpp/date_datetime/oldDateVector.h
a2bcdcb2cc9e096bfb46106875462a13 *inst/include/Rcpp/date_datetime/oldDatetimeVector.h
659e600566ab5309c4fccd25cf2fa72c *inst/include/Rcpp/exceptions.h
0d70b3b0360363f0cb6852907697ba7a *inst/include/Rcpp/exceptions_impl.h
f15033c5a9a025e85b0d45f42e1ab29d *inst/include/Rcpp/grow.h
84979ae26a62cce0d5cbafadc0881be6 *inst/include/Rcpp/hash/IndexHash.h
4938607d51715323d159fe27c81c4935 *inst/include/Rcpp/hash/SelfHash.h
ce761de72f7730fe942b91e35e6b9ba6 *inst/include/Rcpp/hash/hash.h
3c1b55773be7d386bca01a99c8fa94af *inst/include/Rcpp/internal/Exporter.h
87298c0d130f4d0c2c9e3bcbf8f52712 *inst/include/Rcpp/internal/GreedyVector.h
ac0b994918191501b757516ce5ee263b *inst/include/Rcpp/internal/ListInitialization.h
589b5e7ef7ec36ea7c72c0989856322e *inst/include/Rcpp/internal/NAComparator.h
ddeb259fb4dc45ce8f48af5e7c67327a *inst/include/Rcpp/internal/NAEquals.h
a1cfd42face708ee13c1b82d72990024 *inst/include/Rcpp/internal/Proxy_Iterator.h
508bef1a3592104abdca03463b25432e *inst/include/Rcpp/internal/SEXP_Iterator.h
03e9f4da956cce7a1a74bf935ef5b001 *inst/include/Rcpp/internal/call.h
c90467fc1fb4213d562f14448ddd0485 *inst/include/Rcpp/internal/caster.h
1cc9fbe420c4d94a392fa41db6607f81 *inst/include/Rcpp/internal/converter.h
b9d757ae16cfbc67f30c82357831a90d *inst/include/Rcpp/internal/export.h
d75740f6c80130661e85ef0e8af6ef17 *inst/include/Rcpp/internal/na.h
2d6716a93c54ae524caab179db28206f *inst/include/Rcpp/internal/r_coerce.h
ced4d19ec0af39a1402abc9dfc772759 *inst/include/Rcpp/internal/r_vector.h
33c2e6704f43e1112be5eb98b3193e25 *inst/include/Rcpp/internal/wrap.h
14b302e7f5cca681f122cccde5418cbd *inst/include/Rcpp/internal/wrap_end.h
1914c43f5b9f93808062adf5e2c0a005 *inst/include/Rcpp/iostream/Rstreambuf.h
c852659f0876b4dd0a3d3d99e972d1cb *inst/include/Rcpp/is.h
24e8a8c1f4a580954091edb9dae2cfd9 *inst/include/Rcpp/lang.h
3fffc861f0e2426155bf5013ce173cb6 *inst/include/Rcpp/lgrow.h
ccf210a0d15b9bb2ed39b1b476997bbd *inst/include/Rcpp/longlong.h
4e9effca3c5f2dabaa4e6aa478b67528 *inst/include/Rcpp/macros/cat.hpp
623f4ca3111e4a28afe10133897a8f89 *inst/include/Rcpp/macros/config.hpp
ec19b90809bb03c920fa9d6df8af2732 *inst/include/Rcpp/macros/debug.h
e937eb94d20c4ba5899571364783864f *inst/include/Rcpp/macros/dispatch.h
32681ffdaa790b76bf3e20d3a6c17771 *inst/include/Rcpp/macros/interface.h
bf6d92385b7958959cb10a6b3bfd2a44 *inst/include/Rcpp/macros/macros.h
d305cbf316c4f54b670e13ff6e963101 *inst/include/Rcpp/macros/mask.h
3347bc9bf5c92bf9b929c61275c1714b *inst/include/Rcpp/macros/module.h
0c4f36da838e8571b7bc602b4b483295 *inst/include/Rcpp/macros/traits.h
acdd29c8bc3af4e20bbb733ab4bd7e74 *inst/include/Rcpp/macros/unroll.h
1762f3b08abffc14b677c9d4c0ee24d2 *inst/include/Rcpp/macros/xp.h
90f826d6b2719cd8b19266f7eed1d71b *inst/include/Rcpp/module/CppFunction.h
8d492c19d0746d6f0531a42ce62e4169 *inst/include/Rcpp/module/Module.h
1f282a0f0e1498bbe9f228dad9fdebfd *inst/include/Rcpp/module/Module_Add_Property.h
fd6ad1311c4cc5e0cffcc29722ca0f20 *inst/include/Rcpp/module/Module_Field.h
923ca9c389ce3dd672edcaa3f1e0fe6b *inst/include/Rcpp/module/Module_Property.h
12d7c007a282682b06c8bcff85c78972 *inst/include/Rcpp/module/class.h
b021df8570d99c4821e25c137aa45a01 *inst/include/Rcpp/module/class_Base.h
99322cf8421a1cc8964659b05d79a906 *inst/include/Rcpp/module/get_return_type.h
615592b33bb6633f54c088cba4503412 *inst/include/Rcpp/platform/compiler.h
8f9d3b2218818dfe5f703e6900d603e9 *inst/include/Rcpp/platform/solaris.h
e6f882c26076e813fe8290c46b1c0fd8 *inst/include/Rcpp/print.h
abd6c01295a88b73432a77f6a79aca3a *inst/include/Rcpp/protection/Armor.h
fa63d47f044e1012a5431319108f01f9 *inst/include/Rcpp/protection/Shelter.h
6357a773233c2c9f5415c6445fe103f9 *inst/include/Rcpp/protection/Shield.h
2fb2464623e39ad6040f4457b6ef382c *inst/include/Rcpp/protection/protection.h
0c80dfdd7ef10f4568c17fdbe70966cc *inst/include/Rcpp/proxy/AttributeProxy.h
d1800f7df6f83a017e0501af64551239 *inst/include/Rcpp/proxy/Binding.h
2767ffc2e7c0e7832e7223cd8da38be1 *inst/include/Rcpp/proxy/DottedPairProxy.h
59d09bb7d953413d5452a45616fca92f *inst/include/Rcpp/proxy/FieldProxy.h
bb4b32da96533b2cae35b524cf796d04 *inst/include/Rcpp/proxy/GenericProxy.h
09d53b49642f8c667c180d6fd9102164 *inst/include/Rcpp/proxy/NamesProxy.h
e6ffa94de4d38f34d9b363785fbdf1ff *inst/include/Rcpp/proxy/ProtectedProxy.h
0a75a348caecd8836340ca11be0435d7 *inst/include/Rcpp/proxy/RObjectMethods.h
17524947823b6cb35a45c5343c1818f6 *inst/include/Rcpp/proxy/SlotProxy.h
16583a2ce9f3f158d32a59bc69dc6045 *inst/include/Rcpp/proxy/TagProxy.h
5b3488834c9e483325dc45493deaf0d4 *inst/include/Rcpp/proxy/proxy.h
f014d5a7aab78a13e6b535a1f43c4e1d *inst/include/Rcpp/r/check_r_headers.h
0f03769521dac747e5a7094818315d10 *inst/include/Rcpp/r/compat.h
c96c074dfec5e25e0c300ffebc0665d2 *inst/include/Rcpp/r/headers.h
cbf7cf76e3800f05290b4c7fb8f8130b *inst/include/Rcpp/r_cast.h
0975231e8a827815b7cf027a56bd7fec *inst/include/Rcpp/routines.h
5c5eddabb61b11f1e2aa1dfd3b7dfcc6 *inst/include/Rcpp/sprintf.h
652b362ffc5b25dc354e2f94ccf775df *inst/include/Rcpp/stats/beta.h
830d809435ad6d90f513ceb19ed229ff *inst/include/Rcpp/stats/binom.h
de8f527ad087fd135d60496e83600129 *inst/include/Rcpp/stats/cauchy.h
28c835cdee1aa30eff6d7f6481a7c7b7 *inst/include/Rcpp/stats/chisq.h
2fcae848fbd39f938335de220dfceb56 *inst/include/Rcpp/stats/dpq/dpq.h
50246afd70a6c354111d21fef9a61454 *inst/include/Rcpp/stats/dpq/macros.h
2a0a10252c313fa1101c426a71f419b3 *inst/include/Rcpp/stats/exp.h
16b8c2b35aa2dd1acd61aea749bea591 *inst/include/Rcpp/stats/f.h
3531db9168652e50f1a2f7e48995e652 *inst/include/Rcpp/stats/gamma.h
259484f02f4b70c75f061eb3acebc68b *inst/include/Rcpp/stats/geom.h
cddc6f8806bbff126f43aad6d9f64225 *inst/include/Rcpp/stats/hyper.h
afbc488e006d43bbb44f00b39bdc9279 *inst/include/Rcpp/stats/lnorm.h
0148fa77627fc2649b4cc8fda21ff2cf *inst/include/Rcpp/stats/logis.h
2f20232d49ad4e0d5aa4affe29a83677 *inst/include/Rcpp/stats/nbeta.h
255732d79d848b5ef2dc23a0bb020c78 *inst/include/Rcpp/stats/nbinom.h
b648f374ad9b409f3a693cb13d2dacf2 *inst/include/Rcpp/stats/nbinom_mu.h
792ff5b69094be8d30a61da005e8b8a2 *inst/include/Rcpp/stats/nchisq.h
4285fba50176e606b3183e550ca57008 *inst/include/Rcpp/stats/nf.h
62bcbc788f700bb418899f2d5d71674e *inst/include/Rcpp/stats/norm.h
b9bb0937015e9915c9eed07d7d5e675e *inst/include/Rcpp/stats/nt.h
ee8d82efa40767e1ee30b1b39f0d2b9b *inst/include/Rcpp/stats/pois.h
bd6f29269c4cb5e0714c7eb14497dd24 *inst/include/Rcpp/stats/random/random.h
6be67d92344ae4ffe85a2d4a966c5712 *inst/include/Rcpp/stats/random/rbeta.h
cdc109dfaa7c849fe8f5108a8157286e *inst/include/Rcpp/stats/random/rbinom.h
2fe775c698a801f71c81d958ff2153bf *inst/include/Rcpp/stats/random/rcauchy.h
09e49a79928fba558003e949f7e42625 *inst/include/Rcpp/stats/random/rchisq.h
eb7d8d8957f95e55c7b4c883d07bde3e *inst/include/Rcpp/stats/random/rexp.h
796f003192b271cfd01be89f08fc5857 *inst/include/Rcpp/stats/random/rf.h
d3f7b0de54bbff91a52b5f3e97b6f0f9 *inst/include/Rcpp/stats/random/rgamma.h
f30537d903fd0e2fe0b8fbde1ad0f448 *inst/include/Rcpp/stats/random/rgeom.h
ef335473c41b8bf22c2ed8ead3d02802 *inst/include/Rcpp/stats/random/rhyper.h
812d6f54e228aa74586d4494462dc308 *inst/include/Rcpp/stats/random/rlnorm.h
e19c5aac4d1e6f05fb215da8ab9abd63 *inst/include/Rcpp/stats/random/rlogis.h
8401528e0344ac91e8a59d3c75ea3811 *inst/include/Rcpp/stats/random/rnbinom.h
da102c578dc03d90e134bc716ce86061 *inst/include/Rcpp/stats/random/rnbinom_mu.h
281fe24171a0dc1a2f5d32b792b29840 *inst/include/Rcpp/stats/random/rnchisq.h
d11f94b30bfe73bec96e494c19010112 *inst/include/Rcpp/stats/random/rnorm.h
68c0bc9a9bf8adf587cfafec41f2e0c3 *inst/include/Rcpp/stats/random/rpois.h
22c48598462a7a67f7c46f827a7ca37b *inst/include/Rcpp/stats/random/rsignrank.h
6d053ab00aee5507bdcd37b260edb2ca *inst/include/Rcpp/stats/random/rt.h
e4157ac1a6474db7d023ed619f8a3911 *inst/include/Rcpp/stats/random/runif.h
0de983b302b5686c55cf1348856736f2 *inst/include/Rcpp/stats/random/rweibull.h
9d96c7c693ee9ee2be41a02aca2c907c *inst/include/Rcpp/stats/random/rwilcox.h
d5e57758623ecb887417b652e9dbe431 *inst/include/Rcpp/stats/stats.h
51dea0f553fe2661ebbf069bba1c6fab *inst/include/Rcpp/stats/t.h
72600819bbbb51028983e81c6623f47f *inst/include/Rcpp/stats/unif.h
edcd15051fead7e65a02fe4848ec5969 *inst/include/Rcpp/stats/weibull.h
b19248e3d1ba5159604ee91bc499fbe0 *inst/include/Rcpp/storage/NoProtectStorage.h
0f0750ca5166fbea1a202f3a74e94579 *inst/include/Rcpp/storage/PreserveStorage.h
4bfc6bf68fd92addd39ad5eabe987ccd *inst/include/Rcpp/storage/storage.h
6d4b5fd0017b129f89731c3af6f63545 *inst/include/Rcpp/sugar/Range.h
be07b75cd41bf643098bf8dc9f6fd6bd *inst/include/Rcpp/sugar/block/SugarBlock_1.h
93914f21ce2678a075f440256bff7256 *inst/include/Rcpp/sugar/block/SugarBlock_2.h
b38058d7f4161d552c59199d971759d2 *inst/include/Rcpp/sugar/block/SugarBlock_3.h
77631c6ccb9bf7900cc3e9870308f15e *inst/include/Rcpp/sugar/block/SugarMath.h
0b04c68170924e36a049448bb9dffbcf *inst/include/Rcpp/sugar/block/Vectorized_Math.h
b303e234459f72118cdb77b5fc6c40d2 *inst/include/Rcpp/sugar/block/block.h
8989b1fc88898a94d028256afd535218 *inst/include/Rcpp/sugar/functions/Lazy.h
332e143da726e96aa5342a2d379ad888 *inst/include/Rcpp/sugar/functions/all.h
be21eae934bd2eb08c36aa98a95f8437 *inst/include/Rcpp/sugar/functions/any.h
2034cef020d507b44a56287085f01b03 *inst/include/Rcpp/sugar/functions/cbind.h
356ce7a62fd40bfb5c99f5d90ceab9c8 *inst/include/Rcpp/sugar/functions/clamp.h
006ff253f5119766397ae8786b6f3273 *inst/include/Rcpp/sugar/functions/complex.h
8c48d64608f50fd65a1060eb0ba0a94f *inst/include/Rcpp/sugar/functions/cummax.h
676a6d35542c22993a733ac9ca7f4557 *inst/include/Rcpp/sugar/functions/cummin.h
d48484d2c5885e5132dae2c5360cc003 *inst/include/Rcpp/sugar/functions/cumprod.h
b5875c167cebe51528173279a35e1c80 *inst/include/Rcpp/sugar/functions/cumsum.h
d9339ceea3657d0eebffff3c4fc19ade *inst/include/Rcpp/sugar/functions/diff.h
e89b6f5086b49094e87a58183226c37e *inst/include/Rcpp/sugar/functions/duplicated.h
ee8361b3d041e25bf9dd142b2b6809db *inst/include/Rcpp/sugar/functions/functions.h
8a1d27971f10c32f1c2dbc2441c47797 *inst/include/Rcpp/sugar/functions/head.h
71a232c26d62819d7752cbd198ccd471 *inst/include/Rcpp/sugar/functions/ifelse.h
e6be4a52d004d3d7cdf4577c03bc0ad6 *inst/include/Rcpp/sugar/functions/is_finite.h
29a018bc6da09bea93392ac25e4c5ff6 *inst/include/Rcpp/sugar/functions/is_infinite.h
e04f27b0d6d0902fd507b0c8a6c1ab6f *inst/include/Rcpp/sugar/functions/is_na.h
905bd30e93c3bfea935a665f6e8eeecf *inst/include/Rcpp/sugar/functions/is_nan.h
d344320200af69792cc4b6c3f864ecd4 *inst/include/Rcpp/sugar/functions/lapply.h
e17dd7603ed04900df60d381e1f8a117 *inst/include/Rcpp/sugar/functions/mapply.h
161a75d06f3022693b9f6e75e091afd2 *inst/include/Rcpp/sugar/functions/mapply/mapply_2.h
49377a45cc5faf0a8bf6258e84dc0d89 *inst/include/Rcpp/sugar/functions/mapply/mapply_3.h
ab7b9d24e77fe2dc072077714933d59d *inst/include/Rcpp/sugar/functions/match.h
747824a9e7823288ba51af113ed9af50 *inst/include/Rcpp/sugar/functions/math.h
e1d5c777461b843bc04bec8b3c4f6787 *inst/include/Rcpp/sugar/functions/max.h
bf3fb31ed2cfec71483f5cf92a6b3ff8 *inst/include/Rcpp/sugar/functions/mean.h
e7ddf543af82118e4774aab3f2e63271 *inst/include/Rcpp/sugar/functions/median.h
17f81f3f0fb3cc04341371ab641ff46a *inst/include/Rcpp/sugar/functions/min.h
55ea8f9269403a501d18d47198f997ef *inst/include/Rcpp/sugar/functions/na_omit.h
fe272f9c21bb17980bdb2efffd7a7f1c *inst/include/Rcpp/sugar/functions/pmax.h
7bd993f789e126017b34ff9858bd915a *inst/include/Rcpp/sugar/functions/pmin.h
ae74c9114eec986e67ecab7ea08d401c *inst/include/Rcpp/sugar/functions/pow.h
a1f5d8e23763f3e16039b32589131aaa *inst/include/Rcpp/sugar/functions/range.h
1646622d8ec6731c53b7d74292906c43 *inst/include/Rcpp/sugar/functions/rep.h
73bfa7e84c00ac5badd0306336c93330 *inst/include/Rcpp/sugar/functions/rep_each.h
cb49753448b25c3cd6498bfbbae3c8de *inst/include/Rcpp/sugar/functions/rep_len.h
5524927f94bb2c48f81cf050d5548e3d *inst/include/Rcpp/sugar/functions/rev.h
e780762055db29b8108b020f605729a2 *inst/include/Rcpp/sugar/functions/rowSums.h
e81e6ae804c78e169d9689df7843f20e *inst/include/Rcpp/sugar/functions/sample.h
08751fd161cfd28c0c3c6003dea07f80 *inst/include/Rcpp/sugar/functions/sapply.h
f964dafa72508e308f9ff057c577c49e *inst/include/Rcpp/sugar/functions/sd.h
f415faaadd4de7ee8cd9f69ceb546a92 *inst/include/Rcpp/sugar/functions/self_match.h
4723c52a2e6ffcb5a99bbf5f120f0e1f *inst/include/Rcpp/sugar/functions/seq_along.h
d96689dfed6e69bd91948b49aacbf448 *inst/include/Rcpp/sugar/functions/setdiff.h
d5a5b9a9b75d93f355534de01dc6ca07 *inst/include/Rcpp/sugar/functions/sign.h
148a1f4a4a0017f7c5520a4a44441fe8 *inst/include/Rcpp/sugar/functions/strings/collapse.h
6a4ca421d9353d551e3454c3c7ba6b00 *inst/include/Rcpp/sugar/functions/strings/strings.h
5f405963ec4bd5cbcc470285814ee796 *inst/include/Rcpp/sugar/functions/strings/trimws.h
fa6996110472311d86217245a4817e28 *inst/include/Rcpp/sugar/functions/sum.h
5ebb5010a39d3135d9797576f92c8256 *inst/include/Rcpp/sugar/functions/table.h
6aece98287f5b416b1b9dde8258b7ba3 *inst/include/Rcpp/sugar/functions/tail.h
3714352196527f3eb1911d7dfeda0925 *inst/include/Rcpp/sugar/functions/unique.h
6af0ed03b22ab5376164eeca35d27830 *inst/include/Rcpp/sugar/functions/var.h
a21e2d861c3e1641d451e8542ac90da7 *inst/include/Rcpp/sugar/functions/which_max.h
cb63e9ae52933534b47e4b03b3345d10 *inst/include/Rcpp/sugar/functions/which_min.h
1f232e3aea101e0a7a967b292f5fee3e *inst/include/Rcpp/sugar/logical/SingleLogicalResult.h
633aaf9fd410363a0816ee14ea0756fe *inst/include/Rcpp/sugar/logical/and.h
fa170788a69bc85fcb1ead3c8e3d8d61 *inst/include/Rcpp/sugar/logical/can_have_na.h
ea316f6c93309fb814bcba060b4243c5 *inst/include/Rcpp/sugar/logical/is.h
349f08cf81f52ed760ecd4dedd472443 *inst/include/Rcpp/sugar/logical/logical.h
c848c2c54466ce13e842fff36b33cbfe *inst/include/Rcpp/sugar/logical/not.h
ceda7f41514004d0f41a0a25df616480 *inst/include/Rcpp/sugar/logical/or.h
16fbabf279bea866b7a9241084d582dc *inst/include/Rcpp/sugar/matrix/as_vector.h
22dce70c24a72d954c9c0ddb637a87af *inst/include/Rcpp/sugar/matrix/col.h
1efcfad1b72aac3ab68857be3a0578da *inst/include/Rcpp/sugar/matrix/diag.h
2ce9df0e2282b1780d168cdaec70e501 *inst/include/Rcpp/sugar/matrix/lower_tri.h
ac84cad78d201a054f8d7df13a6b1353 *inst/include/Rcpp/sugar/matrix/matrix_functions.h
fd9bd47cec790c2604a4987472eec0e1 *inst/include/Rcpp/sugar/matrix/outer.h
5d698479a84a2e019271ca70556478eb *inst/include/Rcpp/sugar/matrix/row.h
115b6149b7f328f12440fd1e5a5a0300 *inst/include/Rcpp/sugar/matrix/tools.h
23f94c2d6cbd068312a949798b403467 *inst/include/Rcpp/sugar/matrix/upper_tri.h
30973622e9d3acef832c7e2578e0ddd0 *inst/include/Rcpp/sugar/nona/nona.h
278c96c59d33653b53db01862911a17d *inst/include/Rcpp/sugar/operators/Comparator.h
6c43390b2d47dd6b7d2bb7824d37061b *inst/include/Rcpp/sugar/operators/Comparator_With_One_Value.h
c62f193c49b200ee28687469fb2e61c5 *inst/include/Rcpp/sugar/operators/divides.h
dbc2f27e6693976f7e1d745db791b712 *inst/include/Rcpp/sugar/operators/logical_operators__Vector__Vector.h
631ba1c3a5983fa36aba958fbe0fac01 *inst/include/Rcpp/sugar/operators/logical_operators__Vector__primitive.h
57b8e523981ced17043df0a35db0503c *inst/include/Rcpp/sugar/operators/minus.h
ce6f7cfa18cfcafb15ebd8eb8c45f802 *inst/include/Rcpp/sugar/operators/not.h
da8a2c17103b00aeb0d205f76aaebf7d *inst/include/Rcpp/sugar/operators/operators.h
2e6171e8d4ed6c21710aa0758e7f0536 *inst/include/Rcpp/sugar/operators/plus.h
d129eac323c93bb69d99b023eb05812d *inst/include/Rcpp/sugar/operators/r_binary_op.h
73722dc109290c63d68934f52637d27b *inst/include/Rcpp/sugar/operators/times.h
5f9acbfddd1c397b017cfd5691293bb4 *inst/include/Rcpp/sugar/operators/unary_minus.h
6c85f88e633df848747b28705f12419a *inst/include/Rcpp/sugar/sets.h
813ff968a963e3058a58c469e070ef82 *inst/include/Rcpp/sugar/sugar.h
89a193bed15037ce566fefe07f049d4b *inst/include/Rcpp/sugar/sugar_forward.h
b4c3ecdf94025da94e6dde6eeafe8a44 *inst/include/Rcpp/sugar/tools/iterator.h
eef4393e7017df25a06712305be6232d *inst/include/Rcpp/sugar/undoRmath.h
894245a3f8d5c212ab9c808662c22160 *inst/include/Rcpp/traits/char_type.h
d39c02a1033bce9b1193f12eee141171 *inst/include/Rcpp/traits/enable_if.h
4a72487b73047f686e868b4c4cb44382 *inst/include/Rcpp/traits/expands_to_logical.h
129c2e9c6e0a73fce5cebd72c14c2254 *inst/include/Rcpp/traits/get_na.h
e20649d25657d2a949492331c7758b7c *inst/include/Rcpp/traits/has_iterator.h
235a43df43936d00128253ef7005915c *inst/include/Rcpp/traits/has_na.h
3cd036e8adc3672b90bf08504e9f7a76 *inst/include/Rcpp/traits/if_.h
fe6ce0c1245797c031830f9efc2180eb *inst/include/Rcpp/traits/index_sequence.h
f6618d0224159bfc48c1df1d83828d68 *inst/include/Rcpp/traits/init_type.h
569027e71fdb2bda19c8184a12d08762 *inst/include/Rcpp/traits/integral_constant.h
6eb1fc7443352426923660525040b98b *inst/include/Rcpp/traits/is_arithmetic.h
29571f5642930d175ef873140c776975 *inst/include/Rcpp/traits/is_bool.h
4fa497cea2410fb4e662b866663bc0ac *inst/include/Rcpp/traits/is_const.h
abcb7e2b556b94d82a09a8849a1c1096 *inst/include/Rcpp/traits/is_convertible.h
cd901317f51083b5a6d3f2414fe82607 *inst/include/Rcpp/traits/is_eigen_base.h
7bfb288fca1e46ed6b931500ad42a43d *inst/include/Rcpp/traits/is_finite.h
b7587e1b4122a84038f7a5800b535e8e *inst/include/Rcpp/traits/is_infinite.h
abd4686b93894a8a221f6da4f3bf74f0 *inst/include/Rcpp/traits/is_module_object.h
d97fd982b65ea3d8efc6455b3b1e8102 *inst/include/Rcpp/traits/is_na.h
60122e02e5bb562e557db0c38e17f790 *inst/include/Rcpp/traits/is_nan.h
b4d4b4ecdcc75f7004378d9a4c52c490 *inst/include/Rcpp/traits/is_pointer.h
74d6de2afc81c98a4e34fb368aea6a53 *inst/include/Rcpp/traits/is_primitive.h
2a7ce1cf1b5479b6453c7c28d346bcfa *inst/include/Rcpp/traits/is_reference.h
5e2acd97071b71e05d9b11a3f96387e5 *inst/include/Rcpp/traits/is_sugar_expression.h
28916414af7cdb5b5bf9673bffe3fed8 *inst/include/Rcpp/traits/is_trivial.h
2aa827ff4a611723f8fda7e58c9225d7 *inst/include/Rcpp/traits/is_wide_string.h
738e632a612038e6be1baafb8936d5dd *inst/include/Rcpp/traits/longlong.h
d2d2d22f014dbda73370de85977494be *inst/include/Rcpp/traits/matrix_interface.h
4165bd63dd3b616e807d730a1909b1d6 *inst/include/Rcpp/traits/module_wrap_traits.h
e19d74e319b8af6cbaeb1516a81435c5 *inst/include/Rcpp/traits/named_object.h
e9717cf30ad078a3722702d54d744b11 *inst/include/Rcpp/traits/num2type.h
fda43f65172234cb8e672b725ff21dc3 *inst/include/Rcpp/traits/one_type.h
3ab68cc3b397346dde5c071d6b1dc2ca *inst/include/Rcpp/traits/r_sexptype_traits.h
9f83f99113b796b5b37668e395f07ec8 *inst/include/Rcpp/traits/r_type_traits.h
2c55008e8515714263346d6c3cdeb35c *inst/include/Rcpp/traits/remove_const.h
0830e491fc6a03ab6c735a215fa70ee0 *inst/include/Rcpp/traits/remove_const_and_reference.h
49e7441fad045085e944a89c2b6d2f14 *inst/include/Rcpp/traits/remove_reference.h
ae9eded0d6af8b91bda4e91d7e8c47ce *inst/include/Rcpp/traits/result_of.h
10df0fad7bfeca54513814e89fd28d60 *inst/include/Rcpp/traits/same_type.h
9091fcb005196d81ed41c6a89550e89a *inst/include/Rcpp/traits/storage_type.h
6ffcd9b3ae200cb9f82bf43df519f3a4 *inst/include/Rcpp/traits/traits.h
3d6fc7e388a23053d99a353535ae1275 *inst/include/Rcpp/traits/un_pointer.h
8f92942349c07f0032f5715822387218 *inst/include/Rcpp/traits/wrap_type_traits.h
c858d22e58939329e5fe3e10c6e61471 *inst/include/Rcpp/unwindProtect.h
fadece0229ef4ff741cfa4c0c42b6c1b *inst/include/Rcpp/utils/tinyformat.h
dedbf46dfae724476eedb59622b6c0be *inst/include/Rcpp/utils/tinyformat/tinyformat.h
89a07678f678cfb48de4bd3d4420ea64 *inst/include/Rcpp/vector/00_forward_Vector.h
4fe970f8b2608fb97026142528d21518 *inst/include/Rcpp/vector/00_forward_proxy.h
411c3c52a0011d4fdd9392637172a97d *inst/include/Rcpp/vector/ChildVector.h
d4c4878eede03e50c776afcf7836fc7a *inst/include/Rcpp/vector/DimNameProxy.h
47f675c64171ec8e4072036d972aad4f *inst/include/Rcpp/vector/LazyVector.h
020c11693ef729783f6ce9c70e0b3a86 *inst/include/Rcpp/vector/ListOf.h
bd73507d75d9178924fc00b70b1f6f55 *inst/include/Rcpp/vector/Matrix.h
a6c5cdec475185adc2b61152bc9379de *inst/include/Rcpp/vector/MatrixBase.h
fea18a15ac16177399b74b3aba1e8d3c *inst/include/Rcpp/vector/MatrixColumn.h
410f8a433cea0b58017e10edcdd520d7 *inst/include/Rcpp/vector/MatrixRow.h
dabec153dcf826b040e592e1c60fc37f *inst/include/Rcpp/vector/RangeIndexer.h
31372a9f3d172f4e9df62c559ff1ad66 *inst/include/Rcpp/vector/SubMatrix.h
282fcdbb1720184e46ec0224de57a500 *inst/include/Rcpp/vector/Subsetter.h
9d25f64b0f151e2237df2f51357197d9 *inst/include/Rcpp/vector/Vector.h
99dc1e7a939e6f11ec33588c382517cd *inst/include/Rcpp/vector/VectorBase.h
0c3ff20020b3ff5248826ff796752946 *inst/include/Rcpp/vector/const_generic_proxy.h
c76a4bfbaf1c61171799f258f6393ea4 *inst/include/Rcpp/vector/const_string_proxy.h
82421a927c857b34a028774399518289 *inst/include/Rcpp/vector/converter.h
fe60090372703d0fd887c32e45f944a3 *inst/include/Rcpp/vector/generic_proxy.h
026adf34a827731798dbf3b6c3159421 *inst/include/Rcpp/vector/instantiation.h
8bfaa9746b1126a74324cab8b5170439 *inst/include/Rcpp/vector/no_init.h
b663084f53367a6f682ce0466e707af8 *inst/include/Rcpp/vector/proxy.h
86af06f9720947eaa083c4fa9bc11289 *inst/include/Rcpp/vector/string_proxy.h
07c9204ef548fd66d5e42ff84cf1da09 *inst/include/Rcpp/vector/swap.h
ea2eb551ebe2a0dbe31b89ff4d48b082 *inst/include/Rcpp/vector/traits.h
b53a80ae2aa1de12e8bd0fbff69c904b *inst/include/Rcpp/vector/vector_from_string.h
c156d485c87128d54fa2a916e214cd00 *inst/include/RcppCommon.h
83051c918c676565c50377280f3d80a9 *inst/include/doxygen/Examples.h
fc570e7927219c2ed9bdb13ca05134d9 *inst/prompt/module.Rd
e78047bdda3db5af33456370e65a98d0 *inst/skeleton/Num.cpp
ceccb01282e3e574aa78fec0102df6da *inst/skeleton/Rcpp_modules_examples.Rd
519be498e2f048a2750863a147964737 *inst/skeleton/manual-page-stub.Rd
411d02aaf3c409722bf6a39a4a4ffa90 *inst/skeleton/rcpp_hello_world.R
736db59264020d28cb1870868cfa916b *inst/skeleton/rcpp_hello_world.Rd
329380236bdae3a32e349531c0ee2d54 *inst/skeleton/rcpp_hello_world.cpp
2c1227dd8097d9fca8040f3d29f59633 *inst/skeleton/rcpp_hello_world.h
0da63b615f705aa9dfa2e91b15a0ec3a *inst/skeleton/rcpp_hello_world_attributes.cpp
9cbc66836028cfab4df53c8e1c4ccbf5 *inst/skeleton/rcpp_module.cpp
87e64fbfae8826697bdfd1020d2b2641 *inst/skeleton/stdVector.cpp
619d044f9421261f102a1ba29684ea85 *inst/skeleton/zzz.R
7fb9967c5d48052f8dc6167b1ee619d3 *inst/tinytest/bin/amd64/r-cran-testrcpppackage_0.1.0-1_amd64.deb
56b8f712e86e0113715ead494065346e *inst/tinytest/bin/i386/r-cran-testrcpppackage_0.1.0-1_i386.deb
08aa53008c9d0b88446c534cbf91a165 *inst/tinytest/cpp/DataFrame.cpp
caded512e0425b790380edddc00967f4 *inst/tinytest/cpp/Environment.cpp
378c5ca02f76666d28abc7f0f0bbb82a *inst/tinytest/cpp/Exceptions_nocall.cpp
b81bf018da788eadaf8f101144e1841b *inst/tinytest/cpp/Function.cpp
ca3ce6364c578acf0542617cb09505d1 *inst/tinytest/cpp/InternalFunction.cpp
a9b57d92bffc646ac6f074c98c81db6e *inst/tinytest/cpp/InternalFunctionCPP11.cpp
62bd3687f6fae5f022287932343b34b0 *inst/tinytest/cpp/ListOf.cpp
4592f91b2ff1a6cea2125115ce8f75e4 *inst/tinytest/cpp/Matrix.cpp
c171e3f43d4293bcfb4341cdc1c2bd29 *inst/tinytest/cpp/Module.cpp
ae344d14e4a2711ff2462d02ac0baa78 *inst/tinytest/cpp/RObject.cpp
83bb109ce6845fbdb08a732527556ff1 *inst/tinytest/cpp/Reference.cpp
431733375a744f92c308b95f9d402f42 *inst/tinytest/cpp/S4.cpp
239bf07c23051fc0318de2f80e95385c *inst/tinytest/cpp/String.cpp
bf2f556311ef8884928d6db63fccf112 *inst/tinytest/cpp/Subset.cpp
8f85f4c4b8fd6f3456224ce8c7812ca5 *inst/tinytest/cpp/Vector.cpp
2834dfe1270c0e1cc24aba14721c09da *inst/tinytest/cpp/VectorOld.cpp
aa3497bfcf9b9d14f35e9558a19fc1b4 *inst/tinytest/cpp/XPtr.cpp
d19479e6aab83b12124389782f4bf739 *inst/tinytest/cpp/algorithm.cpp
219e1d71106fb3bb1253ce60affbb398 *inst/tinytest/cpp/as.cpp
12c4f9c7f7323095f118fc9c11ace5da *inst/tinytest/cpp/attributes.cpp
7dd5700e27b702cba4cede554cdb65ba *inst/tinytest/cpp/attributes.hpp
fdf3557dcb7e7fbaa37afcbfaba4b088 *inst/tinytest/cpp/coerce.cpp
0644a8cbc3598636082eb8caf23408c0 *inst/tinytest/cpp/dates.cpp
9c81ac1fb25a970b84e543aef34d6cde *inst/tinytest/cpp/dispatch.cpp
385abbb997641176de511ef784b87b45 *inst/tinytest/cpp/embeddedR.cpp
3142234408f0d17bb7edd2238f6beb78 *inst/tinytest/cpp/embeddedR2.cpp
4e6b3693278fd9c33e5fc7724e268fa8 *inst/tinytest/cpp/exceptions.cpp
6e824ef93678e96b63e8dc314a86abb4 *inst/tinytest/cpp/language.cpp
cdd742bd240621d7e33ecf4818691e66 *inst/tinytest/cpp/misc.cpp
31eb0032506e988316357913ffc28dee *inst/tinytest/cpp/modref.cpp
705309cd5376196a486d14c73f76ba29 *inst/tinytest/cpp/na.cpp
05a686ca3070780f8dcb1a1de321797e *inst/tinytest/cpp/rcppversion.cpp
511f2da216d7480c3bd4b50d48983799 *inst/tinytest/cpp/rmath.cpp
c5a73e2af15b06c0d82cc9232cbed0e8 *inst/tinytest/cpp/stack.cpp
37f1770bce35bf5f2c6a523d42e1ea75 *inst/tinytest/cpp/stats.cpp
3d7f876183e254bcbe9ac4197a1cded6 *inst/tinytest/cpp/sugar.cpp
956e39fb6eb566987b3130a85b4da3c6 *inst/tinytest/cpp/support.cpp
c8a357d67dd56b672cd7616e7bbbf520 *inst/tinytest/cpp/table.cpp
9d9ca2312b72c753d9c6f787bf455540 *inst/tinytest/cpp/wrap.cpp
2db3a044a68e8cf5d76a9a1473dee526 *inst/tinytest/cpp/wstring.cpp
54073056db0ba60cf0b1707c4b6db85c *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1.diff.gz
1d2156181f8816c31306d77f4760697c *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1.dsc
18c540b0b12feac586f57f2411ed378e *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_amd64.changes
7fb9967c5d48052f8dc6167b1ee619d3 *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_amd64.deb
84ddc3de28ce0c458d6f19f91bc1710d *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_i386.changes
56b8f712e86e0113715ead494065346e *inst/tinytest/src/r-cran-testrcpppackage_0.1.0-1_i386.deb
7263661801b44d075a3345ff4a1faffa *inst/tinytest/testRcppAttributePackage/DESCRIPTION
f06e063ca806e7fca22eb7482b2af2d1 *inst/tinytest/testRcppAttributePackage/NAMESPACE
c694664176af9bd21deb0248fdddbe7e *inst/tinytest/testRcppAttributePackage/src/rcpp_test.cpp
1a5f53d4b6ba9e3b98fe1eec48a5eb9b *inst/tinytest/testRcppClass/DESCRIPTION
f926317ac3486e08433a0fbdf3153efe *inst/tinytest/testRcppClass/NAMESPACE
03f336c9faea79524a608b9dd1d22a92 *inst/tinytest/testRcppClass/R/load.R
ec8250809d340e191fbf0b04c344fe00 *inst/tinytest/testRcppClass/R/rcpp_hello_world.R
60b39ca81dc918e7fe8a0c4737079396 *inst/tinytest/testRcppClass/man/Rcpp_class_examples.Rd
736db59264020d28cb1870868cfa916b *inst/tinytest/testRcppClass/man/rcpp_hello_world.Rd
fe2b352c0aa449acae8ae667b82aebb9 *inst/tinytest/testRcppClass/man/testRcppClass-package.Rd
5b71e6b5e64bc8418e6b9adf26c09cc8 *inst/tinytest/testRcppClass/src/Num.cpp
45a1446cd51cdbaf9b5833141da93b42 *inst/tinytest/testRcppClass/src/init.c
5e17501af84c7deb94e69c8c48abc6dc *inst/tinytest/testRcppClass/src/rcpp_hello_world.cpp
5c03d3d1426cf6886a0f6f6c412bb456 *inst/tinytest/testRcppClass/src/rcpp_hello_world.h
0abb0d55f1edc5ddb19ca87ed5c370f1 *inst/tinytest/testRcppClass/src/rcpp_module.cpp
3326bf4e52a561d08f9aa1370333222b *inst/tinytest/testRcppClass/src/stdVector.cpp
f369e8eabd84792764737850dc9cf599 *inst/tinytest/testRcppClass/tests/classes.R
55a2cc182d8bdab7df8367bb2c9ae4f1 *inst/tinytest/testRcppInterfaceExporter/DESCRIPTION
caccac1441b38bc3b9d91f9e189b1d68 *inst/tinytest/testRcppInterfaceExporter/NAMESPACE
052892f806ecd5542358fd7ae3bb58d9 *inst/tinytest/testRcppInterfaceExporter/R/RcppExports.R
f9c87d177bece784bca40b2294329568 *inst/tinytest/testRcppInterfaceExporter/R/exporter.R
cdb9489e21b94623f0f1e7d4af8ec157 *inst/tinytest/testRcppInterfaceExporter/inst/include/testRcppInterfaceExporter.h
1cbd306e27aed3fcb7b5fbc34d42b39d *inst/tinytest/testRcppInterfaceExporter/inst/include/testRcppInterfaceExporter_RcppExports.h
529c420ba10980a79340b06638fac353 *inst/tinytest/testRcppInterfaceExporter/src/RcppExports.cpp
0805a3830147dedf4a37a91f9ad66a4d *inst/tinytest/testRcppInterfaceExporter/src/exporter.cpp
53dfff77ccb443103f44fb52eea3187b *inst/tinytest/testRcppInterfaceExporter/src/unwound.h
d4ceb27b690d25e3bf791340e1082ede *inst/tinytest/testRcppInterfaceUser/DESCRIPTION
98aef5f5fafb61bfb9c2e3687ea7cd74 *inst/tinytest/testRcppInterfaceUser/NAMESPACE
a7632eb2a8e768dc6305ac25e4d1c666 *inst/tinytest/testRcppInterfaceUser/R/user.R
d41d8cd98f00b204e9800998ecf8427e *inst/tinytest/testRcppInterfaceUser/src/config.h
a195376bccd32edf2ec234585cdd19f1 *inst/tinytest/testRcppInterfaceUser/src/unwound.h
44a229bee1d2fd44365e82d64aff2e23 *inst/tinytest/testRcppInterfaceUser/src/user.cpp
255c21e7555c2f1c172eea38e3b72999 *inst/tinytest/testRcppInterfaceUser/tests/tests.R
fb4466d7edc9f03ab23dc0d557e49145 *inst/tinytest/testRcppModule/DESCRIPTION
add4aaed2d306765ce493922461f3a55 *inst/tinytest/testRcppModule/NAMESPACE
bd40b50ea592b9c3c0cfe79de3f6eb1d *inst/tinytest/testRcppModule/R/rcpp_hello_world.R
30f26d465cc860eff08cd47a816fdd27 *inst/tinytest/testRcppModule/R/zzz.R
0371f14c3812cd1a564488ca96b11ca2 *inst/tinytest/testRcppModule/man/Rcpp_modules_examples.Rd
2deeefcb97dc4727ba42f47594ad3be8 *inst/tinytest/testRcppModule/man/rcpp_hello_world.Rd
079d3f03a16107fd9ef8fe40b6175a9e *inst/tinytest/testRcppModule/man/testRcppModule-package.Rd
1999f8a3ad18e75c899c980902146d80 *inst/tinytest/testRcppModule/src/Num.cpp
d1c8b83cdba82518ad248f4612e22802 *inst/tinytest/testRcppModule/src/init.c
5e17501af84c7deb94e69c8c48abc6dc *inst/tinytest/testRcppModule/src/rcpp_hello_world.cpp
5c03d3d1426cf6886a0f6f6c412bb456 *inst/tinytest/testRcppModule/src/rcpp_hello_world.h
30f4072a33ca51c385cba14d8c41e7fc *inst/tinytest/testRcppModule/src/rcpp_module.cpp
974ce7cbf35e70ee51ee2f338d1a47ed *inst/tinytest/testRcppModule/src/stdVector.cpp
af70d56c91a91ed55fc4da6c1f8b7ca5 *inst/tinytest/testRcppModule/tests/modules.R
c83d5e7e43bdf9d149e62f8717facf73 *inst/tinytest/testRcppPackage/DESCRIPTION
f46e0bbc90d649eaed05e1a1f953645d *inst/tinytest/testRcppPackage/NAMESPACE
86700d82a2395c2d7c34f21ffb7dcaa4 *inst/tinytest/testRcppPackage/R/rcpp_hello_world.R
8a4012c68853de0e7ddd4ec8dd3ef9da *inst/tinytest/testRcppPackage/man/testRcppPackage-package.Rd
c980624db12b714ac2ec6bb7740c3030 *inst/tinytest/testRcppPackage/src/rcpp_hello_world.cpp
3fc7d87c655d7c58790b18dadbf17462 *inst/tinytest/testRcppPackage/src/rcpp_hello_world.h
d4d4b13e8e48f3d2dff079fa0cae4db2 *inst/tinytest/test_algorithm.R
d43f4463ec22a001f10f70e5968b741e *inst/tinytest/test_as.R
4622138c9061a54bded602a3fa89700e *inst/tinytest/test_attribute_package.R
6fafd86f9d6036ddeec256f6520940fb *inst/tinytest/test_attributes.R
645c61b59b44cf4a7d0a8935c94f30b8 *inst/tinytest/test_binary_package.R
5c61d77db502333de43ef63ab5542947 *inst/tinytest/test_client_package.R
6972e7398a0316ee9378d0235a98193e *inst/tinytest/test_coerce.R
f848412bd201674571166f59141ead32 *inst/tinytest/test_dataframe.R
5d8938f1a0dd193080a0dd858aace479 *inst/tinytest/test_date.R
f7020772ec2f52bca37aa52f328e8a4a *inst/tinytest/test_dispatch.R
37c878dba3a8c6ee4a512d8ae49d0510 *inst/tinytest/test_embedded_r.R
0bfe887104fa049afec792eb9e1d38ee *inst/tinytest/test_environments.R
8d0384378c1530ae2651ed30077c3849 *inst/tinytest/test_exceptions.R
d6b632cbcf1d0d2a809789a850393f04 *inst/tinytest/test_exceptions_nocall.R
6592b542414d9978e3b1c899e0966638 *inst/tinytest/test_expose_class.R
2659ca40245f5942186d612cc050290e *inst/tinytest/test_function.R
a979bf54492367431865c051efc150ca *inst/tinytest/test_global_rostream.R
5abe71c4e00f42e060900b80b1033f52 *inst/tinytest/test_interface.R
9fcdc77199f2adc16ddaab74ede5c15f *inst/tinytest/test_internal_function.R
b1ec64c8809b5017cc83db4e63bb23e7 *inst/tinytest/test_internal_function_cpp11.R
6f3de256ae47895bab7356f1d5db3532 *inst/tinytest/test_language.R
f3df4a9477700c9773503b0d72cb9f38 *inst/tinytest/test_listof.R
642a072d490f3adf9ad7ccdc0b583c8c *inst/tinytest/test_matrix.R
d820e9d99c8361bb9bcdff1df8748415 *inst/tinytest/test_misc.R
3b74e9c0f70c24ec455b8325bd575ad1 *inst/tinytest/test_modref.R
c4b1132390df294c71724513bbcb329c *inst/tinytest/test_module.R
4f1cb95ff3231714571275b5f60c21cc *inst/tinytest/test_module_client_package.R
8fa4cb9335b9239ffce495337cbbe4b4 *inst/tinytest/test_na.R
350f50b10fda4680f6416833c8459113 *inst/tinytest/test_packageversion.R
50ac8801171cadb6ce7535680e3d7b4b *inst/tinytest/test_quickanddirty.R
a6e775e8658b97f5e1d0414789f76a08 *inst/tinytest/test_rcpp_package_skeleton.R
12824f997493028fb75fb416fb4899bd *inst/tinytest/test_reference.R
bf9528a41d909d19eda20947fe73d042 *inst/tinytest/test_rmath.R
23cccaef77d1c7188a384e5e6400505e *inst/tinytest/test_robject.R
ec2b5b9cab31cafb4b2cbdef00cd89e3 *inst/tinytest/test_s4.R
0bd9a05a2ebcfc708aed3911d21a6dc7 *inst/tinytest/test_stack.R
5f3c73c9a10dd378a82d16ed7224f541 *inst/tinytest/test_stats.R
d164383dd85501e99acb936ee66210a7 *inst/tinytest/test_string.R
3d9e890abd6a080315b84b99d6ed3843 *inst/tinytest/test_subset.R
a46b349af3a50ad019ff42e24af66601 *inst/tinytest/test_sugar.R
eea3406aec4fe65cae71db5baa9a0b51 *inst/tinytest/test_sugar_var.R
46dcee8e76f26d5103efa5ad09441892 *inst/tinytest/test_support.R
43968a7ffabb24fb25080fb01c301dc9 *inst/tinytest/test_system.R
44d3b675e624e692463ae9e9fe2776d0 *inst/tinytest/test_table.R
d06e982e043a66d6dc372dd98fc7c36e *inst/tinytest/test_vector.R
6a724a81b5a9281e7777b16ada40ac39 *inst/tinytest/test_vector_old.R
00c6d79e911c979b8b184fa6c946fe9a *inst/tinytest/test_wrap.R
daae893ce0886eccb852f34104884837 *inst/tinytest/test_wstring.R
5a3f1319ed569fd1f541dba428f9b7b7 *inst/tinytest/test_xptr.R
8e5b008afb149e5d2a53db37ece02775 *man/CppClass-class.Rd
0014f801734709bb479effdecc7b4718 *man/CppConstructor-class.Rd
0f6f6dd743da70147b0c2cac5c912ecb *man/CppField-class.Rd
7bd877824ff53185640a667392af41b2 *man/CppFunction-class.Rd
14c82eb310974beb4b904dcdc1617433 *man/CppObject-class.Rd
66e02f05536e2310d9e803ad3c874db7 *man/CppOverloadedMethods-class.Rd
4c34de06399c41644dfc380bb2f05a8d *man/DollarNames-methods.Rd
3088b043e8aab6cb3309701de2a8402f *man/Module-class.Rd
6161ec45d82f546757f7d02d1545675a *man/Module.Rd
0a05f98e94a3c140ee362e9bb8ee25e2 *man/Rcpp-deprecated.Rd
2d49a16c0b7aae09482f3249dd93b2f1 *man/Rcpp-internal.Rd
d6b6c655ad4be529d1787a5594d6aacb *man/Rcpp-package.Rd
caf95a4016058ed94cacd73a11fd9925 *man/Rcpp.package.skeleton.Rd
5e22a0887ef6458d266f5a3ba7388ddc *man/Rcpp.plugin.maker.Rd
8c9df710945f7e4367c67b98c7172e67 *man/RcppLdFlags.Rd
d70a03a4ad96b63cd6cc88b4adf6acdb *man/asisWeave.Rd
cdfd54981ce589dcfaf30019dfa6b95b *man/compileAttributes.Rd
e27c53a090cd857b3b53815841709f81 *man/cppFunction.Rd
01489ee8b81490b3516fee28615d461b *man/demangle.Rd
2c0fc00c864631092fe37dfc95b8a21d *man/dependsAttribute.Rd
f0e45ce1b304a89586becbae18e20135 *man/evalCpp.Rd
bef1d268eb1652a7cc3b15d5f691b6e8 *man/exportAttribute.Rd
01cbef50e7820a40e65d410ab4ce6d2e *man/exposeClass.Rd
236811309af8821f7e23dfc16f9a8d41 *man/formals.Rd
ee26bc930a1bff02c8664c0e51bd46da *man/getRcppVersion.Rd
708280bfbc3f6dc6d8cf76fe2a2afd0a *man/interfacesAttribute.Rd
36eb0bcf621e15b0bbce49821f9dac0e *man/loadModule.Rd
dd3b9b7596f51706f291dce032bfdb5c *man/pluginsAttribute.Rd
adf9afe6c945bc84505583d9e07bad49 *man/populate.Rd
8e8411de016d9bc94dc1d9585e660d34 *man/registerPlugin.Rd
ed0b08b15ead789f84e83ba46985a702 *man/setRcppClass.Rd
53e0cd847f1775e36539946d8112cf69 *man/sourceCpp.Rd
73e9e048a7c5003477f67089bf5d609c *src/Makevars
73e9e048a7c5003477f67089bf5d609c *src/Makevars.win
e1b4925c31f6eb694f0e64374f98ecaa *src/api.cpp
c4fa33325f6d78290c2f168ff2c8846e *src/attributes.cpp
0a8991b6ae3292f1ed74357fc990c5fb *src/barrier.cpp
85a8a53c535e4c986f02c427b5e7b85e *src/date.cpp
eef4c2f0e1abd787b8fd62d289ed5961 *src/internal.h
4eeaedc1e555103025f1feeaee299538 *src/module.cpp
545982e58b067742919490cc23d62905 *src/rcpp_init.cpp
e0c96fa9915f03a3178856d05b94e54a *tests/tinytest.R
2c2689d950eb3637391d5e5194839450 *vignettes/Rcpp-FAQ.pdf.asis
24c4fcaeb37c15721e72e3dd6bc7dc9d *vignettes/Rcpp-attributes.pdf.asis
c515df15a755d66c1379ddf796af9752 *vignettes/Rcpp-extending.pdf.asis
679d43b484ca77aa763998c23cf3dd0c *vignettes/Rcpp-introduction.pdf.asis
a270710de3e1d34603ddb2a8a08cacac *vignettes/Rcpp-jss-2011.pdf.asis
ca9f5769c657167c46792a6dba766b0d *vignettes/Rcpp-libraries.pdf.asis
4b0839ade8b38ffd1b37d859ab55b1f2 *vignettes/Rcpp-modules.pdf.asis
130153aaa5142d4c2fb8e72796c3beed *vignettes/Rcpp-package.pdf.asis
e8dafda3b4bdfd6a49846cfaa381f34d *vignettes/Rcpp-quickref.pdf.asis
775fbd27e89db3d4232edce372fc00d0 *vignettes/Rcpp-sugar.pdf.asis
Rcpp/R/ 0000755 0001762 0000144 00000000000 15126566764 011401 5 ustar ligges users Rcpp/R/RcppClass.R 0000644 0001762 0000144 00000014705 14000602755 013402 0 ustar ligges users # Copyright (C) 2010 - 2021 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
setRcppClass <- function(Class, CppClass,
module,
fields = list(),
contains = character(),
methods = list(),
saveAs = Class,
where = topenv(parent.frame()),
...) {
myCall <- match.call()
myCall[[1]] <- quote(Rcpp::loadRcppClass)
if (!missing(module) && moduleIsLoaded(module, where)) # eval now
eval.parent(myCall) # #nocov
else {
f <- function(NS)NULL
myCall$where = as.name("NS")
body(f, where) <- myCall
setLoadAction(f, where = where)
}
}
loadRcppClass <- function(Class, CppClass = Class,
module = paste0("class_",Class),
fields = character(),
contains = character(),
methods = list(),
saveAs = Class,
where = topenv(parent.frame()),
...) {
if(isBotchedSession()) {
value <- setRefClass(Class, fields = fields, methods = methods, contains = contains, where = where, ...) # kludge -- see loadModule.R #nocov start
if(is.character(saveAs) && length(saveAs) == 1)
assign(saveAs, value, envir = where)
return(value) # #nocov end
}
mod <- loadModule(module, NULL, env = where, loadNow = TRUE)
storage <- get("storage", envir = as.environment(mod))
if(exists(Class, envir = storage, inherits = FALSE)) {
cppclassinfo <- get(Class, envir = storage)
if(!is(cppclassinfo, "C++Class"))
stop(gettextf("Object \"%s\" in module \"%s\" is not a C++ class description", Class, module)) # #nocov
}
else
stop(gettextf("No object \"%s\" in module \"%s\"", Class, module)) # #nocov
allmethods <- .makeCppMethods(methods, cppclassinfo, where)
allfields <- .makeCppFields(fields, cppclassinfo, where)
value <- setRefClass(Class, fields = allfields,
contains = c(contains, "RcppClass"),
methods = allmethods, where=where, ...)
## declare the fields and methods to shut up codetools
## the R level fields and methods were declared by setRefClass
## but we declare them again; globalVariables() applies unique()
if(exists("globalVariables", envir = asNamespace("utils"))) # >=2.15.1
utils::globalVariables(c(names(allfields), names(allmethods)),
where)
if(is.character(saveAs) && length(saveAs) == 1)
assign(saveAs, value, envir = where)
value
}
.makeCppMethods <- function(methods, cppclassinfo, env) {
cppMethods <- names(cppclassinfo@methods)
newMethods <- names(methods)
for(what in cppMethods[! cppMethods %in% newMethods])
methods[[what]] <- eval(substitute(
function(...) .CppObject$WHAT(...), list(WHAT = as.name(what))),
env)
methods
}
.makeFieldsList <- function(fields) {
fnames <- allNames(fields)
any_s <- !nzchar(fnames)
fnames[any_s] <- fields[any_s]
fields[any_s] <- "ANY"
fields <- as.list(fields)
names(fields) <- fnames
fields
}
.makeCppFields <- function(fields, cppclassinfo, env) {
if(is.character(fields))
fields <- .makeFieldsList(fields)
cppFields <- names(cppclassinfo@fields)
newFields <- names(fields)
for(what in cppFields[! cppFields %in% newFields])
fields[[what]] <- eval(substitute(
function(value) if(missing(value)) .CppObject$WHAT else .CppObject$WHAT <- value,
list(WHAT = as.name(what))), env)
## insert the generator and cppclass def as constants
cppgenerator <- getRefClass(cppclassinfo)
fields[[".CppClassDef"]] <- eval(substitute(
function(value) if(missing(value)) DEF else stop("this field is a constant"),
list(DEF = cppclassinfo)), env)
fields[[".CppGenerator"]] <- eval(substitute(
function(value) if(missing(value)) DEF else stop("this field is a constant"),
list(DEF = cppgenerator)), env)
fields
}
.RcppClass <- setRefClass("RcppClass",
methods = list(
initialize = function(...){
args <- list(...)
argNames <- allNames(args)
cppArgs <- !nzchar(argNames)
.CppObject <<- do.call(.CppGenerator$new, args[cppArgs])
for(i in seq_along(args)[!cppArgs])
field(argNames[[i]], args[[i]]) # #nocov
}
),
fields = list(
.CppObject = "C++Object"
),
contains = "VIRTUAL"
)
.RcppClass$methods(show = function ()
{
cat("Rcpp class object of class ", classLabel(class(.self)), # #nocov start
"\n", sep = "")
fields <- names(.refClassDef@fieldClasses)
if(".CppObject" %in% fields) {
cat("\n")
methods::show(field(".CppObject"))
cat("\n")
}
fields <- fields[ ! fields %in% c(".CppObject", ".CppClassDef", ".CppGenerator")]
for (fi in fields) {
cat("Field \"", fi, "\":\n", sep = "")
methods::show(field(fi))
}
},
objectPointer = function()
.CppObject$.pointer # #nocov end
)
Rcpp/R/RcppLdpath.R 0000644 0001762 0000144 00000010723 15126566764 013570 0 ustar ligges users # Copyright (C) 2010 - 2026 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
## make sure system.file returns an absolute path
Rcpp.system.file <- function(...){
tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) )
}
## quote path if non-standard characters are used
Rcpp.quoteNonStandard <- function(path) {
## On unix, check if path has only characters that do not need quoting
noquote <- .Platform$OS.type == "unix" && grepl("^[[:alnum:]/._~+@%-]*$", path)
## If no quoting needed return unchanged else quote input
if (noquote) path else shQuote(path) # #nocov
}
## Use R's internal knowledge of path settings to find the lib/ directory
## plus optinally an arch-specific directory on system building multi-arch
RcppLdPath <- function() {
#.Deprecated(msg=paste("This function is now deprecated as it has not",
# "been needed since 2013."))
message("'RcppLdPath' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
""
}
## Provide linker flags -- i.e. -L/path/to/libRcpp -- as well as an
## optional rpath call needed to tell the Linux dynamic linker about the
## location. This is not needed on OS X where we encode this as library
## built time (see src/Makevars) or Windows where we use a static library
## Updated Jan 2010: We now default to static linking but allow the use
## of rpath on Linux if static==FALSE has been chosen
## Note that this is probably being called from LdFlags()
## Updated Nov 2013: We no longer build a library. This should be deprecated.
RcppLdFlags <- function() {
#.Deprecated(msg=paste("This function is now deprecated as it has not",
# "been needed since 2013."))
message("'RcppLdFlags' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
""
}
# indicates if Rcpp was compiled with GCC >= 4.3
canUseCXX0X <- function() { TRUE } # .Call( "canUseCXX0X", PACKAGE = "Rcpp" )
## Provide compiler flags -- i.e. -I/path/to/Rcpp.h
RcppCxxFlags <- function(cxx0x=FALSE) {
path <- Rcpp.system.file( "include" )
if (.Platform$OS.type=="windows") {
path <- asBuildPath(path) # #nocov
}
paste0('-I', Rcpp.quoteNonStandard(path))
}
## Shorter names, and call cat() directly
## CxxFlags defaults to no using c++0x extensions are these are considered non-portable
CxxFlags <- function(cxx0x=FALSE) { # #nocov start
#.Deprecated(msg=paste("This function is now deprecated as R uses minimally",
# "viable compilers om all platforme."))
message("'CxxFlags' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
cat(RcppCxxFlags(cxx0x=cxx0x)) # #nocov end
}
## LdFlags defaults to static linking on the non-Linux platforms Windows and OS X
LdFlags <- function() {
message("'LdFlags' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
cat(RcppLdFlags())
}
# capabilities
RcppCapabilities <- capabilities <- function() .Call( rcpp_capabilities )
# compile, load and call the cxx0x.c script to identify whether
# the compiler is GCC >= 4.3
RcppCxx0xFlags <- function() { # #nocov start
#.Deprecated(msg=paste("This function is now deprecated as R uses minimally",
# "viable compilers om all platforme."))
message("'RcppCxx0xFlags' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
script <- Rcpp.system.file( "discovery", "cxx0x.R" )
flag <- capture.output( source( script ) )
flag
}
Cxx0xFlags <- function() {
message("'Cxx0xFlags' has not been needed since 2013 (!!) and may get removed in 2027. Please update your 'Makevars'.")
cat(RcppCxx0xFlags()) # #nocov end
}
Rcpp/R/Attributes.R 0000644 0001762 0000144 00000141661 15126566764 013663 0 ustar ligges users
# Copyright (C) 2012 - 2022 JJ Allaire, Dirk Eddelbuettel and Romain Francois
# Copyright (C) 2023 - 2026 JJ Allaire, Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
# Source C++ code from a file
sourceCpp <- function(file = "",
code = NULL,
env = globalenv(),
embeddedR = TRUE,
rebuild = FALSE,
cacheDir = getOption("rcpp.cache.dir", tempdir()),
cleanupCacheDir = FALSE,
showOutput = verbose,
verbose = getOption("verbose"),
dryRun = FALSE,
windowsDebugDLL = FALSE,
echo = TRUE) {
# use an architecture/version specific subdirectory of the cacheDir
# (since cached dynlibs can now perist across sessions we need to be
# sure to invalidate them when R or Rcpp versions change)
cacheDir <- path.expand(cacheDir)
cacheDir <- .sourceCppPlatformCacheDir(cacheDir)
cacheDir <- normalizePath(cacheDir)
# resolve code into a file if necessary. also track the working
# directory to source the R embedded code chunk within
if (!missing(code)) {
rWorkingDir <- getwd()
file <- tempfile(fileext = ".cpp", tmpdir = cacheDir)
con <- file(file, open = "w")
writeLines(code, con)
close(con)
} else {
rWorkingDir <- normalizePath(dirname(file))
}
# resolve the file path
file <- normalizePath(file, winslash = "/")
# error if the file extension isn't one supported by R CMD SHLIB
if (! tools::file_ext(file) %in% c("cc", "cpp")) { # #nocov start
stop("The filename '", basename(file), "' does not have an ",
"extension of .cc or .cpp so cannot be compiled.")
} # #nocov end
# validate that there are no spaces in the path on windows
if (.Platform$OS.type == "windows") { # #nocov start
if (grepl(' ', basename(file), fixed=TRUE)) {
stop("The filename '", basename(file), "' contains spaces. This ",
"is not permitted.")
}
} else {
if (windowsDebugDLL) {
if (verbose) {
message("The 'windowsDebugDLL' toggle is ignored on ",
"non-Windows platforms.")
}
windowsDebugDLL <- FALSE # now we do not need to deal with OS choice below
} # #nocov end
}
# get the context (does code generation as necessary)
context <- .Call("sourceCppContext", PACKAGE="Rcpp",
file, code, rebuild, cacheDir, .Platform)
# perform a build if necessary
if (context$buildRequired || rebuild) {
# print output for verbose mode
if (verbose)
.printVerboseOutput(context) # #nocov
# variables used to hold completed state (passed to completed hook)
succeeded <- FALSE
output <- NULL
# build dependency list
depends <- .getSourceCppDependencies(context$depends, file)
# validate packages (error if package not found)
.validatePackages(depends, context$cppSourceFilename)
# temporarily modify environment for the build
envRestore <- .setupBuildEnvironment(depends, context$plugins, file)
# temporarily setwd to build directory
cwd <- getwd()
setwd(context$buildDirectory)
# call the onBuild hook. note that this hook should always be called
# after .setupBuildEnvironment so subscribers are able to examine
# the build environment
fromCode <- !missing(code)
if (!.callBuildHook(context$cppSourcePath, fromCode, showOutput)) {
.restoreEnvironment(envRestore) # #nocov start
setwd(cwd)
return (invisible(NULL))
} # #nocov end
# on.exit handler calls hook and restores environment and working dir
on.exit({
if (!succeeded)
.showBuildFailureDiagnostics() # #nocov
.callBuildCompleteHook(succeeded, output)
setwd(cwd)
.restoreEnvironment(envRestore)
})
# unload and delete existing dylib if necessary
if (file.exists(context$previousDynlibPath)) { # #nocov start
try(silent=TRUE, dyn.unload(context$previousDynlibPath))
file.remove(context$previousDynlibPath)
} # #nocov end
# grab components we need to build command
r <- file.path(R.home("bin"), "R")
lib <- context$dynlibFilename
deps <- context$cppDependencySourcePaths
src <- context$cppSourceFilename
# prepare the command (output if we are in showOutput mode)
args <- c(
"CMD", "SHLIB",
if (windowsDebugDLL) "-d",
if (rebuild) "--preclean",
if (dryRun) "--dry-run",
"-o", shQuote(lib),
if (length(deps))
paste(shQuote(deps), collapse = " "),
shQuote(src)
)
if (showOutput)
cat(paste(c(r, args), collapse = " "), "\n") # #nocov
# execute the build -- suppressWarnings b/c when showOutput = FALSE
# we are going to explicitly check for an error and print the output
so <- if (showOutput) "" else TRUE
result <- suppressWarnings(system2(r, args, stdout = so, stderr = so))
# check build results
if(!showOutput) {
# capture output
output <- result
attributes(output) <- NULL
# examine status
status <- attr(result, "status")
if (!is.null(status)) {
cat(result, sep = "\n") # #nocov start
succeeded <- FALSE
stop("Error ", status, " occurred building shared library.")
} else if (!file.exists(context$dynlibFilename)) {
cat(result, sep = "\n")
succeeded <- FALSE
stop("Error occurred building shared library.") # #nocov end
} else {
succeeded <- TRUE
}
}
else if (!identical(as.character(result), "0")) { # #nocov start
succeeded <- FALSE
stop("Error ", result, " occurred building shared library.")
} else {
succeeded <- TRUE # #nocov end
}
}
else {
cwd <- getwd()
on.exit({
setwd(cwd)
})
if (verbose) # #nocov start
cat("\nNo rebuild required (use rebuild = TRUE to ",
"force a rebuild)\n\n", sep="")
}
# return immediately if this was a dry run
if (dryRun)
return(invisible(NULL)) # #nocov end
# load the module if we have exported symbols
if (length(context$exportedFunctions) > 0 || length(context$modules) > 0) {
# remove existing objects of the same name from the environment
exports <- c(context$exportedFunctions, context$modules)
removeObjs <- exports[exports %in% ls(envir = env, all.names = T)]
remove(list = removeObjs, envir = env)
# source the R script
scriptPath <- file.path(context$buildDirectory, context$rSourceFilename)
source(scriptPath, local = env)
} else if (getOption("rcpp.warnNoExports", default=TRUE)) { # #nocov start
warning("No Rcpp::export attributes or RCPP_MODULE declarations ",
"found in source") # #nocov end
}
# source the embeddedR
if (embeddedR && (length(context$embeddedR) > 0)) {
srcConn <- textConnection(context$embeddedR)
setwd(rWorkingDir) # will be reset by previous on.exit handler
source(file = srcConn, local = env, echo = echo)
}
# cleanup the cache dir if requested
if (cleanupCacheDir)
cleanupSourceCppCache(cacheDir, context$cppSourcePath, context$buildDirectory) # #nocov
# return (invisibly) a list containing exported functions and modules
invisible(list(functions = context$exportedFunctions,
modules = context$modules,
cppSourcePath = context$cppSourcePath,
buildDirectory = context$buildDirectory))
}
# Cleanup a directory used as the cache for a sourceCpp compilation. This will
# remove all files from the cache directory that aren't a result of the
# compilation that yielded the passed buildDirectory.
cleanupSourceCppCache <- function(cacheDir, cppSourcePath, buildDirectory) {
# normalize cpp source path and build directory # #nocov start
cppSourcePath <- normalizePath(cppSourcePath)
buildDirectory <- normalizePath(buildDirectory)
# determine the parent dir that was used for the compilation then collect all the
# *.cpp files and subdirectories therein
cacheFiles <- list.files(cacheDir, pattern = glob2rx("*.cpp"), recursive = FALSE, full.names = TRUE)
cacheFiles <- c(cacheFiles, list.dirs(cacheDir, recursive = FALSE, full.names = TRUE))
cacheFiles <- normalizePath(cacheFiles)
# determine the list of tiles that were not yielded by the passed sourceCpp
# result and remove them
oldCacheFiles <- cacheFiles[!cacheFiles %in% c(cppSourcePath, buildDirectory)]
unlink(oldCacheFiles, recursive = TRUE) # #nocov end
}
# Define a single C++ function
cppFunction <- function(code,
depends = character(),
plugins = character(),
includes = character(),
env = parent.frame(),
rebuild = FALSE,
cacheDir = getOption("rcpp.cache.dir", tempdir()),
showOutput = verbose,
verbose = getOption("verbose"),
echo = TRUE) {
# process depends
if (!is.null(depends) && length(depends) > 0) { # #nocov start
depends <- paste(depends, collapse=", ")
scaffolding <- paste("// [[Rcpp::depends(", depends, ")]]", sep="")
scaffolding <- c(scaffolding, "", .linkingToIncludes(depends, FALSE),
recursive=TRUE) # #nocov end
}
else {
scaffolding <- "#include "
}
# process plugins
if (!is.null(plugins) && length(plugins) > 0) {
plugins <- paste(plugins, sep=", ") # #nocov start
pluginsAttrib <- paste("// [[Rcpp::plugins(", plugins, ")]]", sep="")
scaffolding <- c(scaffolding, pluginsAttrib)
# append plugin includes
for (pluginName in plugins) {
plugin <- .findPlugin(pluginName)
settings <- plugin()
scaffolding <- c(scaffolding, settings$includes, recursive=TRUE)
} # #nocov end
}
# remainder of scaffolding
scaffolding <- c(scaffolding,
"",
"using namespace Rcpp;",
"",
includes,
"// [[Rcpp::export]]",
recursive = T)
# prepend scaffolding to code
code <- paste(c(scaffolding, code, recursive = T), collapse="\n")
# print the generated code if we are in verbose mode
if (verbose) { # #nocov start
cat("\nGenerated code for function definition:",
"\n--------------------------------------------------------\n\n")
cat(code)
cat("\n")
}
# source cpp into specified environment. if env is set to NULL
# then create a new one (the caller can get a hold of the function
# via the return value)
if (is.null(env))
env <- new.env() # #nocov end
exported <- sourceCpp(code = code,
env = env,
rebuild = rebuild,
cacheDir = cacheDir,
showOutput = showOutput,
verbose = verbose,
echo = echo)
# verify that a single function was exported and return it
if (length(exported$functions) == 0)
stop("No function definition found") # #nocov
else if (length(exported$functions) > 1)
stop("More than one function definition") # #nocov
else {
functionName <- exported$functions[[1]]
invisible(get(functionName, env))
}
}
.type_manipulate <- function( what = "DEMANGLE", class = NULL ) {
function( type = "int", ... ){ # #nocov start
code <- sprintf( '
SEXP manipulate_this_type(){
typedef %s type ;
return wrap( %s(type) ) ;
}', type, what )
dots <- list( code, ... )
dots[["env"]] <- environment()
manipulate_this_type <- do.call( cppFunction, dots )
res <- manipulate_this_type()
if( ! is.null(class) ){
class(res) <- class
}
res
} # #nocov end
}
demangle <- .type_manipulate( "DEMANGLE" )
sizeof <- .type_manipulate( "sizeof", "bytes" )
print.bytes <- function( x, ...){ # #nocov start
writeLines( sprintf( "%d bytes (%d bits)", x, 8 * x ) )
invisible( x )
} # #nocov end
# Evaluate a simple c++ expression
evalCpp <- function(code,
depends = character(),
plugins = character(),
includes = character(),
rebuild = FALSE,
cacheDir = getOption("rcpp.cache.dir", tempdir()),
showOutput = verbose,
verbose = getOption( "verbose" ) ){
# #nocov start
code <- sprintf( "SEXP get_value(){ return wrap( %s ) ; }", code )
env <- new.env()
cppFunction(code, depends = depends, plugins = plugins,
includes = includes, env = env,
rebuild = rebuild, cacheDir = cacheDir, showOutput = showOutput, verbose = verbose )
fun <- env[["get_value"]]
fun() # #nocov end
}
areMacrosDefined <- function(names,
depends = character(),
includes = character(),
rebuild = FALSE,
showOutput = verbose,
verbose = getOption( "verbose" ) ){
code <- sprintf( '
LogicalVector get_value(){
return LogicalVector::create(
%s
) ;
}',
paste( sprintf( ' _["%s"] =
#if defined(%s)
true
#else
false
#endif
', names, names ), collapse = ",\n" )
)
env <- new.env()
cppFunction(code, depends = depends, includes = includes, env = env,
rebuild = rebuild, showOutput = showOutput, verbose = verbose )
fun <- env[["get_value"]]
fun()
}
# Scan the source files within a package for attributes and generate code
# based on the attributes.
compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
# verify this is a package and read the DESCRIPTION to get it's name
pkgdir <- normalizePath(pkgdir, winslash = "/")
descFile <- file.path(pkgdir,"DESCRIPTION")
if (!file.exists(descFile))
stop("pkgdir must refer to the directory containing an R package") # #nocov
pkgDesc <- read.dcf(descFile)[1,]
pkgname = .readPkgDescField(pkgDesc, "Package")
depends <- c(.readPkgDescField(pkgDesc, "Depends", character()),
.readPkgDescField(pkgDesc, "Imports", character()),
.readPkgDescField(pkgDesc, "LinkingTo", character()))
depends <- unique(.splitDepends(depends))
depends <- depends[depends != "R"]
# check the NAMESPACE file to see if dynamic registration is enabled
namespaceFile <- file.path(pkgdir, "NAMESPACE")
if (!file.exists(namespaceFile))
stop("pkgdir must refer to the directory containing an R package") # #nocov
pkgNamespace <- readLines(namespaceFile, warn = FALSE)
registration <- any(grepl("^\\s*useDynLib.*\\.registration\\s*=\\s*TRUE.*$", pkgNamespace))
# determine source directory
srcDir <- file.path(pkgdir, "src")
if (!file.exists(srcDir))
return (FALSE) # #nocov
# create R directory if it doesn't already exist
rDir <- file.path(pkgdir, "R")
if (!file.exists(rDir))
dir.create(rDir) # #nocov
# remove the old RcppExports.R file
unlink(file.path(rDir, "RcppExports.R"))
# get a list of all source files
cppFiles <- list.files(srcDir, pattern = "\\.((c(c|pp)?)|(h(pp)?))$", ignore.case = TRUE)
# don't include RcppExports.cpp
cppFiles <- setdiff(cppFiles, "RcppExports.cpp")
# locale independent sort for stable output
locale <- Sys.getlocale(category = "LC_COLLATE")
Sys.setlocale(category = "LC_COLLATE", locale = "C")
cppFiles <- sort(cppFiles)
Sys.setlocale(category = "LC_COLLATE", locale = locale)
# derive base names (will be used for modules)
cppFileBasenames <- tools::file_path_sans_ext(cppFiles)
# expend them to their full paths
cppFiles <- file.path(srcDir, cppFiles)
cppFiles <- normalizePath(cppFiles, winslash = "/")
# generate the includes list based on LinkingTo. Specify plugins-only
# because we only need as/wrap declarations
linkingTo <- .readPkgDescField(pkgDesc, "LinkingTo")
includes <- .linkingToIncludes(linkingTo, TRUE)
# if a master include file or types file is in inst/include then use it
typesHeader <- c(paste0(pkgname, "_types.h"), paste0(pkgname, "_types.hpp"))
pkgHeader <- c(paste0(pkgname, ".h"), typesHeader)
pkgHeaderPath <- file.path(pkgdir, "inst", "include", pkgHeader)
pkgHeader <- pkgHeader[file.exists(pkgHeaderPath)]
if (length(pkgHeader) > 0) { # #nocov start
pkgInclude <- paste("#include \"../inst/include/",
pkgHeader, "\"", sep="")
includes <- c(pkgInclude, includes)
} # #nocov end
# if a _types file is in src then include it
pkgHeader <- typesHeader
pkgHeaderPath <- file.path(pkgdir, "src", pkgHeader)
pkgHeader <- pkgHeader[file.exists(pkgHeaderPath)]
if (length(pkgHeader) > 0)
includes <- c(paste0("#include \"", pkgHeader ,"\""), includes) # #nocov
# generate exports
invisible(.Call("compileAttributes", PACKAGE="Rcpp",
pkgdir, pkgname, depends, registration, cppFiles, cppFileBasenames,
includes, verbose, .Platform))
}
# setup plugins environment
.plugins <- new.env()
# built-in C++98 plugin
.plugins[["cpp98"]] <- function() {
list(env = list(USE_CXX98 = "yes"))
}
# built-in C++11 plugin
.plugins[["cpp11"]] <- function() {
list(env = list(USE_CXX11 = "yes"))
}
# built-in C++11 plugin for older g++ compiler
.plugins[["cpp0x"]] <- function() {
list(env = list(PKG_CXXFLAGS ="-std=c++0x"))
}
## built-in C++14 plugin for C++14 standard
## this is the default in g++-6.1 and later
## per https://gcc.gnu.org/projects/cxx-status.html#cxx14
.plugins[["cpp14"]] <- function() {
list(env = list(USE_CXX14 = "yes"))
}
# built-in C++1y plugin for C++14 and C++17 standard under development
.plugins[["cpp1y"]] <- function() {
list(env = list(PKG_CXXFLAGS ="-std=c++1y"))
}
# built-in C++17 plugin for C++17 standard (g++-6 or later)
.plugins[["cpp17"]] <- function() {
list(env = list(USE_CXX17 = "yes"))
}
# built-in C++20 plugin for C++20
.plugins[["cpp20"]] <- function() {
if (getRversion() >= "4.2") # with recent R versions, R can decide
list(env = list(USE_CXX20 = "yes"))
else
list(env = list(PKG_CXXFLAGS ="-std=c++20"))
}
# built-in C++23 plugin for C++23
.plugins[["cpp23"]] <- function() {
if (getRversion() >= "4.3") # with recent R versions, R can decide
list(env = list(USE_CXX23 = "yes"))
else
list(env = list(PKG_CXXFLAGS ="-std=c++23"))
}
# built-in C++26 plugin for C++26
.plugins[["cpp26"]] <- function() {
if (getRversion() >= "4.5") # with recent R versions, R can decide
list(env = list(USE_CXX26 = "yes"))
else
list(env = list(PKG_CXXFLAGS ="-std=c++26"))
}
## built-in C++1z plugin for C++17 standard under development
## note that as of Feb 2017 this is taken to be a moving target
## see https://gcc.gnu.org/projects/cxx-status.html
.plugins[["cpp1z"]] <- function() {
list(env = list(PKG_CXXFLAGS ="-std=c++1z"))
}
## built-in C++2a plugin for g++ 8 and later
## cf https://gcc.gnu.org/projects/cxx-status.html as of Dec 2018
.plugins[["cpp2a"]] <- function() {
list(env = list(PKG_CXXFLAGS ="-std=c++2a"))
}
## built-in C++2b plugin for compilers without C++23 support
.plugins[["cpp2b"]] <- function() {
list(env = list(PKG_CXXFLAGS ="-std=c++2b"))
}
.openmpPluginDefault <- function() {
list(env = list(PKG_CXXFLAGS = "-fopenmp", PKG_LIBS = "-fopenmp")) # #nocov start
}
.openmpPluginDarwin <- function() {
# generate a test script for compilation
script <- tempfile("openmp-detect-", fileext = ".cpp")
writeLines("", con = script)
on.exit(unlink(script, force = TRUE), add = TRUE)
# get the C++ compiler from R
r <- file.path(R.home("bin"), "R")
output <- tryCatch(
system2(r, c("CMD", "SHLIB", "--dry-run", shQuote(script)), stdout = TRUE),
condition = identity
)
if (inherits(output, "condition"))
return(.openmpPluginDefault())
# extract the compiler invocation from the shlib output
# use some heuristics here...
index <- grep("make would use", output)
compile <- output[[index + 1L]]
# use everything up to the first include flag, which is normally
# the R headers from CPPFLAGS
idx <- regexpr(" -I", compile, fixed = TRUE)
cxx <- substring(compile, 1L, idx - 1L)
# check the compiler version
command <- paste(cxx, "--version")
version <- tryCatch(
system(command, intern = TRUE),
condition = identity
)
if (inherits(version, "condition"))
return(.openmpPluginDefault())
# if we're using Apple clang, use alternate flags
# assume libomp was installed following https://mac.r-project.org/openmp/
if (any(grepl("Apple clang", version))) {
cxxflags <- "-Xclang -fopenmp"
libs <- "-lomp"
}
# if we're using Homebrew clang, add in libomp include paths
else if (any(grepl("Homebrew clang", version))) {
machine <- Sys.info()[["machine"]]
prefix <- if (machine == "arm64") "/opt/homebrew" else "/usr/local"
cxxflags <- sprintf("-I%s/opt/libomp/include -fopenmp", prefix)
libs <- sprintf("-L%s/opt/libomp/lib -fopenmp", prefix)
# otherwise, use default -fopenmp flags for other compilers (LLVM clang; gcc)
} else {
cxxflags <- "-fopenmp"
libs <- "-fopenmp"
}
list(env = list(PKG_CXXFLAGS = cxxflags, PKG_LIBS = libs)) # #nocov end
}
## built-in OpenMP plugin
.plugins[["openmp"]] <- if (Sys.info()[["sysname"]] == "Darwin") {
.openmpPluginDarwin
} else {
.openmpPluginDefault
}
.plugins[["unwindProtect"]] <- function() { # nocov start
warning("unwindProtect is enabled by default and this plugin is deprecated.",
" It will be removed in a future version of Rcpp.")
list()
} # nocov end
# register a plugin
registerPlugin <- function(name, plugin) {
.plugins[[name]] <- plugin # #nocov
}
# Take an empty function body and connect it to the specified external symbol
sourceCppFunction <- function(func, isVoid, dll, symbol) {
args <- names(formals(func))
body <- quote( CALL_PLACEHOLDER ( EXTERNALNAME, ARG ) )[ c(1:2, rep(3, length(args))) ]
for (i in seq(along.with = args))
body[[i+2]] <- as.symbol(args[i])
body[[1L]] <- quote(.Call)
body[[2L]] <- getNativeSymbolInfo(symbol, dll)$address
if (isVoid)
body <- call("invisible", body)
body(func) <- body
func
}
# Print verbose output
.printVerboseOutput <- function(context) { # #nocov start
cat("\nGenerated extern \"C\" functions",
"\n--------------------------------------------------------\n")
cat(context$generatedCpp, sep="")
cat("\nGenerated R functions",
"\n-------------------------------------------------------\n\n")
cat(readLines(file.path(context$buildDirectory,
context$rSourceFilename)),
sep="\n")
cat("\nBuilding shared library",
"\n--------------------------------------------------------\n",
"\nDIR: ", context$buildDirectory, "\n\n", sep="")
} # #nocov end
# Add LinkingTo dependencies if the sourceFile is in a package
.getSourceCppDependencies <- function(depends, sourceFile) {
# If the source file is in a package then simulate it being built
# within the package by including it's LinkingTo dependencies,
# the src directory (.), and the inst/include directory
if (.isPackageSourceFile(sourceFile)) { # #nocov start
descFile <- file.path(dirname(sourceFile), "..", "DESCRIPTION")
DESCRIPTION <- read.dcf(descFile, all = TRUE)
linkingTo <- .parseLinkingTo(DESCRIPTION$LinkingTo)
unique(c(depends, linkingTo)) # #nocov end
} else {
depends
}
}
# Check whether a source file is in a package
.isPackageSourceFile <- function(sourceFile) {
file.exists(file.path(dirname(sourceFile), "..", "DESCRIPTION"))
}
# Error if a package is not currently available
.validatePackages <- function(depends, sourceFilename) {
unavailable <- depends[!depends %in% .packages(all.available=TRUE)]
if (length(unavailable) > 0) { # #nocov start
stop(paste("Package '", unavailable[[1]], "' referenced from ",
"Rcpp::depends in source file ",
sourceFilename, " is not available.",
sep=""),
call. = FALSE) # #nocov end
}
}
# Split the depends field of a package description
.splitDepends <- function(x) {
if (!length(x))
return(character()) # #nocov
x <- unlist(strsplit(x, ","))
x <- sub("[[:space:]]+$", "", x)
x <- unique(sub("^[[:space:]]*(.*)", "\\1", x))
sub("^([[:alnum:].]+).*$", "\\1", x)
}
# read a field from a named package description character vector
.readPkgDescField <- function(pkgDesc, name, default = NULL) {
if (name %in% names(pkgDesc))
pkgDesc[[name]]
else
default
}
# Get the inline plugin for the specified package (return NULL if none found)
.getInlinePlugin <- function(package) { # #nocov start
tryCatch(get("inlineCxxPlugin", asNamespace(package), inherits = FALSE),
error = function(e) NULL)
} # #nocov end
# Lookup a plugin
.findPlugin <- function(pluginName) {
plugin <- .plugins[[pluginName]]
if (is.null(plugin))
stop("Inline plugin '", pluginName, "' could not be found ", # #nocov start
"within the Rcpp package. You should be ",
"sure to call registerPlugin before using a plugin.") # #nocov end
return(plugin)
}
# Setup the build environment based on the specified dependencies. Returns an
# opaque object that can be passed to .restoreEnvironment to reverse whatever
# changes that were made
.setupBuildEnvironment <- function(depends, plugins, sourceFile) {
# setup
buildEnv <- list()
linkingToPackages <- c("Rcpp")
# merge values into the buildEnv
mergeIntoBuildEnv <- function(name, value) {
# protect against null or empty string
if (is.null(value) || !nzchar(value))
return(invisible(NULL))
# if it doesn't exist already just set it
if (is.null(buildEnv[[name]])) {
buildEnv[[name]] <<- value
}
# if it's not identical then append
else if (!identical(buildEnv[[name]], value)) { # #nocov
buildEnv[[name]] <<- paste(buildEnv[[name]], value) # #nocov
}
else {
# it already exists and it's the same value, this
# likely means it's a flag-type variable so we
# do nothing rather than appending it
}
}
# update dependencies from a plugin
setDependenciesFromPlugin <- function(plugin) {
# get the plugin settings
settings <- plugin()
# merge environment variables
pluginEnv <- settings$env
for (name in names(pluginEnv)) {
mergeIntoBuildEnv(name, pluginEnv[[name]])
}
# capture any LinkingTo elements defined by the plugin
linkingToPackages <<- unique(c(linkingToPackages,
settings$LinkingTo))
}
# add packages to linkingTo and introspect for plugins
for (package in depends) {
# #nocov start
# add a LinkingTo for this package
linkingToPackages <- unique(c(linkingToPackages, package))
# see if the package exports a plugin
plugin <- .getInlinePlugin(package)
if (!is.null(plugin))
setDependenciesFromPlugin(plugin) # #nocov end
}
# process plugins
for (pluginName in plugins) {
plugin <- .findPlugin(pluginName)
setDependenciesFromPlugin(plugin)
}
# if there is no buildEnv from a plugin then use the Rcpp plugin
if (length(buildEnv) == 0) {
buildEnv <- inlineCxxPlugin()$env
}
# set CLINK_CPPFLAGS based on the LinkingTo dependencies
buildEnv$CLINK_CPPFLAGS <- .buildClinkCppFlags(linkingToPackages)
# add the source file's directory to the compilation
srcDir <- dirname(sourceFile)
srcDir <- asBuildPath(srcDir)
buildDirs <- srcDir
# if the source file is in a package then add inst/include
if (.isPackageSourceFile(sourceFile)) { # #nocov start
incDir <- file.path(dirname(sourceFile), "..", "inst", "include")
incDir <- asBuildPath(incDir)
buildDirs <- c(buildDirs, incDir) # #nocov end
}
# set CLINK_CPPFLAGS with directory flags
dirFlags <- paste0('-I"', buildDirs, '"', collapse=" ")
buildEnv$CLINK_CPPFLAGS <- paste(buildEnv$CLINK_CPPFLAGS,
dirFlags,
collapse=" ")
# merge existing environment variables
for (name in names(buildEnv))
mergeIntoBuildEnv(name, Sys.getenv(name))
# add cygwin message muffler
buildEnv$CYGWIN = "nodosfilewarning"
# on windows see if we need to add Rtools to the path
# (don't do this for RStudio since it has it's own handling)
if (identical(Sys.info()[['sysname']], "Windows") &&
!nzchar(Sys.getenv("RSTUDIO"))) { # #nocov start
env <- .environmentWithRtools()
for (var in names(env))
buildEnv[[var]] <- env[[var]] # #nocov end
}
# create restore list
restore <- list()
for (name in names(buildEnv))
restore[[name]] <- Sys.getenv(name, unset = NA)
# set environment variables
do.call(Sys.setenv, buildEnv)
# return restore list
return (restore)
}
# If we don't have the GNU toolchain already on the path then see if
# we can find Rtools and add it to the path
.environmentWithRtools <- function() {
# #nocov start
# Only proceed if we don't have the required tools on the path
hasRtools <- nzchar(Sys.which("ls.exe")) && nzchar(Sys.which("gcc.exe"))
if (!hasRtools) {
# Read the Rtools registry key
key <- NULL
try(key <- utils::readRegistry("SOFTWARE\\R-core\\Rtools",
hive = "HLM", view = "32-bit"),
silent = TRUE)
# If we found the key examine it
if (!is.null(key)) {
# Check version
ver <- key$`Current Version`
if (ver %in% (c("2.15", "2.16", "3.0", "3.1", "3.2", "3.3", "3.4"))) {
# See if the InstallPath leads to the expected directories
# R version 3.3.0 alpha (2016-03-25 r70378)
isGcc49 <- ver %in% c("3.3", "3.4") && as.numeric(R.Version()$`svn rev`) >= 70378
rToolsPath <- key$`InstallPath`
if (!is.null(rToolsPath)) {
# add appropriate path entries
path <- file.path(rToolsPath, "bin", fsep="\\")
if (!isGcc49)
path <- c(path, file.path(rToolsPath, "gcc-4.6.3", "bin", fsep="\\"))
# if they all exist then return a list with modified
# environment variables for the compilation
if (all(file.exists(path))) {
env <- list()
path <- paste(path, collapse = .Platform$path.sep)
env$PATH <- paste(path, Sys.getenv("PATH"), sep=.Platform$path.sep)
if (isGcc49) {
env$RTOOLS <- .rtoolsPath(rToolsPath)
env$BINPREF <- file.path(env$RTOOLS, "mingw_$(WIN)/bin//", fsep = "/")
}
return(env)
}
}
}
}
}
return(NULL) # #nocov end
}
# Ensure that the path is suitable for passing as an RTOOLS
# environment variable
.rtoolsPath <- function(path) {
path <- gsub("\\\\", "/", path) # #nocov start
## R 3.2.0 or later only: path <- trimws(path)
.localsub <- function(re, x) sub(re, "", x, perl = TRUE)
path <- .localsub("[ \t\r\n]+$", .localsub("^[ \t\r\n]+", path))
if (substring(path, nchar(path)) != "/")
path <- paste(path, "/", sep="")
path # #nocov end
}
# Build CLINK_CPPFLAGS from include directories of LinkingTo packages
.buildClinkCppFlags <- function(linkingToPackages) {
pkgCxxFlags <- NULL
for (package in linkingToPackages) {
packagePath <- find.package(package, NULL, quiet=TRUE)
packagePath <- asBuildPath(packagePath)
pkgCxxFlags <- paste(pkgCxxFlags,
paste0('-I"', packagePath, '/include"'),
collapse=" ")
}
return (pkgCxxFlags)
}
.restoreEnvironment <- function(restore) {
# variables to reset
setVars <- restore[!is.na(restore)]
if (length(setVars))
do.call(Sys.setenv, setVars) # #nocov
# variables to remove
removeVars <- names(restore[is.na(restore)])
if (length(removeVars))
Sys.unsetenv(removeVars)
}
# Call the onBuild hook. This hook is provided so that external tools
# can perform processing (e.g. lint checking or other diagnostics) prior
# to the execution of a build). The showOutput flag is there to inform the
# subscriber whether they'll be getting output in the onBuildComplete hook
# or whether it will need to be scraped from the console (for verbose=TRUE)
# The onBuild hook is always called from within the temporary build directory
.callBuildHook <- function(file, fromCode, showOutput) {
for (fun in .getHooksList("sourceCpp.onBuild")) {
if (is.character(fun)) # #nocov start
fun <- get(fun)
# allow the hook to cancel the build (errors in the hook explicitly
# do not cancel the build since they are unexpected bugs)
continue <- tryCatch(fun(file, fromCode, showOutput),
error = function(e) TRUE)
if (!continue)
return (FALSE) # #nocov end
}
return (TRUE)
}
# Call the onBuildComplete hook. This hook is provided so that external tools
# can do analysis of build errors and (for example) present them in a
# navigable list. Note that the output parameter will be NULL when showOutput
# is TRUE. Tools can try to scrape the output from the console (in an
# implemenentation-dependent fashion) or can simply not rely on output
# processing in that case (since the user explicitly asked for output to be
# printed to the console). The onBuildCompleted hook is always called within
# the temporary build directory.
.callBuildCompleteHook <- function(succeeded, output) {
# Call the hooks in reverse order to align sequencing with onBuild
for (fun in .getHooksList("sourceCpp.onBuildComplete")) {
if (is.character(fun)) # #nocov start
fun <- get(fun)
try(fun(succeeded, output)) # #nocov end
}
}
# The value for getHooks can be a single function or a list of functions,
# This function ensures that the result can always be processed as a list
.getHooksList <- function(name) {
hooks <- getHook(name)
if (!is.list(hooks))
hooks <- list(hooks) # #nocov
hooks
}
# Generate list of includes based on LinkingTo. The pluginsOnly parameter
# to distinguish the case of capturing all includes needed for a compiliation
# (e.g. cppFunction) verses only needing to capture as/wrap converters which
# is the case for generation of shims (RcppExports.cpp) and Rcpp::interfaces
# package header files.
.linkingToIncludes <- function(linkingTo, pluginsOnly) {
# This field can be NULL or empty -- in that case just return Rcpp.h
if (is.null(linkingTo) || !nzchar(linkingTo))
return (c("#include ")) # #nocov
# Look for Rcpp inline plugins within the list or LinkedTo packages
include.before <- character()
include.after <- character()
linkingToPackages <- .parseLinkingTo(linkingTo)
for (package in linkingToPackages) {
# We already handle Rcpp internally
if (identical(package, "Rcpp"))
next
# see if there is a plugin that we can extract includes from
plugin <- .getInlinePlugin(package) # #nocov start
if (!is.null(plugin)) {
includes <- .pluginIncludes(plugin)
if (!is.null(includes)) {
include.before <- c(include.before, includes$before)
include.after <- c(include.after, includes$after)
}
}
# otherwise check for standard Rcpp::interfaces generated include
else if (!pluginsOnly) {
pkgPath <- find.package(package, NULL, quiet=TRUE)
if (length(pkgPath) == 0) {
stop(paste("Package '", package, "' referenced from ",
"LinkingTo directive is not available.", sep=""),
call. = FALSE)
}
pkgHeader <- paste(package, ".h", sep="")
pkgHeaderPath <- file.path(pkgPath, "include", pkgHeader)
if (file.exists(pkgHeaderPath)) {
pkgInclude <- paste("#include <", pkgHeader, ">", sep="")
include.after <- c(include.after, pkgInclude)
}
} # #nocov end
}
# return the includes
c(include.before, "#include ", include.after)
}
# Analyze the plugin's includes field to determine include.before and
# include.after. We are ONLY interested in plugins that work with Rcpp since
# the only types we need from includes are as/wrap marshallers. Therefore,
# we verify that the plugin was created using Rcpp.plugin.maker and then
# use that assumption to correctly extract include.before and include.after
.pluginIncludes <- function(plugin) {
# #nocov start
# First determine the standard suffix of an Rcpp plugin by calling
# Rcpp.plugin.maker. If the plugin$includes has this suffix we know
# it's an Rcpp plugin
token <- "include_after_token"
stockRcppPlugin <- Rcpp.plugin.maker(include.after=token)
includes <- stockRcppPlugin()$includes
suffix <- strsplit(includes, token)[[1]][[2]]
# now ask the plugin for it's includes, ensure that the plugin includes
# are not null, and verify they have the Rcpp suffix before proceeding
pluginIncludes <- plugin()$includes
if (is.null(pluginIncludes))
return (NULL)
if (!grepl(suffix, pluginIncludes))
return (NULL)
# strip the suffix then split on stock Rcpp include to get before and after
pluginIncludes <- strsplit(pluginIncludes, suffix)[[1]][[1]]
pluginIncludes <- strsplit(pluginIncludes, c("#include "))[[1]]
# extract before and after and nix empty lines
before <- pluginIncludes[[1]]
before <- strsplit(before, "\n")[[1]]
before <- before[nzchar(before)]
after <- pluginIncludes[[2]]
after <- strsplit(after, "\n")[[1]]
after <- after[nzchar(after)]
# return before and after
list(before = before, after = after) # #nocov end
}
# Parse a LinkingTo field into a character vector
.parseLinkingTo <- function(linkingTo) {
if (is.null(linkingTo))
return (character()) # #nocov
linkingTo <- strsplit(linkingTo, "\\s*\\,")[[1]]
result <- gsub("\\s", "", linkingTo)
gsub("\\(.*", "", result)
}
# show diagnostics for failed builds
.showBuildFailureDiagnostics <- function() {
# #nocov start
# RStudio does it's own diagnostics so only do this for other environments
if (nzchar(Sys.getenv("RSTUDIO")))
return();
# if we can't call R CMD SHLIB then notify the user they should
# install the appropriate development tools
if (!.checkDevelTools()) {
msg <- paste("\nWARNING: The tools required to build C++ code for R ",
"were not found.\n\n", sep="")
sysName <- Sys.info()[['sysname']]
if (identical(sysName, "Windows")) {
msg <- paste(msg, "Please download and install the appropriate ",
"version of Rtools:\n\n",
"http://cran.r-project.org/bin/windows/Rtools/\n",
sep="");
} else if (identical(sysName, "Darwin")) {
msg <- paste(msg, "Please install Command Line Tools for XCode ",
"(or equivalent).\n", sep="")
} else {
msg <- paste(msg, "Please install GNU development tools ",
"including a C++ compiler.\n", sep="")
}
message(msg)
} # #nocov end
}
# check if R development tools are installed (cache successful result)
.hasDevelTools <- FALSE
.checkDevelTools <- function() {
if (!.hasDevelTools) { # #nocov start
# create temp source file
tempFile <- file.path(tempdir(), "foo.c")
cat("void foo() {}\n", file = tempFile)
on.exit(unlink(tempFile))
# set working directory to tempdir (revert on exit)
oldDir <- setwd(tempdir())
on.exit(setwd(oldDir), add = TRUE)
# attempt the compilation and note whether we succeed
cmd <- paste(R.home(component="bin"), .Platform$file.sep, "R ",
"CMD SHLIB foo.c", sep = "")
result <- suppressWarnings(system(cmd,
ignore.stderr = TRUE,
intern = TRUE))
utils::assignInMyNamespace(".hasDevelTools", is.null(attr(result, "status")))
# if we build successfully then remove the shared library
if (.hasDevelTools) {
lib <- file.path(tempdir(),
paste("foo", .Platform$dynlib.ext, sep=''))
unlink(lib)
}
}
.hasDevelTools # #nocov end
}
# insert a dynlib entry into the cache
.sourceCppDynlibInsert <- function(cacheDir, file, code, dynlib) {
cache <- .sourceCppDynlibReadCache(cacheDir)
index <- .sourceCppFindCacheEntryIndex(cache, file, code)
if (is.null(index))
index <- length(cache) + 1
cache[[index]] <- list(file = file, code = code, dynlib = dynlib)
.sourceCppDynlibWriteCache(cacheDir, cache)
}
# attempt to lookup a dynlib entry from the cache
.sourceCppDynlibLookup <- function(cacheDir, file, code) {
cache <- .sourceCppDynlibReadCache(cacheDir)
index <- .sourceCppFindCacheEntryIndex(cache, file, code)
if (!is.null(index))
cache[[index]]$dynlib
else
list()
}
# write the cache to disk
.sourceCppDynlibWriteCache <- function(cacheDir, cache) {
index_file <- file.path(cacheDir, "cache.rds")
save(cache, file = index_file, compress = FALSE)
}
# read the cache from disk
.sourceCppDynlibReadCache <- function(cacheDir) {
index_file <- file.path(cacheDir, "cache.rds")
if (file.exists(index_file)) {
load(file = index_file)
get("cache")
} else {
list()
}
}
# search the cache for an entry that matches the file or code argument
.sourceCppFindCacheEntryIndex <- function(cache, file, code) {
if (length(cache) > 0) {
for (i in 1:length(cache)) {
entry <- cache[[i]]
if ((nzchar(file) && identical(file, entry$file)) ||
(nzchar(code) && identical(code, entry$code))) {
if (file.exists(entry$dynlib$cppSourcePath))
return(i)
}
}
}
# none found
NULL
}
# generate an R version / Rcpp version specific cache dir for dynlibs
.sourceCppPlatformCacheDir <- function(cacheDir) {
dir <- file.path(cacheDir,
paste("sourceCpp",
R.version$platform,
utils::packageVersion("Rcpp"),
sep = "-"))
if (!utils::file_test("-d", dir))
dir.create(dir, recursive = TRUE)
dir
}
# generate a unique token for a cacheDir
.sourceCppDynlibUniqueToken <- function(cacheDir) {
# read existing token (or create a new one)
token_file <- file.path(cacheDir, "token.rds")
if (file.exists(token_file))
load(file = token_file)
else
token <- 0
# increment
token <- token + 1
# write it
save(token, file = token_file)
# return it as a string
as.character(token)
}
.extraRoutineRegistrations <- function(targetFile, routines) {
declarations = character()
call_entries = character()
# we are running R 3.4 or higher so we can use an internal utility function
# to automatically discover additional native routines that require registration
# determine the package directory
pkgdir <- dirname(dirname(targetFile))
# get the generated code from R
con <- textConnection(object = NULL, open = "w")
on.exit(close(con), add = TRUE)
tools::package_native_routine_registration_skeleton(
dir = pkgdir,
con = con,
character_only = FALSE
)
code <- textConnectionValue(con)
# look for lines containing call entries
matches <- regexec('^\\s+\\{"([^"]+)",.*$', code)
matches <- regmatches(code, matches)
matches <- Filter(x = matches, function(x) {
length(x) > 0 # #nocov start
})
for (match in matches) {
routine <- match[[2]]
if (!routine %in% routines) {
declaration <- grep(sprintf("^extern .* %s\\(.*$", routine), code,
value = TRUE)
# FIXME: maybe we should extend this to *any* routine?
# or is there any case in which `void *` is not SEXP for a .Call?
if (routine == "run_testthat_tests")
declaration <- gsub("void *", "SEXP", declaration, fixed=TRUE)
declarations <- c(declarations, sub("^extern", "RcppExport", declaration))
call_entries <- c(call_entries, match[[1]]) # #nocov end
}
}
# return extra declaratiosn and call entries
list(declarations = declarations,
call_entries = call_entries)
}
Rcpp/R/exceptions.R 0000644 0001762 0000144 00000003114 13036432110 013653 0 ustar ligges users # Copyright (C) 2009 - 2017 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
.rcpp_error_recorder <- function(e) {
invisible(.Call(rcpp_error_recorder, e)) # #nocov
}
.warningsEnv <- new.env()
.warningsEnv$warnings <- character()
.rcpp_warning_recorder <- function(w){
.warningsEnv$warnings <- append(.warningsEnv$warnings, w$message) # #nocov
invokeRestart("muffleWarning") # #nocov
}
.rcpp_collect_warnings <- function() {
warnings <- .warningsEnv$warnings # #nocov start
.warningsEnv$warnings <- character()
warnings # #nocov end
}
print.Rcpp_stack_trace <- function(x, ...) {
cat(format(x, ...)) # #nocov
}
str.Rcpp_stack_trace <- function(object, ...) {
cat(format(object, ...)) # #nocov
}
format.Rcpp_stack_trace <- function(x, ...) {
paste0( # #nocov start
if (nzchar(x$file)) paste0(x$file, ":", x$line),
"\n ", paste(collapse = "\n ", seq_along(x$stack), ":", x$stack), "\n")
} # #nocov end
Rcpp/R/02_completion.R 0000644 0001762 0000144 00000003353 13022667267 014173 0 ustar ligges users # Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
setGeneric( ".DollarNames" ) # #nocov start
.DollarNames.Module <- function(x, pattern){
pointer <- .getModulePointer( x )
if(identical(pointer, .badModulePointer)) {
stop( "unitialized module" )
}
grep( pattern , .Call( Module__complete, pointer), value = TRUE )
}
setMethod( ".DollarNames", "Module", .DollarNames.Module )
# completion for C++ objects
# do we actually need this or do we get it for free via setRefClass, etc ...
setGeneric( "complete", function(x) standardGeneric("complete") )
setMethod( "complete", "C++Object", function(x){
xp <- get(".cppclass", envir = as.environment(x))
# FIXME: implement another test
# if(identical(xp, .emptyPointer))
# stop("C++ object with unset pointer to C++ class")
.Call( CppClass__complete , xp )
} )
".DollarNames.C++Object" <- function( x, pattern ){
grep( pattern, complete(x), value = TRUE )
}
setMethod( ".DollarNames", "C++Object", `.DollarNames.C++Object` )
# #nocov end
Rcpp/R/bib.R 0000644 0001762 0000144 00000001446 13036432110 012234 0 ustar ligges users # Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
bib <- function() {
sub("\\.bib$", "", system.file("bib", "Rcpp.bib", package = "Rcpp"))
}
Rcpp/R/zzz.R 0000644 0001762 0000144 00000002062 15115301232 012330 0 ustar ligges users # Copyright (C) 2009 - 2025 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
.dummyInstancePointer <- new.env() # just something permanent
.classes_map <- new.env()
.onLoad <- function(libname, pkgname){
new_dummyObject(.dummyInstancePointer) # nocov start
tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
weave = asisWeave, tangle = asisTangle) # nocov end
}
Rcpp/R/tools.R 0000644 0001762 0000144 00000005546 14765550031 012662 0 ustar ligges users # Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
externalptr_address <- function(xp) {
.Call(as_character_externalptr, xp) # #nocov
}
# just like assignInNamespace but first checks that the binding exists
forceAssignInNamespace <- function(x, value, env) {
is_ns <- isNamespace(env)
unlocker <- get("unlockBinding", baseenv())
if (is_ns && exists(x, env) && bindingIsLocked(x, env)) {
unlocker(x, env) # #nocov
}
assign(x, value, env)
if (is_ns) {
lockBinding(x, env) # #nocov
}
}
# Transform a path for passing to the build system on the command line.
# Leave paths alone for posix. For Windows, mirror the behavior of the
# R package build system by starting with the fully resolved absolute path,
# transforming it to a short path name if it contains spaces, and then
# converting backslashes to forward slashes
asBuildPath <- function(path) {
if (.Platform$OS.type == "windows") {
path <- normalizePath(path) # #nocov start
if (grepl(' ', path, fixed=TRUE))
path <- utils::shortPathName(path)
path <- gsub("\\\\", "/", path) # #nocov end
}
return(path)
}
##' Helper function to report the package version of the R installation.
##'
##' While \code{packageVersion(Rcpp)} exports the version registers in
##' \code{DESCRIPTION}, this version does get incremented more easily
##' during development and can therefore be higher than the released
##' version. The actual \code{#define} long used at the C++ level
##' corresponds more to an \sQuote{API Version} which is now provided
##' by this function, and use for example in the package skeleton
##' generator.
##'
##' @title Export the Rcpp (API) Package Version
##' @param devel An logical value indicating if the development or
##' release version number should be returned, default is release.
##' @return A \code{package_version} object with either the release
##' or development version.
##' @author Dirk Eddelbuettel
##' @seealso \code{\link{packageVersion}},
##' \code{\link{Rcpp.package.skeleton}}
##' @examples getRcppVersion()
getRcppVersion <- function(devel = FALSE) {
rcpp <- .Call("getRcppVersionStrings", PACKAGE="Rcpp")
package_version(rcpp[if(devel) 2 else 1])
}
Rcpp/R/exposeClass.R 0000644 0001762 0000144 00000020076 13326145624 014006 0 ustar ligges users # Copyright (C) 2013 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
.stdHeader <- c( # #nocov start
"#include ",
"using namespace Rcpp ;"
)
.asString <- function(what) if(is.character(what)) what else deparse(what)
.strings <- function(expr) {
if(is.call(expr) && ! identical(expr[[1]], quote(`::`)))
lapply(as.list(expr)[-1], .strings)
else
.asString(expr)
}
.specifyItems <- function(what) {
what <- as.list(what)
wn <- allNames(what)
simple <- !nzchar(wn)
## todo: error checking here that unnamed elements are single strings
wn[simple] <- as.character(what[simple])
names(what) <- wn
what[simple] <- list(character())
what
}
.writeFieldFunction <- function(fldi, typei, CppClass, readOnly, ns, con){
rootName <- paste0("field_", fldi)
writeLines(sprintf(" %s %s_get(%s *obj) { return obj->%s; }\n",
typei, rootName, CppClass, fldi), con)
value <- "_get"
if(!readOnly) {
writeLines(sprintf(" void %s_set(%s *obj, %s value) { obj->%s = value; }\n",
rootName, CppClass, typei, fldi), con)
value <- c(value, "_set")
}
paste0(ns, "::field_", fldi, value)
}
.writeMethodFunction <- function(mdi, sigi, CppClass, ns, con) {
mName <- paste0("method_", mdi)
if(length(sigi) < 1)
stop(gettextf("The type signature for method %s for class %s was of length 0: Must at least include the return type",
mdi, CppClass))
rtnType <- sigi[[1]]
sigi <- sigi[-1]
if(length(sigi)) {
argNames <- paste0("a", seq_along(sigi))
args <- paste(" ,", paste(sigi, argNames, collapse = ", "))
}
else argNames <- args <- ""
writeLines(sprintf(" %s %s(%s *obj%s){ return obj->%s(%s); }\n",
rtnType, mName, CppClass, args, mdi, argNames), con)
paste0(ns, "::",mName)
}
exposeClass <- function(class, constructors, fields, methods,
file = paste0(CppClass, "Module.cpp"),
header = character(),
module = paste0("class_",class), CppClass = class,
readOnly = character(), rename = character(),
Rfile = TRUE) {
## some argument checks
## TODO: checks on constructors, fields, methods
if(length(readOnly)) {
readOnly <- as.character(readOnly)
if(!all(nzchar(readOnly)))
stop("argument readOnly should be a vector of non-empty strings")
}
newnames <- allNames(rename)
if(length(rename)) {
if(!all(sapply(rename, function(x) is.character(x) && length(x) == 1 && nzchar(x))))
stop("argument rename should be a vector of single, non-empty strings")
if(!all(nzchar(newnames)))
stop("all the elements of argument rename should be non-empty strings")
}
if(is.character(file)) {
## are we in a package directory? Writable, searchable src subdirectory:
if(file.access("src",3)==0 && (basename(file) == file))
cfile <- file.path("src", file)
else
cfile <- file
con <- file(cfile, "w")
on.exit({message(sprintf("Wrote C++ file \"%s\"", cfile)); close(con)})
}
else
con <- file
## and for the R code:
if(identical(Rfile, FALSE)) {}
else {
if(identical(Rfile, TRUE))
Rfile <- sprintf("%sClass.R",class)
if(is.character(Rfile)) {
if(file.access("R",3)==0 && (basename(file) == file)) # in a package directory
Rfile <- file.path("R", Rfile)
Rcon <- file(Rfile, "w")
msg <- sprintf("Wrote R file \"%s\"",Rfile)
on.exit({message(msg); close(Rcon)}, add = TRUE)
}
else
Rcon <- Rfile
Rfile <- TRUE
}
mfile <- tempfile()
mcon <- file(mfile, "w")
writeLines(.stdHeader, con)
if(length(header))
writeLines(header, con)
writeLines(c("", sprintf("RCPP_MODULE(%s) {\n",module), ""), mcon)
writeLines(sprintf(" class_<%s>(\"%s\")\n", CppClass, class), mcon)
## the constructors argument defines a list of vectors of types
for( cons in constructors) {
if(length(cons) > 1 ||
(length(cons) == 1 && nzchar(cons) && !identical(cons, "void")))
cons <- paste0("<", paste(cons, collapse = ","),">")
else
cons = ""
writeLines(paste0(" .constructor",cons,"()"),mcon)
}
writeLines("", mcon)
flds <- .specifyItems(fields)
nm <- fnm <- names(flds)
rdOnly <- nm %in% readOnly
macros <- ifelse(rdOnly, ".field_readonly", ".field")
test <- nm %in% rename
if(any(test))
nm[test] <- newnames[match(nm[test], rename)]
ns <- NULL
for(i in seq_along(nm)) {
typei <- flds[[i]]
fldi <- fnm[i]
nmi <- nm[[i]]
macroi <- macros[[i]]
if(!length(typei) || identical(typei, "")) ## direct field
writeLines(sprintf(" %s(\"%s\", &%s::%s)",
macroi, nmi, CppClass, fldi), mcon)
else { # create a free function, e.g. for an inherited field
if(is.null(ns)) { # enclose in a namespace
ns <- paste("module",class,"NS", sep = "_")
writeLines(sprintf("\nnamespace %s {\n", ns),
con)
}
fldFuns <- .writeFieldFunction(fldi, typei, CppClass, rdOnly[[i]], ns, con)
if(rdOnly[[i]])
## NOTE: string 3rd arg. required by problem w. module parsing 10/3/13
writeLines(sprintf(" .property(\"%s\", &%s, \"read-only field\")",
nmi, fldFuns[[1]]), mcon)
else
writeLines(sprintf(" .property(\"%s\", &%s, &%s)",
nmi, fldFuns[[1]], fldFuns[[2]]), mcon)
}
}
writeLines("", mcon)
sigs <- .specifyItems(methods)
nm <- mds <- names(sigs)
test <- nm %in% rename
if(any(test))
nm[test] <- newnames[match(nm[test], rename)]
for(i in seq_along(nm)) {
sigi <- sigs[[i]]
nmi <- nm[[i]]
mdi <- mds[[i]]
if(!length(sigi) || identical(sigi, "")) # direct method
writeLines(sprintf(" .method(\"%s\", &%s::%s)",
nmi, CppClass, mdi), mcon)
else { # create a free function, e.g. for an inherited method
if(is.null(ns)) { # enclose in a namespace
ns <- paste("module",class,"NS", sep = "_")
writeLines(sprintf("\nnamespace %s {\n", ns),
con)
}
mFun <- .writeMethodFunction(mdi, sigi, CppClass, ns, con)
writeLines(sprintf(" .method(\"%s\", &%s)",
nmi, mFun), mcon)
}
}
writeLines(" ;\n}", mcon)
close(mcon)
if(!is.null(ns))
writeLines(sprintf("} // %s", ns), con) # close namespace
writeLines(readLines(mfile), con)
if(Rfile) {
if(missing(CppClass))
CppString <- ""
else
CppString <- paste0(", \"",CppClass, "\"")
if(missing(module))
ModString <- ""
else
ModString <- paste0(", module = \"", module, "\"")
writeLines(sprintf("%s <- setRcppClass(\"%s\"%s%s)",
class, class, CppString,ModString), Rcon)
}
} # #nocov end
Rcpp/R/asis.R 0000644 0001762 0000144 00000005126 15126566764 012467 0 ustar ligges users ## These two functions are borrowed with grateful appreciation from the R.rsp package
## by Henrik Bengtsson licensed under LGPL (>= 2.1) and somewhat simplified / shortened
## feature-reduced here. Please see the R.rsp for a full-featured version and documentation
##' Simple \sQuote{asis} Vignette Processor
##'
##' To pass pre-made pdf vignettes through \dQuote{as is}, a simple vignette
##' process is added. It is derived from the more feature-complete one in the \pkg{R.rsp}
##' package. To use it, add files named like the pdf file plus an appended \code{.asis}
##' with the vignette metainformation and register the vignette processor, see the examples.
##'
##' @title Process pdf vignettes \sQuote{asis}
##' @name asisWeave
##' @param file character Filename to be processed
##' @param ... dots Currently ignored
##' @param pattern character A regular expression describing the filename pattern
##' @return The respective filename is returned, invisibly
##' @author Henrik Bengtsson for the original versions in package \pkg{R.rsp},
##' Dirk Eddelbuettel for the shortened ones used here
##' @examples
##' # To register this vignette engine in another package, add
##' # \code{VignetteBuilder: Rcpp} as well as \code{Suggests: Rcpp} to \code{DESCRIPTION}
##' # which uses the registration this package provides via
##' \dontrun{tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
##' weave = asisWeave, tangle = asisTangle)}
##'
##' # Use a .asis file as in the Rcpp package, for example Rcpp-FAQ.pdf.asis has these lines:
##' # %\VignetteIndexEntry{Rcpp-FAQ}
##' # %\VignetteKeywords{Rcpp, FAQ, R, Cpp}
##' # %\VignettePackage{Rcpp}
##' # %\VignetteEncoding{UTF-8}
##' # %\VignetteEngine{Rcpp::asis}
asisWeave <- function (file, ...) { # #nocov start
output <- tools::file_path_sans_ext(basename(file))
if (!file.exists(output)) {
outputS <- file.path("..", "inst", "doc", output)
if (file.exists(outputS)) {
file.copy(outputS, output, overwrite = TRUE)
output <- outputS
} else {
stop("No file to process", call. = FALSE)
}
}
Sys.setFileTime(output, time = Sys.time())
invisible(output)
}
##' @rdname asisWeave
asisTangle <- function (file, ..., pattern = "(|[.][^.]*)[.]asis$") {
workdir <- "."
filename <- basename(file)
fullname <- gsub(pattern, "", filename)
filenameR <- sprintf("%s.R", fullname)
cat(sprintf("### This is an R script tangled from '%s'\n", filename), file = filenameR)
invisible(filenameR)
} # #nocov end
Rcpp/R/01_show.R 0000644 0001762 0000144 00000010230 13257743257 012775 0 ustar ligges users # Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
setMethod( "show", "C++Object", function(object){ # #nocov start
env <- as.environment(object)
pointer <- get(".pointer", envir = env)
cppclass <- get(".cppclass", envir = env)
txt <- sprintf( "C++ object <%s> of class '%s' <%s>",
externalptr_address(pointer),
.Call( Class__name, cppclass ),
externalptr_address(cppclass)
)
writeLines( txt )
} )
setMethod( "show", "C++Class", function(object){
doc <- object@docstring
txt <- sprintf( "C++ class '%s' <%s>%s",
.Call( Class__name, object@pointer ),
externalptr_address(object@pointer),
if( length(doc) && nchar(doc) ) sprintf( "\n docstring : %s", doc ) else ""
)
writeLines( txt )
ctors <- object@constructors
nctors <- length( ctors )
txt <- character( nctors )
for( i in seq_len(nctors) ){
ctor <- ctors[[i]]
doc <- ctor$docstring
txt[i] <- sprintf( " %s%s", ctor$signature, if( nchar(doc) ) sprintf( "\n docstring : %s", doc) else "" )
}
writeLines( "Constructors:" )
writeLines( paste( txt, collapse = "\n" ) )
fields <- object@fields
nfields <- length(fields)
if( nfields ){
names <- names(fields)
txt <- character(nfields)
writeLines( "\nFields: " )
for( i in seq_len(nfields) ){
f <- fields[[i]]
doc <- f$docstring
txt[i] <- sprintf( " %s %s%s%s",
f$cpp_class,
names[i],
if( f$read_only ) " [readonly]" else "",
if( nchar(doc) ) sprintf( "\n docstring : %s", doc ) else ""
)
}
writeLines( paste( txt, collapse = "\n" ) )
} else {
writeLines( "\nFields: No public fields exposed by this class" )
}
mets <- object@methods
nmethods <- length(mets)
if( nmethods ){
writeLines( "\nMethods: " )
txt <- character( nmethods )
for( i in seq_len(nmethods) ){
txt[i] <- mets[[i]]$info(" ")
}
writeLines( paste( txt, collapse = "\n" ) )
} else {
writeLines( "\nMethods: no methods exposed by this class" )
}
} )
setMethod( "show", "C++Function", function(object){
txt <- sprintf( "internal C++ function <%s>", externalptr_address(object@pointer) )
writeLines( txt )
doc <- object@docstring
if( length(doc) && nchar( doc ) ){
writeLines( sprintf( " docstring : %s", doc ) )
}
sign <- object@signature
if( length(sign) && nchar( sign ) ){
writeLines( sprintf( " signature : %s", sign ) )
}
} )
setMethod( "show", "Module", function( object ){
pointer <- .getModulePointer(object, FALSE)
if(identical(pointer, .badModulePointer)) {
object <- as.environment(object) ## not needed when 2.12.0 arrives
txt <- sprintf("Uninitialized module named \"%s\" from package \"%s\"",
get("moduleName", envir = object),
get("packageName", envir = object))
writeLines(txt)
}
else {
info <- .Call( Module__functions_arity, pointer )
name <- .Call( Module__name, pointer )
txt <- sprintf( "Rcpp module '%s' \n\t%d functions: ", name, length(info) )
writeLines( txt )
txt <- sprintf( "%15s : %d arguments", names(info), info )
writeLines( txt )
info <- .Call( Module__classes_info, pointer )
txt <- sprintf( "\n\t%d classes : ", length(info) )
writeLines( txt )
txt <- sprintf( "%15s ", names(info) )
writeLines( txt )
}
} ) # #nocov end
Rcpp/R/00_classes.R 0000644 0001762 0000144 00000006363 13257743257 013465 0 ustar ligges users # Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
# anticipating a change in R 2.16.0
setClass( "refClassGeneratorFunction" ) # #nocov start
setClassUnion("refGenerator", c("refObjectGenerator", "refClassGeneratorFunction"))
## "Module" class as an environment with "pointer", "moduleName",
## "packageName" and "refClassGenerators"
## Stands in for a reference class with those fields.
setClass( "Module", contains = "environment" )
setRefClass( "C++Field",
fields = list(
pointer = "externalptr",
cpp_class = "character",
read_only = "logical",
class_pointer = "externalptr",
docstring = "character"
)
)
setRefClass( "C++OverloadedMethods",
fields = list(
pointer = "externalptr",
class_pointer = "externalptr",
size = "integer",
void = "logical",
const = "logical",
docstrings = "character",
signatures = "character",
nargs = "integer"
),
methods = list(
info = function(prefix = " " ){
paste(
paste( prefix, signatures, ifelse(const, " const", "" ), "\n", prefix, prefix,
ifelse( nchar(docstrings), paste( "docstring :", docstrings) , "" )
) , collapse = "\n" )
}
)
)
setRefClass( "C++Constructor",
fields = list(
pointer = "externalptr",
class_pointer = "externalptr",
nargs = "integer",
signature = "character",
docstring = "character"
)
)
setClass( "C++Class",
representation(
pointer = "externalptr",
module = "externalptr",
fields = "list",
methods = "list",
constructors = "list",
generator = "refGenerator",
docstring = "character",
typeid = "character",
enums = "list",
parents = "character"
),
contains = "character"
)
setClass( "C++Object")
setClass( "C++Function",
representation(
pointer = "externalptr",
docstring = "character",
signature = "character"
),
contains = "function"
)
.cppfunction_formals_gets <- function (fun, envir = environment(fun), value) {
bd <- body(fun)
b2 <- bd[[2L]]
for( i in seq_along(value) ){
b2[[3L+i]] <- as.name( names(value)[i] )
}
bd[[2]] <- b2
f <- fun@.Data
formals(f) <- value
body(f) <- bd
fun@.Data <- f
fun
}
setGeneric( "formals<-" )
setMethod( "formals<-", "C++Function", .cppfunction_formals_gets ) # #nocov end
Rcpp/R/03_prompt.R 0000644 0001762 0000144 00000004571 13022667267 013347 0 ustar ligges users # Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
setGeneric( "functions", function(object, ...) standardGeneric( "functions" ) ) # #nocov start
setMethod( "functions", "Module", function(object, ...){
pointer <- .getModulePointer(object)
if(identical(pointer, .badModulePointer))
stop(gettextf("Module \"%s\" has not been intialized: try Module(object)",
get("moduleName", envir = as.environment(object))), domain = NA)
else
.Call( Module__functions_arity, pointer )
} )
setGeneric( "prompt" )
setMethod( "prompt", "Module", function(object, filename = NULL, name = NULL, ...){
lines <- readLines( system.file( "prompt", "module.Rd", package = "Rcpp" ) )
pointer <- .getModulePointer(object)
if( is.null(name) )
name <- .Call( Module__name, pointer )
if( is.null(filename) ) filename <- sprintf( "%s-module.Rd", name )
lines <- gsub( "NAME", name, lines )
info <- functions( object )
f.txt <- if( length( info ) ){
sprintf( "functions: \\\\describe{
%s
}", paste( sprintf( " \\\\item{%s}{ ~~ description of function %s ~~ }", names(info), names(info) ), collapse = "\n" ) )
} else {
""
}
lines <- sub( "FUNCTIONS", f.txt, lines )
## at this point functions() would have failed if the
## pointer in object was not valid
classes <- .Call( Module__classes_info, pointer )
c.txt <- if( length( classes ) ){
sprintf( "classes: \\\\describe{
%s
}", paste( sprintf( " \\\\item{%s}{ ~~ description of class %s ~~ }", names(classes), names(classes) ), collapse = "\n" ) )
} else {
""
}
lines <- sub( "CLASSES", c.txt, lines )
writeLines( lines, filename )
invisible(NULL)
} ) # nocov end
Rcpp/R/Module.R 0000644 0001762 0000144 00000042777 15126566764 012772 0 ustar ligges users # Copyright (C) 2010 - 2026 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
internal_function <- function(pointer){
f <- function(xp){
force(xp)
function(...){
.External( InternalFunction_invoke, xp, ... )
}
}
o <- new( "C++Function", f(pointer) )
o@pointer <- pointer
o
}
setMethod("$", "C++Class", function(x, name) {
x <- x@generator
eval.parent(substitute(x$name))
})
.badModulePointer <- NULL
.setModulePointer <- function(module, value) {
assign("pointer", value, envir = as.environment(module))
value
}
.getModulePointer <- function(module, mustStart = TRUE) {
pointer <- get("pointer", envir = as.environment(module))
if(is.null(pointer) && mustStart) { # #nocov start
## should be (except for bug noted in identical())
## if(identical(pointer, .badModulePointer) && mustStart) {
Module(module, mustStart = TRUE) # will either initialize pointer or throw error
pointer <- get("pointer", envir = as.environment(module))
} # #nocov end
pointer
}
setMethod("initialize", "Module",
function(.Object,
moduleName = "UNKNOWN",
packageName = "",
pointer = .badModulePointer, ...) {
env <- new.env(TRUE, emptyenv())
as(.Object, "environment") <- env
assign("pointer", pointer, envir = env)
assign("packageName", packageName, envir = env)
assign("moduleName", moduleName, envir = env)
if(length(list(...)) > 0) {
.Object <- callNextMethod(.Object, ...) # #nocov
}
.Object
})
.get_Module_function <- function(x, name, pointer = .getModulePointer(x) ){
pointer <- .getModulePointer(x)
info <- .Call( Module__get_function, pointer, name )
fun_ptr <- info[[1L]]
is_void <- info[[2L]]
doc <- info[[3L]]
sign <- info[[4L]]
formal_args <- info[[5L]]
nargs <- info[[6L]]
f <- function(...) NULL
if( nargs == 0L ) formals(f) <- NULL
stuff <- list( fun_pointer = fun_ptr, InternalFunction_invoke = InternalFunction_invoke )
body(f) <- if( nargs == 0L ){
if( is_void ) {
substitute( { # #nocov start
.External( InternalFunction_invoke, fun_pointer)
invisible(NULL)
}, stuff ) # #nocov end
} else {
substitute( {
.External( InternalFunction_invoke, fun_pointer)
}, stuff )
}
} else {
if( is_void ) {
substitute( { # #nocov start
.External( InternalFunction_invoke, fun_pointer, ... )
invisible(NULL)
}, stuff ) # #nocov end
} else {
substitute( {
.External( InternalFunction_invoke, fun_pointer, ... )
}, stuff )
}
}
out <- new( "C++Function", f, pointer = fun_ptr, docstring = doc, signature = sign )
if( ! is.null( formal_args ) ){
formals( out ) <- formal_args # #nocov
}
out
}
.get_Module_Class <- function( x, name, pointer = .getModulePointer(x) ){
value <- .Call( Module__get_class, pointer, name )
value@generator <- get("refClassGenerators", envir=x)[[value@.Data]]
value
}
setMethod( "$", "Module", function(x, name){ # #nocov start
pointer <- .getModulePointer(x)
storage <- get( "storage", envir = as.environment(x) )
storage[[ name ]]
} ) # #nocov end
new_CppObject_xp <- function(module, pointer, ...) {
.External( class__newInstance, module, pointer, ... )
}
new_dummyObject <- function(...) # #nocov
.External( class__dummyInstance, ...) # #nocov
# class method for $initialize
cpp_object_initializer <- function(.self, .refClassDef, ..., .object_pointer){
# force finalize method to be materialized
invisible(.self$finalize)
selfEnv <- as.environment(.self)
## generate the C++-side object and store its pointer, etc.
## access the private fields in the fieldPrototypes env.
fields <- .refClassDef@fieldPrototypes
pointer <- if(missing(.object_pointer)) new_CppObject_xp(fields$.module, fields$.pointer, ...) else .object_pointer
assign(".module", fields$.module, envir = selfEnv)
assign(".pointer", pointer, envir = selfEnv)
assign(".cppclass", fields$.pointer, envir = selfEnv)
.self
}
cpp_object_dummy <- function(.self, .refClassDef) { # #nocov start
selfEnv <- as.environment(.self)
## like initializer but a dummy for the case of no default
## constructor. Will throw an error if the object is used.
fields <- .refClassDef@fieldPrototypes
pointer <- new_dummyObject()
assign(".module", fields$.module, envir = selfEnv)
assign(".pointer", pointer, envir = selfEnv)
assign(".cppclass", fields$.pointer, envir = selfEnv)
.self
} # #nocov end
cpp_object_maker <- function(typeid, pointer){
Class <- .classes_map[[ typeid ]]
new( Class, .object_pointer = pointer )
}
Module <- function( module, PACKAGE = methods::getPackageName(where), where = topenv(parent.frame()), mustStart = FALSE ) {
if (inherits(module, "DLLInfo") && missing(mustStart)) mustStart <- TRUE # #nocov
if (inherits(module, "Module")) {
xp <- .getModulePointer(module, FALSE)
if(!missing(PACKAGE))
warning("ignoring PACKAGE argument in favor of internal package from Module object") # #nocov
env <- as.environment(module) # not needed from R 2.12.0
PACKAGE <- get("packageName", envir = env)
moduleName <- get("moduleName", envir = env)
}
else if( identical( typeof( module ), "externalptr" ) ){
## [john] Should Module() ever be called with a pointer as argument?
## If so, we need a safe check of the pointer's validity
## [romain] I don't think we actually can, external pointers
## are stored as void*, they don't know what they are. Or we could
## perhaps keep a vector of all known module pointers
## [John] One technique is to initialize the pointer to a known value
## and just check whether it's been reset from that (bad) value
xp <- module # #nocov start
moduleName <- .Call( Module__name, xp )
module <- methods::new("Module", pointer = xp, packageName = PACKAGE,
moduleName = moduleName) # #nocov end
} else if(is.character(module)) {
moduleName <- module
xp <- .badModulePointer
module <- methods::new("Module", pointer = xp, packageName = PACKAGE,
moduleName = moduleName)
}
if(identical(xp, .badModulePointer)) {
if(mustStart) {
name <- sprintf( "_rcpp_module_boot_%s", moduleName )
symbol <- tryCatch(getNativeSymbolInfo( name, PACKAGE ),
error = function(e)e)
if(inherits(symbol, "error"))
stop(gettextf("Failed to initialize module pointer: %s",
symbol), domain = NA)
xp <- .Call( symbol )
.setModulePointer(module, xp)
}
else
return(module)
}
classes <- .Call( Module__classes_info, xp )
## We need a general strategy for assigning class defintions
## since delaying the initialization of the module causes
## where to be the Rcpp namespace:
if(environmentIsLocked(where))
where <- .GlobalEnv # or???
generators <- list()
storage <- new.env()
for( i in seq_along(classes) ){
CLASS <- classes[[i]]
clname <- CLASS@.Data
fields <- cpp_fields( CLASS, where )
methods <- cpp_refMethods(CLASS, where)
generator <- methods::setRefClass( clname,
fields = fields,
contains = "C++Object",
methods = methods,
where = where
)
# just to make codetools happy
.self <- .refClassDef <- NULL
generator$methods(initialize =
if (cpp_hasDefaultConstructor(CLASS))
function(...) Rcpp::cpp_object_initializer(.self,.refClassDef, ...)
else
function(...) {
if (nargs()) Rcpp::cpp_object_initializer(.self,.refClassDef, ...)
else Rcpp::cpp_object_dummy(.self, .refClassDef) # #nocov
}
)
rm( .self, .refClassDef )
classDef <- methods::getClass(clname)
## non-public (static) fields in class representation
## Should these become real fields?
fields <- classDef@fieldPrototypes
assign(".pointer", CLASS@pointer, envir = fields)
assign(".module", xp, envir = fields)
assign(".CppClassName", clname, envir = fields)
generators[[clname]] <- generator
# [romain] : should this be promoted to reference classes
# perhaps with better handling of j and ... arguments
if( any( grepl( "^[[]", names(CLASS@methods) ) ) ){ # #nocov start
if( "[[" %in% names( CLASS@methods ) ){
methods::setMethod( "[[", clname, function(x, i, j, ..., exact = TRUE){
x$`[[`( i )
}, where = where )
}
if( "[[<-" %in% names( CLASS@methods ) ){
methods::setReplaceMethod( "[[", clname, function(x, i, j, ..., exact = TRUE, value){
x$`[[<-`( i, value )
x
} , where = where )
}
} # #nocov end
# promoting show to S4
if( any( grepl( "show", names(CLASS@methods) ) ) ){
setMethod( "show", clname, function(object) object$show(), where = where ) # #nocov
}
}
if(length(classes)) {
module$refClassGenerators <- generators
}
for( i in seq_along(classes) ){
CLASS <- classes[[i]]
clname <- CLASS@.Data
demangled_name <- sub( "^Rcpp_", "", clname )
.classes_map[[ CLASS@typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp )
# exposing enums values as CLASS.VALUE
# (should really be CLASS$value but I don't know how to do it)
if( length( CLASS@enums ) ){
for( enum in CLASS@enums ){ # #nocov start
for( i in 1:length(enum) ){
storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]
}
} # #nocov end
}
}
# functions
functions <- .Call( Module__functions_names, xp )
for( fun in functions ){
storage[[ fun ]] <- .get_Module_function( module, fun, xp )
# register as(FROM, TO) methods
converter_rx <- "^[.]___converter___(.*)___(.*)$"
if( length( matches <- grep( converter_rx, functions ) ) ){ # #nocov start
for( i in matches ){
fun <- functions[i]
from <- sub( converter_rx, "\\1", fun )
to <- sub( converter_rx, "\\2", fun )
converter <- function( from ){}
body( converter ) <- substitute( { CONVERT(from) },
list( CONVERT = storage[[fun]] )
)
setAs( from, to, converter, where = where )
}
} # #nocov end
}
assign( "storage", storage, envir = as.environment(module) )
module
}
dealWith <- function( x ) if(isTRUE(x[[1]])) invisible(NULL) else x[[2]] # #nocov
method_wrapper <- function( METHOD, where ){
noargs <- all( METHOD$nargs == 0 )
stuff <- list(
class_pointer = METHOD$class_pointer,
pointer = METHOD$pointer,
CppMethod__invoke = CppMethod__invoke,
CppMethod__invoke_void = CppMethod__invoke_void,
CppMethod__invoke_notvoid = CppMethod__invoke_notvoid,
dealWith = dealWith,
docstring = METHOD$info("")
)
f <- function(...) NULL
if( noargs ){
formals(f) <- NULL
}
extCall <- if( noargs ) {
if( all( METHOD$void ) ){
# all methods are void, so we know we want to return invisible(NULL)
substitute(
{
docstring
.External(CppMethod__invoke_void, class_pointer, pointer, .pointer )
invisible(NULL)
} , stuff )
} else if( all( ! METHOD$void ) ){
# none of the methods are void so we always return the result of
# .External
substitute(
{
docstring
.External(CppMethod__invoke_notvoid, class_pointer, pointer, .pointer )
} , stuff )
} else {
# some are void, some are not, so the voidness is part of the result
# we get from internally and we need to deal with it
substitute( # #nocov start
{
docstring
dealWith( .External(CppMethod__invoke, class_pointer, pointer, .pointer ) )
} , stuff ) # #nocov end
}
} else {
if( all( METHOD$void ) ){
# all methods are void, so we know we want to return invisible(NULL)
substitute(
{
docstring
.External(CppMethod__invoke_void, class_pointer, pointer, .pointer, ...)
invisible(NULL)
} , stuff )
} else if( all( ! METHOD$void ) ){
# none of the methods are void so we always return the result of
# .External
substitute(
{
docstring
.External(CppMethod__invoke_notvoid, class_pointer, pointer, .pointer, ...)
} , stuff )
} else {
# some are void, some are not, so the voidness is part of the result
# we get from internally and we need to deal with it
substitute( # #nocov start
{
docstring
dealWith( .External(CppMethod__invoke, class_pointer, pointer, .pointer, ...) )
} , stuff ) # #nocov end
}
}
body(f, where) <- extCall
f
}
## create a named list of the R methods to invoke C++ methods
## from the C++ class with pointer xp
cpp_refMethods <- function(CLASS, where) {
finalizer <- eval( substitute(
function(){
.Call( CppObject__finalize, class_pointer , .pointer )
},
list(
CLASS = CLASS@pointer,
CppObject__finalize = CppObject__finalize,
class_pointer = CLASS@pointer
)
) )
mets <- c(
sapply( CLASS@methods, method_wrapper, where = where ),
"finalize" = finalizer
)
mets
}
cpp_hasDefaultConstructor <- function(CLASS) {
.Call( Class__has_default_constructor, CLASS@pointer )
}
binding_maker <- function( FIELD, where ){
f <- function( x ) NULL
body(f) <- substitute({
if( missing( x ) )
.Call( CppField__get, class_pointer, pointer, .pointer)
else
.Call( CppField__set, class_pointer, pointer, .pointer, x)
}, list(class_pointer = FIELD$class_pointer,
pointer = FIELD$pointer,
CppField__get = CppField__get,
CppField__set = CppField__set ))
environment(f) <- where
f
}
cpp_fields <- function( CLASS, where){
sapply( CLASS@fields, binding_maker, where = where )
}
.CppClassName <- function(name) {
paste0("Rcpp_",name) # #nocov
}
Rcpp/R/inline.R 0000644 0001762 0000144 00000003706 15126566764 013010 0 ustar ligges users # Copyright (C) 2009 - 2026 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
Rcpp.plugin.maker <- function(include.before = "",
include.after = "",
LinkingTo = unique(c(package, "Rcpp")),
Depends = unique(c(package, "Rcpp")),
Imports = unique(c(package, "Rcpp")),
libs = "",
Makevars = NULL ,
Makevars.win = NULL,
package = "Rcpp") {
function(...) {
includes <- sprintf("%s
#include
%s
#ifndef BEGIN_RCPP
#define BEGIN_RCPP
#endif
#ifndef END_RCPP
#define END_RCPP
#endif
using namespace Rcpp;", include.before, include.after)
out <- list(env = list( PKG_LIBS = libs ),
includes = includes,
LinkingTo = LinkingTo ,
body = function( x ) {
sprintf( "BEGIN_RCPP\n%s\nEND_RCPP", x ) # #nocov
},
Depends = Depends,
Imports = Imports)
if (!is.null(Makevars)) out$Makevars <- Makevars
if (!is.null(Makevars.win)) out$Makevars.win <- Makevars.win
out
}
}
inlineCxxPlugin <- Rcpp.plugin.maker()
Rcpp/R/populate.R 0000644 0001762 0000144 00000002056 12253723677 013354 0 ustar ligges users # Copyright (C) 2010 - 2011 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
populate <- function( module, env ){
# make sure the module is loaded
module <- Module( module, mustStart = TRUE )
storage <- get( "storage", as.environment(module ) )
symbols <- ls( storage )
is_ns <- isNamespace( env )
for( x in symbols ){
forceAssignInNamespace( x, storage[[x]], env )
}
}
Rcpp/R/Rcpp.package.skeleton.R 0000644 0001762 0000144 00000025565 15126566764 015662 0 ustar ligges users # Copyright (C) 2009 - 2026 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
environment = .GlobalEnv,
path = ".", force = FALSE,
code_files = character(), cpp_files = character(),
example_code = TRUE, attributes = TRUE, module = FALSE,
author = "Your Name",
maintainer = if (missing(author)) "Your Name"
else author,
email = "your@email.com",
githubuser = NA_character_,
license = "GPL (>= 2)") {
havePkgKitten <- requireNamespace("pkgKitten", quietly=TRUE)
call <- match.call()
call[[1]] <- as.name("package.skeleton")
env <- parent.frame(1)
if (!is.character(cpp_files))
stop("'cpp_files' must be a character vector") # #nocov
if (!length(list)) {
fake <- TRUE
assign("Rcpp.fake.fun", function() {}, envir = env)
if (example_code && !isTRUE(attributes)) {
assign("rcpp_hello_world", function() {}, envir = env)
remove_hello_world <- TRUE
} else {
remove_hello_world <- FALSE
}
} else {
if (example_code && !isTRUE(attributes)) {
if (!"rcpp_hello_world" %in% list) { # #nocov start
assign( "rcpp_hello_world", function() {}, envir = env)
call[["list"]] <- as.call(c(as.name("c"),
as.list(c("rcpp_hello_world", list))))
}
remove_hello_world <- TRUE # #nocov end
} else {
remove_hello_world <- FALSE
}
fake <- FALSE
}
## first let the traditional version do its business
## remove Rcpp specific arguments
call <- call[ c(1L, which(names(call) %in% names(formals(package.skeleton)))) ]
if (fake) {
call[["list"]] <- c(if(isTRUE(example_code)
&& !isTRUE(attributes)) "rcpp_hello_world", "Rcpp.fake.fun")
}
tryCatch(eval(call, envir = env), error = function(e){
stop(sprintf("error while calling `package.skeleton` : %s", conditionMessage(e))) # #nocov
})
message("\nAdding Rcpp settings")
## now pick things up
root <- file.path(path, name)
# Add Rcpp to the DESCRIPTION
DESCRIPTION <- file.path(root, "DESCRIPTION")
if (file.exists(DESCRIPTION)) {
imports <- c(if (isTRUE(module)) "methods", sprintf("Rcpp (>= %s)", getRcppVersion()))
splitname <- strsplit(author, " ")[[1]]
x <- cbind(read.dcf(DESCRIPTION, fields = c("Package", "Type", "Title", "Version", "Date",
"Description", "License")),
"Imports" = paste(imports, collapse = ", "),
"LinkingTo" = "Rcpp",
"Authors@R" = sprintf("person(\"%s\", \"%s\", role = c(\"aut\", \"cre\"), email = \"%s\")",
paste(splitname[-length(splitname)], collapse=" "),
splitname[length(splitname)],
email))
fields_written <- c("Package", "Type", "Title", "Version", "Date",
"Authors@R", "Description", "License", "Imports", "LinkingTo")
if (!is.na(githubuser)) { # #nocov start
x <- cbind(x, matrix("", 1, 1, dimnames=list("", "URL")))
x[1, "URL"] <- paste0("https://github.com/", githubuser, "/", name)
x <- cbind(x, matrix("", 1, 1, dimnames=list("", "BugReports")))
x[1, "BugReports"] <- paste0("https://github.com/", githubuser, "/", name, "/issues")
fields_written <- c("Package", "Type", "Title", "Version", "Date",
"Authors@R", "Description", "URL", "BugReports",
"License", "Imports", "LinkingTo")
} # #nocov end
x[, "License"] <- license
x[, "Title"] <- "Concise Summary of What the Package Does"
x[, "Description"] <- "More about what it does (maybe more than one line)."
x[, "Version"] <- "0.0.1"
message( " >> added Imports: Rcpp" )
message( " >> added LinkingTo: Rcpp" )
write.dcf(x[1, fields_written, drop = FALSE], file = DESCRIPTION)
}
## add useDynLib and importFrom to NAMESPACE
NAMESPACE <- file.path(root, "NAMESPACE")
lines <- readLines(NAMESPACE)
ns <- file(NAMESPACE, open="w")
if (!any(grepl("useDynLib", lines))) {
lines <- c(sprintf( "useDynLib(%s, .registration=TRUE)", name), lines)
writeLines(lines, con = ns)
message(" >> added useDynLib directive to NAMESPACE" )
}
if (isTRUE(module)) {
writeLines('import(methods, Rcpp)', ns)
message(" >> added import(methods, Rcpp) directive to NAMESPACE")
} else {
writeLines('importFrom(Rcpp, evalCpp)', ns)
message(" >> added importFrom(Rcpp, evalCpp) directive to NAMESPACE" )
}
if (!any(grepl("^exportPattern", lines))) {
writeLines("exportPattern(\"^[[:alpha:]]+\")", ns)
}
close( ns )
## update the package description help page
if (havePkgKitten) { # if pkgKitten is available, use it
pkgKitten::playWithPerPackageHelpPage(name, path, maintainer, email) # #nocov
} else {
.playWithPerPackageHelpPage(name, path, maintainer, email) # #nocov
}
## lay things out in the src directory
src <- file.path(root, "src")
if (!file.exists(src)) {
dir.create(src)
}
skeleton <- system.file("skeleton", package = "Rcpp")
if (length(cpp_files) > 0L) {
for (file in cpp_files) { # #nocov start
file.copy(file, src)
message(" >> copied ", file, " to src directory" ) # #nocov end
}
}
if (example_code) {
if (isTRUE(attributes)) {
file.copy(file.path( skeleton, "rcpp_hello_world_attributes.cpp"),
file.path( src, "rcpp_hello_world.cpp"))
message(" >> added example src file using Rcpp attributes")
} else {
header <- readLines(file.path(skeleton, "rcpp_hello_world.h"))
header <- gsub("@PKG@", name, header, fixed = TRUE)
writeLines(header , file.path(src, "rcpp_hello_world.h"))
message(" >> added example header file using Rcpp classes")
file.copy(file.path(skeleton, "rcpp_hello_world.cpp"), src)
message(" >> added example src file using Rcpp classes")
rcode <- readLines(file.path( skeleton, "rcpp_hello_world.R"))
rcode <- gsub("@PKG@", name, rcode, fixed = TRUE)
writeLines( rcode , file.path( root, "R", "rcpp_hello_world.R"))
message(" >> added example R file calling the C++ example")
}
hello.Rd <- file.path(root, "man", "rcpp_hello_world.Rd")
unlink(hello.Rd)
file.copy(system.file("skeleton", "rcpp_hello_world.Rd", package = "Rcpp"), hello.Rd)
message( " >> added Rd file for rcpp_hello_world")
}
if (isTRUE(module)) {
file.copy(system.file("skeleton", "rcpp_module.cpp", package="Rcpp"),
file.path(root, "src"))
file.copy(system.file("skeleton", "Num.cpp", package="Rcpp"),
file.path(root, "src"))
file.copy(system.file("skeleton", "stdVector.cpp", package="Rcpp"),
file.path(root, "src"))
file.copy(system.file("skeleton", "zzz.R", package ="Rcpp"),
file.path(root, "R"))
file.copy(system.file("skeleton", "Rcpp_modules_examples.Rd", package ="Rcpp"),
file.path(root, "man"))
message(" >> copied the example module file ")
}
# generate native routines if we aren't using attributes (which already generate
# them automatically) and we have at least R 3.4
if (!attributes) {
con <- file(file.path(src, "init.c"), "wt")
tools::package_native_routine_registration_skeleton(root, con=con)
close(con)
message(" >> created init.c for package registration")
}
lines <- readLines(package.doc <- file.path( root, "man", sprintf("%s-package.Rd", name)))
lines <- sub("~~ simple examples", "%% ~~ simple examples", lines)
lines <- lines[! grepl("~~ package title", lines)]
lines <- lines[! grepl("~~ The author and", lines)]
lines <- sub("Who wrote it", author, lines )
lines <- sub("Who to complain to.*", sprintf("%s <%s>", maintainer, email), lines)
writeLines(lines, package.doc)
if (fake) {
rm("Rcpp.fake.fun", envir = env)
unlink(file.path(root, "R" , "Rcpp.fake.fun.R"))
unlink(file.path(root, "man", "Rcpp.fake.fun.Rd"))
## cleansing NAMESPACE of fake function entry
lines <- readLines(NAMESPACE)
lines <- lines[!grepl("^export.*fake\\.fun", lines)]
writeLines(lines, NAMESPACE)
}
if (isTRUE(remove_hello_world)) {
rm("rcpp_hello_world", envir = env)
}
if (attributes) {
compileAttributes(root)
message(" >> compiled Rcpp attributes ")
}
invisible(NULL)
}
## Borrowed with love from pkgKitten, and modified slightly
.playWithPerPackageHelpPage <- function(name = "anRpackage",
path = ".",
maintainer = "Your Name",
email = "your@mail.com") {
root <- file.path(path, name) # #nocov start
helptgt <- file.path(root, "man", sprintf( "%s-package.Rd", name))
helpsrc <- system.file("skeleton", "manual-page-stub.Rd", package="Rcpp")
## update the package description help page
if (file.exists(helpsrc)) {
lines <- readLines(helpsrc)
lines <- gsub("__placeholder__", name, lines, fixed = TRUE)
lines <- gsub("Who to complain to ",
sprintf( "%s <%s>", maintainer, email),
lines, fixed = TRUE)
writeLines(lines, helptgt)
}
invisible(NULL) # #nocov end
}
Rcpp/R/loadModule.R 0000644 0001762 0000144 00000011100 15126566764 013602 0 ustar ligges users # Copyright (C) 2010 - 2026 John Chambers, Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
# Rcpp is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Rcpp is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see .
## the following items are to get around some insanity in the
## CMD check of packages using Rcpp that dies in loadModule()
## because some code somewhere can't find the methods package
isBotchedSession <- function()
! ("package:methods" %in% search())
.moduleNames <- function(what) {
assignAs <- allNames(what)
sameNames <- !nzchar(assignAs)
assignAs[sameNames] <- what[sameNames]
assignAs
}
.DummyModule <- function(name, what) { # #nocov start
value <- new.env()
storage <- new.env()
assign("storage", storage, envir = value)
assign("moduleName", name, envir = value)
allNames <- names(.moduleNames(what))
for(el in allNames)
assign(el, NULL, envir = storage)
value
} # #nocov end
.moduleMetaName <- function(name)
methods::methodsPackageMetaName("Mod",name)
moduleIsLoaded <- function(name, env)
exists(.moduleMetaName(name), envir = env, inherits = FALSE)
loadModule <- function( module, what = character(), loadNow,
env = topenv(parent.frame())) {
if(is(module, "character")) {
loadM <- NULL
metaName <- .moduleMetaName(module)
if(exists(metaName, envir = env, inherits = FALSE))
loadM <- get(metaName, envir = env)
}
else if(is(module, "Module")) { # #nocov start
loadM <- as.environment(module)
module <- get(loadM, "moduleName")
}
else
stop(gettextf("Argument \"module\" should be a module or the name of a module: got an object of class \"%s\"", class(module))) # #nocov end
if(missing(loadNow)) { # test it
if(is.null(loadM))
loadM <- tryCatch(Module( module, mustStart = TRUE, where = env ),
error = function(e)e)
loadNow <- !is(loadM, "error")
}
if(loadNow) {
## .botched <- isBotchedSession()
.botched <- FALSE
if(is.null(loadM))
loadM <- tryCatch(Module( module, mustStart = TRUE, where = env ),
error = function(e)e)
if(is(loadM, "error")) {
if(.botched) # #nocov start
return(.DummyModule(module, what))
stop(gettextf("Unable to load module \"%s\": %s",
as(module, "character"), loadM$message)) # #nocov end
}
if(!exists(metaName, envir = env, inherits =FALSE))
assign(metaName, loadM, envir = env)
if(!length(what)) # no assignments
return(loadM)
env <- as.environment(env)
## get the storage environment, for what=TRUE
storage <- as.environment(get( "storage", as.environment(loadM ) ))
if(identical(what, TRUE))
what <- objects(storage)
missingObjs <- !sapply(what, function(symb) exists(symb, envir = storage, inherits = FALSE))
if(any(missingObjs)) {
if(.botched) { # #nocov start
for(el in what[missingObjs])
assign(el, NULL, envir = storage)
}
else {
warning(gettextf("%s not found in module \"%s\"",
paste0('"', what[missingObjs], '"', collapse = ", "),
as.character(module)))
what <- what[!missingObjs]
} # #nocov end
}
assignAs <- .moduleNames(what)
for( i in seq_along(what) ) {
if(.botched)
assign(assignAs[[i]], NULL, envir = storage) # #nocov
else
assign(assignAs[[i]], get(what[[i]], envir = storage), envir = env)
}
loadM
}
else { # create a load action to recall this function
myCall <- match.call()
f <- function(ns) NULL
myCall$env <- as.name("ns")
myCall$loadNow <- TRUE
body(f, envir = env) <- myCall
setLoadAction(f, where = env)
invisible(myCall) # #nocov
}
}
Rcpp/cleanup 0000755 0001762 0000144 00000003255 15127740111 012537 0 ustar ligges users #!/bin/sh
#cd inst/doc && rm -f index.html *.tex *.bbl *.blg *.aux *.out *.log && cd -
rm -f confdefs.h config.log config.status \
src/*.o src/*.so src/*.a src/*.d src/*.dll src/*.rc \
RcppSrc/*.o RcppSrc/*.a inst/Rcpp-version.txt \
inst/lib/libRcpp.so inst/lib/Rcpp*.h inst/lib/libRcpp.a \
inst/doc/*.cpp inst/doc/*.hpp \
inst/doc/*.out \
inst/doc/.build.timestamp \
inst/doc/*.Rd inst/doc/*.aux inst/doc/*.log inst/doc/*.tex \
inst/doc/latex/*.aux inst/doc/latex/*.log \
inst/examples/ConvolveBenchmarks/*.o \
inst/examples/ConvolveBenchmarks/*.so \
inst/examples/functionCallback/*.so \
inst/examples/functionCallback/*.o \
inst/examples/OpenMP/piWithInterrupts.o \
inst/examples/OpenMP/piWithInterrupts.so \
inst/discovery/cxx0x.Rout \
inst/unitTests/testRcppModule/src/*.o \
inst/unitTests/testRcppModule/src/*.so \
inst/unitTests/testRcppClass/src/*.o \
inst/unitTests/testRcppClass/src/*.so \
src/Makedeps libRcpp.a \
src/symbols.rds \
inst/unitTests/testRcppClass/src/symbols.rds \
vignettes/*.aux vignettes/*.log vignettes/*.out \
vignettes/*.tex vignettes/*.bbl vignettes/*.blg \
vignettes/*.toc vignettes/*.tpt vignettes/*.xwm
rm -rf autom4te.cache inst/lib/ inst/doc/man/ inst/doc/html/ inst/doc/latex/ \
inst/doc/auto inst/bib/auto inst/doc/Rcpp-*/auto/ src-* vignettes/auto \
inst/tinytest/testRcppAttributePackage/inst \
inst/tinytest/testRcppAttributePackage/R
find . -name \*~ -exec rm {} \;
find . -name \*.flc -exec rm {} \;
(test -d vignettes/ && cd vignettes/ && test -f Makefile && make clean && cd -) >/dev/null
(test -d vignettes/rmd && cd vignettes/rmd/ && test -f Makefile && make clean && cd -) >/dev/null
Rcpp/vignettes/ 0000755 0001762 0000144 00000000000 15127740111 013165 5 ustar ligges users Rcpp/vignettes/Rcpp-modules.pdf.asis 0000644 0001762 0000144 00000000234 15115301232 017161 0 ustar ligges users %\VignetteIndexEntry{Rcpp-modules}
%\VignetteKeywords{Rcpp, modules, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-extending.pdf.asis 0000644 0001762 0000144 00000000240 15115301232 017473 0 ustar ligges users %\VignetteIndexEntry{Rcpp-extending}
%\VignetteKeywords{Rcpp, extending, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-sugar.pdf.asis 0000644 0001762 0000144 00000000230 15115301232 016626 0 ustar ligges users %\VignetteIndexEntry{Rcpp-sugar}
%\VignetteKeywords{Rcpp, sugar, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-FAQ.pdf.asis 0000644 0001762 0000144 00000000224 15115301232 016117 0 ustar ligges users %\VignetteIndexEntry{Rcpp-FAQ}
%\VignetteKeywords{Rcpp, FAQ, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-attributes.pdf.asis 0000644 0001762 0000144 00000000242 15115301232 017676 0 ustar ligges users %\VignetteIndexEntry{Rcpp-attributes}
%\VignetteKeywords{Rcpp, attributes, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-introduction.pdf.asis 0000644 0001762 0000144 00000000230 15115301232 020226 0 ustar ligges users %\VignetteIndexEntry{Rcpp-introduction}
%\VignetteKeywords{Rcpp, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-quickref.pdf.asis 0000644 0001762 0000144 00000000236 15115301232 017324 0 ustar ligges users %\VignetteIndexEntry{Rcpp-quickref}
%\VignetteKeywords{Rcpp, quickref, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-jss-2011.pdf.asis 0000644 0001762 0000144 00000000267 15115301232 016677 0 ustar ligges users %\VignetteIndexEntry{Rcpp-JSS-2011}
%\VignetteKeywords{Rcpp, foreign function interface, .Call, C++, R}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-package.pdf.asis 0000644 0001762 0000144 00000000234 15115301232 017104 0 ustar ligges users %\VignetteIndexEntry{Rcpp-package}
%\VignetteKeywords{Rcpp, package, R, Cpp}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/vignettes/Rcpp-libraries.pdf.asis 0000644 0001762 0000144 00000000237 15115301232 017470 0 ustar ligges users %\VignetteIndexEntry{Rcpp-libraries}
%\VignetteKeywords{Rcpp, Package, Library}
%\VignettePackage{Rcpp}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{Rcpp::asis}
Rcpp/src/ 0000755 0001762 0000144 00000000000 15127740111 011744 5 ustar ligges users Rcpp/src/module.cpp 0000644 0001762 0000144 00000015545 13701060673 013753 0 ustar ligges users // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
//
// Module.cpp: Rcpp R/C++ interface class library -- Rcpp modules
//
// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
//
// Rcpp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Rcpp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rcpp. If not, see .
#define COMPILING_RCPP
#include
#include "internal.h"
typedef Rcpp::XPtr XP_Module;
typedef Rcpp::XPtr XP_Class;
typedef Rcpp::XPtr XP_Function;
RCPP_FUN_1(bool, Class__has_default_constructor, XP_Class cl) {
return cl->has_default_constructor();
}
RCPP_FUN_2(SEXP, Module__get_function, XP_Module module, std::string fun) {
return module->get_function(fun);
}
RCPP_FUN_2(bool, Class__has_method, XP_Class cl, std::string m) { // #nocov start
return cl->has_method(m);
}
RCPP_FUN_2(bool, Class__has_property, XP_Class cl, std::string m) {
return cl->has_property(m);
}
RCPP_FUN_1(std::string, Class__name, XP_Class cl) {
return cl->name;
}
RCPP_FUN_2(bool, Module__has_function, XP_Module module, std::string met) {
return module->has_function(met);
}
RCPP_FUN_2(bool, Module__has_class, XP_Module module, std::string cl) {
return module->has_class(cl);
} // #nocov end
RCPP_FUN_2(Rcpp::CppClass, Module__get_class, XP_Module module, std::string cl) {
return module->get_class(cl);
}
RCPP_FUN_1(bool, CppObject__needs_init, SEXP xp) { // #nocov start
return R_ExternalPtrAddr(xp) == 0;
}
RCPP_FUN_1(Rcpp::CharacterVector, CppClass__methods, XP_Class cl) {
return cl->method_names();
}
RCPP_FUN_1(Rcpp::CharacterVector, CppClass__properties, XP_Class cl) {
return cl->property_names();
}
RCPP_FUN_1(Rcpp::List, CppClass__property_classes, XP_Class cl) {
return cl->property_classes();
}
RCPP_FUN_1(Rcpp::IntegerVector, CppClass__methods_arity, XP_Class cl) {
return cl->methods_arity();
}
RCPP_FUN_1(Rcpp::LogicalVector, CppClass__methods_voidness, XP_Class cl) {
return cl->methods_voidness();
}
RCPP_FUN_2(bool, CppClass__property_is_readonly, XP_Class cl, std::string p) {
return cl->property_is_readonly(p);
}
RCPP_FUN_2(std::string, CppClass__property_class, XP_Class cl, std::string p) {
return cl->property_class(p);
}
RCPP_FUN_1(Rcpp::IntegerVector, Module__functions_arity, XP_Module module) {
return module-> functions_arity();
} // #nocov end
RCPP_FUN_1(Rcpp::CharacterVector, Module__functions_names, XP_Module module) {
return module-> functions_names();
}
RCPP_FUN_1(std::string, Module__name, XP_Module module) { // #nocov start
return module->name;
} // #nocov end
RCPP_FUN_1(Rcpp::List, Module__classes_info, XP_Module module) {
return module->classes_info();
}
RCPP_FUN_1(Rcpp::CharacterVector, Module__complete, XP_Module module) { // #nocov start
return module->complete();
}
RCPP_FUN_1(Rcpp::CharacterVector, CppClass__complete, XP_Class cl) {
return cl->complete();
}
// these operate directly on the external pointers, rather than
// looking up the property in the map // #nocov end
RCPP_FUN_3(SEXP, CppField__get, XP_Class cl, SEXP field_xp, SEXP obj) {
return cl->getProperty(field_xp, obj);
}
RCPP_FUN_4(SEXP, CppField__set, XP_Class cl, SEXP field_xp, SEXP obj, SEXP value) {
cl->setProperty(field_xp, obj, value);
return R_NilValue;
}
RCPP_FUN_2(SEXP, CppObject__finalize, XP_Class cl, SEXP obj) {
cl->run_finalizer(obj);
return R_NilValue;
}
// .External functions
SEXP InternalFunction_invoke(SEXP args) {
BEGIN_RCPP
SEXP p = CDR(args);
XP_Function fun(CAR(p)); p = CDR(p);
UNPACK_EXTERNAL_ARGS(cargs,p)
return fun->operator()(cargs);
END_RCPP
}
SEXP Module__invoke(SEXP args) { // #nocov start
BEGIN_RCPP
SEXP p = CDR(args);
XP_Module module(CAR(p)); p = CDR(p);
std::string fun = Rcpp::as(CAR(p)); p = CDR(p);
UNPACK_EXTERNAL_ARGS(cargs,p)
return module->invoke(fun, cargs, nargs);
END_RCPP
} // #nocov end
SEXP class__newInstance(SEXP args) {
SEXP p = CDR(args);
XP_Module module(CAR(p)); p = CDR(p);
XP_Class clazz(CAR(p)); p = CDR(p);
UNPACK_EXTERNAL_ARGS(cargs,p)
return clazz->newInstance(cargs, nargs);
}
// relies on being set in .onLoad()
SEXP rcpp_dummy_pointer = R_NilValue;
#define CHECK_DUMMY_OBJ(p) if (p == rcpp_dummy_pointer) throw Rcpp::not_initialized()
SEXP class__dummyInstance(SEXP args) {
SEXP p;
if (args == R_NilValue) {
return rcpp_dummy_pointer; // #nocov
}
p = CDR(args);
if (p != R_NilValue) {
rcpp_dummy_pointer = CAR(p);
}
return rcpp_dummy_pointer;
}
SEXP CppMethod__invoke(SEXP args) { // #nocov start
SEXP p = CDR(args);
// the external pointer to the class
XP_Class clazz(CAR(p)); p = CDR(p);
// the external pointer to the method
SEXP met = CAR(p); p = CDR(p);
// the external pointer to the object
SEXP obj = CAR(p); p = CDR(p);
CHECK_DUMMY_OBJ(obj);
// additional arguments, processed the same way as .Call does
UNPACK_EXTERNAL_ARGS(cargs,p)
return clazz->invoke(met, obj, cargs, nargs);
} // #nocov end
SEXP CppMethod__invoke_void(SEXP args) {
SEXP p = CDR(args);
// the external pointer to the class
XP_Class clazz(CAR(p)); p = CDR(p);
// the external pointer to the method
SEXP met = CAR(p); p = CDR(p);
// the external pointer to the object
SEXP obj = CAR(p); p = CDR(p);
CHECK_DUMMY_OBJ(obj);
// additional arguments, processed the same way as .Call does
UNPACK_EXTERNAL_ARGS(cargs,p)
clazz->invoke_void(met, obj, cargs, nargs);
return R_NilValue;
}
SEXP CppMethod__invoke_notvoid(SEXP args) {
SEXP p = CDR(args);
// the external pointer to the class
XP_Class clazz(CAR(p)); p = CDR(p);
// the external pointer to the method
SEXP met = CAR(p); p = CDR(p);
// the external pointer to the object
SEXP obj = CAR(p); p = CDR(p);
CHECK_DUMMY_OBJ(obj);
// additional arguments, processed the same way as .Call does
UNPACK_EXTERNAL_ARGS(cargs,p)
return clazz->invoke_notvoid(met, obj, cargs, nargs);
}
namespace Rcpp{
static Module* current_scope ;
}
Rcpp::Module* getCurrentScope() {
return Rcpp::current_scope;
}
void setCurrentScope(Rcpp::Module* scope) {
Rcpp::current_scope = scope;
}
Rcpp/src/Makevars.win 0000644 0001762 0000144 00000000043 12253723677 014250 0 ustar ligges users PKG_CPPFLAGS = -I../inst/include/
Rcpp/src/barrier.cpp 0000644 0001762 0000144 00000015575 15126566764 014136 0 ustar ligges users
// barrier.cpp: Rcpp R/C++ interface class library -- write barrier
//
// Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois
// Copyright (C) 2021 - 2026 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
//
// This file is part of Rcpp.
//
// Rcpp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Rcpp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rcpp. If not, see .
#define COMPILING_RCPP
#define USE_RINTERNALS
#include
#include
#include
#include
#include
#include "internal.h"
// [[Rcpp::register]]
SEXP get_string_elt(SEXP x, R_xlen_t i) { // #nocov start
return STRING_ELT(x, i);
}
// [[Rcpp::register]]
const char* char_get_string_elt(SEXP x, R_xlen_t i) {
return CHAR(STRING_ELT(x, i));
}
// [[Rcpp::register]]
void set_string_elt(SEXP x, R_xlen_t i, SEXP value) {
SET_STRING_ELT(x, i, value);
}
// [[Rcpp::register]]
void char_set_string_elt(SEXP x, R_xlen_t i, const char* value) {
SET_STRING_ELT(x, i, Rf_mkChar(value));
}
// [[Rcpp::register]]
SEXP* get_string_ptr(SEXP x) {
// TODO: should we deprecate this?
return const_cast(RCPP_STRING_PTR(x));
}
// [[Rcpp::register]]
SEXP get_vector_elt(SEXP x, R_xlen_t i) {
return VECTOR_ELT(x, i);
}
// [[Rcpp::register]]
void set_vector_elt(SEXP x, R_xlen_t i, SEXP value) {
SET_VECTOR_ELT(x, i, value);
}
// [[Rcpp::register]]
SEXP* get_vector_ptr(SEXP x) {
// TODO: should we deprecate this?
return const_cast(RCPP_VECTOR_PTR(x)); // #nocov end
}
// [[Rcpp::register]]
void* dataptr(SEXP x) {
// DATAPTR_RO was introduced with R 3.5.0
return const_cast(DATAPTR_RO(x));
}
// [[Rcpp::register]]
const char* char_nocheck(SEXP x) {
return CHAR(x);
}
static bool Rcpp_cache_know = false;
static SEXP Rcpp_cache = R_NilValue;
#define RCPP_HASH_CACHE_INDEX 4
#define RCPP_CACHE_SIZE 5
#ifndef RCPP_HASH_CACHE_INITIAL_SIZE
#define RCPP_HASH_CACHE_INITIAL_SIZE 1024
#endif
namespace Rcpp {
static SEXP Rcpp_precious = R_NilValue;
// [[Rcpp::register]]
void Rcpp_precious_init() {
Rcpp_precious = CONS(R_NilValue, R_NilValue); // set up
R_PreserveObject(Rcpp_precious); // and protect
}
// [[Rcpp::register]]
void Rcpp_precious_teardown() { // #nocov start
R_ReleaseObject(Rcpp_precious); // release resource
} // #nocov end
// [[Rcpp::register]]
SEXP Rcpp_precious_preserve(SEXP object) {
if (object == R_NilValue) {
return R_NilValue; // #nocov
}
PROTECT(object);
SEXP cell = PROTECT(CONS(Rcpp_precious, CDR(Rcpp_precious)));
SET_TAG(cell, object);
SETCDR(Rcpp_precious, cell);
if (CDR(cell) != R_NilValue) {
SETCAR(CDR(cell), cell);
}
UNPROTECT(2);
return cell;
}
// [[Rcpp::register]]
void Rcpp_precious_remove(SEXP token) {
if (token == R_NilValue || TYPEOF(token) != LISTSXP) {
return;
}
SET_TAG(token, R_NilValue);
SEXP before = CAR(token);
SEXP after = CDR(token);
SETCDR(before, after);
if (after != R_NilValue) {
SETCAR(after, before);
}
}
}
// only used for debugging
SEXP get_rcpp_cache() {
if (! Rcpp_cache_know) {
SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table
Rcpp::Shield RcppString(Rf_mkString("Rcpp"));
Rcpp::Shield call(Rf_lang2(getNamespaceSym, RcppString));
Rcpp::Shield RCPP(Rf_eval(call, R_GlobalEnv));
#if R_VERSION < R_Version(4,5,0)
Rcpp_cache = Rf_findVarInFrame(RCPP, Rf_install(".rcpp_cache"));
#else
Rcpp_cache = R_getVar(Rf_install(".rcpp_cache"), RCPP, TRUE);
#endif
Rcpp_cache_know = true;
}
return Rcpp_cache;
}
namespace Rcpp {
namespace internal {
// [[Rcpp::register]]
SEXP get_Rcpp_namespace() {
return VECTOR_ELT(get_rcpp_cache() , 0);
}
}
}
// [[Rcpp::register]]
SEXP rcpp_get_stack_trace() {
return VECTOR_ELT(get_rcpp_cache(), 3);
}
// [[Rcpp::register]]
SEXP rcpp_set_stack_trace(SEXP e) {
SET_VECTOR_ELT(get_rcpp_cache(), 3, e);
return R_NilValue;
}
SEXP set_error_occured(SEXP cache, SEXP e) {
SET_VECTOR_ELT(cache, 1, e);
return R_NilValue;
}
SEXP set_current_error(SEXP cache, SEXP e) {
SET_VECTOR_ELT(cache, 2, e);
return R_NilValue;
}
SEXP init_Rcpp_cache() {
SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table
Rcpp::Shield RcppString(Rf_mkString("Rcpp"));
Rcpp::Shield call(Rf_lang2(getNamespaceSym, RcppString));
Rcpp::Shield RCPP(Rf_eval(call, R_GlobalEnv));
Rcpp::Shield cache(Rf_allocVector(VECSXP, RCPP_CACHE_SIZE));
// the Rcpp namespace
SET_VECTOR_ELT(cache, 0, RCPP);
set_error_occured(cache, Rf_ScalarLogical(FALSE)); // error occured
set_current_error(cache, R_NilValue); // current error
SET_VECTOR_ELT(cache, 3, R_NilValue); // stack trace
Rcpp::Shield tmp(Rf_allocVector(INTSXP, RCPP_HASH_CACHE_INITIAL_SIZE));
SET_VECTOR_ELT(cache, RCPP_HASH_CACHE_INDEX, tmp);
Rf_defineVar(Rf_install(".rcpp_cache"), cache, RCPP);
return cache;
}
// [[Rcpp::register]]
SEXP reset_current_error() { // #nocov start
SEXP cache = get_rcpp_cache();
// error occured
set_error_occured(cache, Rf_ScalarLogical(FALSE));
// current error
set_current_error(cache, R_NilValue);
// stack trace
SET_VECTOR_ELT(cache, 3, R_NilValue);
return R_NilValue;
}
// [[Rcpp::register]]
int error_occured() {
SEXP err = VECTOR_ELT(get_rcpp_cache(), 1);
return LOGICAL(err)[0];
}
// [[Rcpp::internal]]
SEXP rcpp_error_recorder(SEXP e) {
SEXP cache = get_rcpp_cache();
// error occured
set_error_occured(cache, Rf_ScalarLogical(TRUE));
// current error
set_current_error(cache, e);
return R_NilValue;
}
// [[Rcpp::register]]
SEXP rcpp_get_current_error() {
return VECTOR_ELT(get_rcpp_cache(), 2); // #nocov end
}
// [[Rcpp::register]]
int* get_cache(int m) {
SEXP cache = get_rcpp_cache();
SEXP hash_cache = VECTOR_ELT(cache, RCPP_HASH_CACHE_INDEX);
int n = Rf_length(hash_cache);
if (m > n) {
Rcpp::Shield new_hash_cache(Rf_allocVector(INTSXP, m));
hash_cache = new_hash_cache;
SET_VECTOR_ELT(cache,RCPP_HASH_CACHE_INDEX, hash_cache);
}
int *res = INTEGER(hash_cache);
std::fill(res, res+m, 0);
return res;
}
Rcpp/src/date.cpp 0000644 0001762 0000144 00000131074 14765550031 013402 0 ustar ligges users // Date.cpp: Rcpp R/C++ interface class library -- Date type
//
// Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
//
// The mktime00() as well as the gmtime_() replacement function are
// Copyright (C) 2000 - 2010 The R Development Core Team.
//
// gmtime_() etc are from the public domain timezone code dated
// 1996-06-05 by Arthur David Olson.
//
// This file is part of Rcpp.
//
// Rcpp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Rcpp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rcpp. If not, see .
#define COMPILING_RCPP
#include // for TRUE,FALSE
#include
#include // for gmtime
#include
namespace Rcpp {
// Taken (in 2010) from R's src/main/datetime.c and made a member function called with C++ reference
// Later, R added the following comment we now (in 2016) add
/*
There are two implementation paths here.
1) Use the system functions for mktime, gmtime[_r], localtime[_r], strftime.
Use the system time_t, struct tm and time-zone tables.
2) Use substitutes from src/extra/tzone for mktime, gmtime, localtime,
strftime with a R_ prefix. The system strftime is used for
locale-dependent names in R_strptime and R_strftime. This uses the
time-zone tables shipped with R and installed into
R_HOME/share/zoneinfo .
Our own versions of time_t (64-bit) and struct tm (including the
BSD-style fields tm_zone and tm_gmtoff) are used.
For path 1), the system facilities are used for 1902-2037 and outside
those limits where there is a 64-bit time_t and the conversions work
(most OSes currently have only 32-bit time-zone tables). Otherwise
there is code below to extrapolate from 1902-2037.
Path 2) was added for R 3.1.0 and is the only one supported on
Windows: it is the default on macOS. The only currently (Jan 2014)
known OS with 64-bit time_t and complete tables is Linux.
*/
// Now, R only ships share/zoneinfo on Windows AFAIK
/* Substitute for mktime -- no checking, always in GMT */
// [[Rcpp::register]]
double mktime00(struct tm &tm) {
static const int days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static const int year_base = 1900;
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#define days_in_year(year) (isleap(year) ? 366 : 365)
int day = 0;
int i, year, year0;
double excess = 0.0;
day = tm.tm_mday - 1;
year0 = year_base + tm.tm_year;
/* safety check for unbounded loops */
if (year0 > 3000) {
excess = (int)(year0/2000) - 1; // #nocov start
year0 -= (int)(excess * 2000);
} else if (year0 < 0) {
excess = -1 - (int)(-year0/2000);
year0 -= (int)(excess * 2000); // #nocov end
}
for(i = 0; i < tm.tm_mon; i++) day += days_in_month[i];
if (tm.tm_mon > 1 && isleap(year0)) day++;
tm.tm_yday = day;
if (year0 > 1970) {
for (year = 1970; year < year0; year++)
day += days_in_year(year);
} else if (year0 < 1970) {
for (year = 1969; year >= year0; year--)
day -= days_in_year(year);
}
/* weekday: Epoch day was a Thursday */
if ((tm.tm_wday = (day + 4) % 7) < 0) tm.tm_wday += 7;
return tm.tm_sec + (tm.tm_min * 60) + (tm.tm_hour * 3600)
+ (day + excess * 730485) * 86400.0;
}
#undef isleap
#undef days_in_year
#include "sys/types.h" /* for time_t */
#include "string.h"
#include "limits.h" /* for CHAR_BIT et al. */
#define _NO_OLDNAMES /* avoid tznames */
#include "time.h"
#undef _NO_OLDNAMES
#include
#ifndef EOVERFLOW
# define EOVERFLOW 79
#endif
#include "stdlib.h"
#include "stdint.h"
#include "stdio.h"
#include "fcntl.h"
#include "float.h" /* for FLT_MAX and DBL_MAX */
#include // solaris needs this for read() and close()
/* merged from private.h */
#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
#define TYPE_SIGNED(type) (((type) -1) < 0)
#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
#define AVGSECSPERYEAR 31556952L
#define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
#define INITIALIZE(x) (x = 0)
/* Max and min values of the integer type T, of which only the bottom
B bits are used, and where the highest-order used bit is considered
to be a sign bit if T is signed. */
#define MAXVAL(t, b) \
((t) (((t) 1 << ((b) - 1 - TYPE_SIGNED(t))) \
- 1 + ((t) 1 << ((b) - 1 - TYPE_SIGNED(t)))))
#define MINVAL(t, b) \
((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
/* The minimum and maximum finite time values. This assumes no padding. */
static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
//#include "tzfile.h" // from src/extra/tzone/tzfile.h
// BEGIN ------------------------------------------------------------------------------------------ tzfile.h
#ifndef TZFILE_H
#define TZFILE_H
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
*/
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
** or that it will remain at all.
** Do NOT copy it to any system include directory.
** Thank you!
*/
/*
** Information about time zone files.
*/
#ifndef TZDIR
#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
#endif /* !defined TZDIR */
#ifndef TZDEFAULT
#define TZDEFAULT "localtime" // NB this is "UTC" in R, but R also loads tz data
#endif /* !defined TZDEFAULT */
#ifndef TZDEFRULES
#define TZDEFRULES "America/New_York"
#endif /* !defined TZDEFRULES */
/*
** Each file begins with. . .
*/
#define TZ_MAGIC "TZif"
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_version[1]; /* '\0' or '2' as of 2005 */
char tzh_reserved[15]; /* reserved--must be zero */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
char tzh_typecnt[4]; /* coded number of local time types */
char tzh_charcnt[4]; /* coded number of abbr. chars */
};
/*
** . . .followed by. . .
**
** tzh_timecnt (char [4])s coded transition times a la time(2)
** tzh_timecnt (unsigned char)s types of local time starting at above
** tzh_typecnt repetitions of
** one (char [4]) coded UTC offset in seconds
** one (unsigned char) used to set tm_isdst
** one (unsigned char) that's an abbreviation list index
** tzh_charcnt (char)s '\0'-terminated zone abbreviations
** tzh_leapcnt repetitions of
** one (char [4]) coded leap second transition times
** one (char [4]) total correction after above
** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
** time is standard time, if FALSE,
** transition time is wall clock time
** if absent, transition times are
** assumed to be wall clock time
** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
** time is UTC, if FALSE,
** transition time is local time
** if absent, transition times are
** assumed to be local time
*/
/*
** If tzh_version is '2' or greater, the above is followed by a second instance
** of tzhead and a second instance of the data in which each coded transition
** time uses 8 rather than 4 chars,
** then a POSIX-TZ-environment-variable-style string for use in handling
** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX representation for
** such instants).
**
** If tz_version is '3' or greater, the above is extended as follows.
** First, the POSIX TZ string's hour offset may range from -167
** through 167 as compared to the POSIX-required 0 through 24.
** Second, its DST start time may be January 1 at 00:00 and its stop
** time December 31 at 24:00 plus the difference between DST and
** standard time, indicating DST all year.
*/
/*
** In the current implementation, "tzset()" refuses to deal with files that
** exceed any of the limits below.
*/
#ifndef TZ_MAX_TIMES
#define TZ_MAX_TIMES 1200
#endif /* !defined TZ_MAX_TIMES */
#ifndef TZ_MAX_TYPES
#ifndef NOSOLAR
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
#endif /* !defined NOSOLAR */
#ifdef NOSOLAR
/*
** Must be at least 14 for Europe/Riga as of Jan 12 1995,
** as noted by Earl Chew.
*/
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
#endif /* !defined NOSOLAR */
#endif /* !defined TZ_MAX_TYPES */
// increased from 50, http://mm.icann.org/pipermail/tz/2015-August/022623.html
#ifndef TZ_MAX_CHARS
#define TZ_MAX_CHARS 100 /* Maximum number of abbreviation characters */
/* (limited by what unsigned chars can hold) */
#endif /* !defined TZ_MAX_CHARS */
#ifndef TZ_MAX_LEAPS
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
#endif /* !defined TZ_MAX_LEAPS */
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define HOURSPERDAY 24
#define DAYSPERWEEK 7
#define DAYSPERNYEAR 365
#define DAYSPERLYEAR 366
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
#define MONSPERYEAR 12
#define TM_SUNDAY 0
#define TM_MONDAY 1
#define TM_TUESDAY 2
#define TM_WEDNESDAY 3
#define TM_THURSDAY 4
#define TM_FRIDAY 5
#define TM_SATURDAY 6
#define TM_JANUARY 0
#define TM_FEBRUARY 1
#define TM_MARCH 2
#define TM_APRIL 3
#define TM_MAY 4
#define TM_JUNE 5
#define TM_JULY 6
#define TM_AUGUST 7
#define TM_SEPTEMBER 8
#define TM_OCTOBER 9
#define TM_NOVEMBER 10
#define TM_DECEMBER 11
#define TM_YEAR_BASE 1900
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
/*
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
** isleap(y) == isleap(y % 400)
** and so
** isleap(a + b) == isleap((a + b) % 400)
** or
** isleap(a + b) == isleap(a % 400 + b % 400)
** This is true even if % means modulo rather than Fortran remainder
** (which is allowed by C89 but not C99).
** We use this to avoid addition overflow problems.
*/
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined TZFILE_H */
// -------------------------------------------------------------------------------------- END tzfile.h
//#include "localtime.c" // from src/extra/tzone/localtime.c
// note though that was included is partial as we support only gmtime_()
// BEGIN --------------------------------------------------------------------------------- localtime.c
#ifdef O_BINARY
#define OPEN_MODE (O_RDONLY | O_BINARY)
#endif /* defined O_BINARY */
#ifndef O_BINARY
#define OPEN_MODE O_RDONLY
#endif /* !defined O_BINARY */
static const char gmt[] = "GMT";
/*
** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
** We default to US rules as of 1999-08-17.
** POSIX 1003.1 section 8.1.1 says that the default DST rules are
** implementation dependent; for historical reasons, US rules are a
** common default.
*/
#ifndef TZDEFRULESTRING
#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
#endif /* !defined TZDEFDST */
#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
#ifdef TZNAME_MAX
#define MY_TZNAME_MAX TZNAME_MAX
#endif /* defined TZNAME_MAX */
#ifndef TZNAME_MAX
#define MY_TZNAME_MAX 255
#endif /* !defined TZNAME_MAX */
struct ttinfo { /* time type information */
int_fast32_t tt_gmtoff; /* UTC offset in seconds */
int tt_isdst; /* used to set tm_isdst */
int tt_abbrind; /* abbreviation list index */
int tt_ttisstd; /* TRUE if transition is std time */
int tt_ttisgmt; /* TRUE if transition is UTC */
};
struct lsinfo { /* leap second information */
time_t ls_trans; /* transition time */
int_fast64_t ls_corr; /* correction to apply */
};
struct state {
int leapcnt;
int timecnt;
int typecnt;
int charcnt;
int goback;
int goahead;
time_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
struct ttinfo ttis[TZ_MAX_TYPES];
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
(2 * (MY_TZNAME_MAX + 1)))];
struct lsinfo lsis[TZ_MAX_LEAPS];
};
struct rule {
int r_type; /* type of rule--see below */
int r_day; /* day number of rule */
int r_week; /* week number of rule */
int r_mon; /* month number of rule */
int_fast32_t r_time; /* transition time of rule */
};
#define JULIAN_DAY 0 /* Jn - Julian day */
#define DAY_OF_YEAR 1 /* n - day of year */
#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
static const int mon_lengths[2][MONSPERYEAR] = {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
static const int year_lengths[2] = {
DAYSPERNYEAR, DAYSPERLYEAR
};
static int gmt_is_set;
//static struct state lclmem;
static struct state gmtmem;
//#define lclptr (&lclmem)
#define gmtptr (&gmtmem)
static struct tm tm;
//extern const char *getTZinfo(void);
static int tzparse(const char * name, struct state * sp, int lastditch);
static int typesequiv(const struct state * sp, int a, int b);
static const char * getsecs(const char * strp, int_fast32_t * secsp);
static const char * getnum(const char * strp, int * const nump, const int min, const int max);
static const char * getrule(const char * strp, struct rule * const rulep);
static int_fast32_t transtime(int year, const struct rule * rulep, int_fast32_t offset);
static struct tm * timesub(const time_t *timep, int_fast32_t offset, const struct state *sp, struct tm *tmp);
static int leaps_thru_end_of(const int y);
/*
** Normalize logic courtesy Paul Eggert.
*/
static int increment_overflow(int *const ip, int j) {
int const i = *ip;
/*
** If i >= 0 there can only be overflow if i + j > INT_MAX
** or if j > INT_MAX - i; given i >= 0, INT_MAX - i cannot overflow.
** If i < 0 there can only be overflow if i + j < INT_MIN
** or if j < INT_MIN - i; given i < 0, INT_MIN - i cannot overflow.
*/
if ((i >= 0) ? (j > INT_MAX - i) : (j < INT_MIN - i))
return TRUE; // #nocov
*ip += j;
return FALSE;
}
static int increment_overflow_time(time_t *tp, int_fast32_t j) { // #nocov start
/*
** This is like
** 'if (! (time_t_min <= *tp + j && *tp + j <= time_t_max)) ...',
** except that it does the right thing even if *tp + j would overflow.
*/
if (! (j < 0
? (TYPE_SIGNED(time_t) ? time_t_min - j <= *tp : -1 - j < *tp)
: *tp <= time_t_max - j))
return TRUE;
*tp += j;
return FALSE;
}
static int_fast32_t detzcode(const char *const codep) {
int_fast32_t result = (codep[0] & 0x80) ? -1 : 0;
for (int i = 0; i < 4; ++i)
result = (result << 8) | (codep[i] & 0xff);
return result;
}
static int_fast64_t detzcode64(const char *const codep) {
int_fast64_t result = (codep[0] & 0x80) ? -1 : 0;
for (int i = 0; i < 8; ++i)
result = (result << 8) | (codep[i] & 0xff);
return result;
}
static int differ_by_repeat(const time_t t1, const time_t t0) {
if (TYPE_INTEGRAL(time_t) &&
TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
return 0;
/* R change */
return (int_fast64_t)t1 - (int_fast64_t)t0 == SECSPERREPEAT;
}
static const char * getzname(const char * strp) {
char c;
while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
c != '+')
++strp;
return strp;
}
static const char * getqzname(const char *strp, const int delim) {
int c;
while ((c = *strp) != '\0' && c != delim)
++strp;
return strp;
}
static const char * getoffset(const char *strp, int_fast32_t *const offsetp) {
int neg = 0;
if (*strp == '-') {
neg = 1;
++strp;
} else if (*strp == '+')
++strp;
strp = getsecs(strp, offsetp);
if (strp == NULL)
return NULL; /* illegal time */
if (neg)
*offsetp = -*offsetp;
return strp;
}
static const char * getsecs(const char *strp, int_fast32_t *const secsp) {
int num;
/*
** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
** "M10.4.6/26", which does not conform to Posix,
** but which specifies the equivalent of
** "02:00 on the first Sunday on or after 23 Oct".
*/
strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
if (strp == NULL)
return NULL;
*secsp = num * (int_fast32_t) SECSPERHOUR;
if (*strp == ':') {
++strp;
strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
if (strp == NULL)
return NULL;
*secsp += num * SECSPERMIN;
if (*strp == ':') {
++strp;
/* 'SECSPERMIN' allows for leap seconds. */
strp = getnum(strp, &num, 0, SECSPERMIN);
if (strp == NULL)
return NULL;
*secsp += num;
}
}
return strp;
}
static const char * getnum(const char * strp, int * const nump, const int min, const int max) {
char c;
int num;
if (strp == NULL || !is_digit(c = *strp))
return NULL;
num = 0;
do {
num = num * 10 + (c - '0');
if (num > max)
return NULL; /* illegal value */
c = *++strp;
} while (is_digit(c));
if (num < min)
return NULL; /* illegal value */
*nump = num;
return strp;
}
static const char * getrule(const char * strp, struct rule * const rulep) {
if (*strp == 'J') {
/*
** Julian day.
*/
rulep->r_type = JULIAN_DAY;
++strp;
strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
} else if (*strp == 'M') {
/*
** Month, week, day.
*/
rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
++strp;
strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
if (strp == NULL)
return NULL;
if (*strp++ != '.')
return NULL;
strp = getnum(strp, &rulep->r_week, 1, 5);
if (strp == NULL)
return NULL;
if (*strp++ != '.')
return NULL;
strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
} else if (is_digit(*strp)) {
/*
** Day of year.
*/
rulep->r_type = DAY_OF_YEAR;
strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
} else return NULL; /* invalid format */
if (strp == NULL)
return NULL;
if (*strp == '/') {
/*
** Time specified.
*/
++strp;
strp = getsecs(strp, &rulep->r_time);
} else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
return strp;
}
// this routine modified / simplified / reduced in 2010
static int tzload(const char * name, struct state * const sp, const int doextend) {
const char * p;
int i;
int fid;
int stored;
int nread;
union {
struct tzhead tzhead;
char buf[2 * sizeof(struct tzhead) +
2 * sizeof *sp + 4 * TZ_MAX_TIMES];
} u;
sp->goback = sp->goahead = FALSE;
/* if (name == NULL && (name = TZDEFAULT) == NULL) return -1; */
if (name == NULL) {
// edd 06 Jul 2010 let's do without getTZinfo()
//name = getTZinfo();
//if( strcmp(name, "unknown") == 0 ) name = TZDEFAULT;
name = TZDEFAULT;
}
{
int doaccess;
/*
** Section 4.9.1 of the C standard says that
** "FILENAME_MAX expands to an integral constant expression
** that is the size needed for an array of char large enough
** to hold the longest file name string that the implementation
** guarantees can be opened."
*/
char fullname[FILENAME_MAX + 1];
// edd 08 Jul 2010 not currently needed const char *sname = name;
if (name[0] == ':')
++name;
doaccess = name[0] == '/';
if (!doaccess) {
char buf[1000];
p = getenv("TZDIR");
if (p == NULL) {
snprintf(buf, 1000, "%s/share/zoneinfo",
getenv("R_HOME"));
buf[999] = '\0';
p = buf;
}
/* if ((p = TZDIR) == NULL) return -1; */
if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
return -1;
(void) strcpy(fullname, p);
(void) strcat(fullname, "/");
(void) strcat(fullname, name);
/*
** Set doaccess if '.' (as in "../") shows up in name.
*/
if (strchr(name, '.') != NULL) doaccess = TRUE;
name = fullname;
}
// edd 16 Jul 2010 comment out whole block
//if (doaccess && access(name, R_OK) != 0) {
// edd 08 Jul 2010 we use this without TZ for dates only
// so no need to warn
//Rf_warning("unknown timezone '%s'", sname);
//return -1;
//}
if ((fid = open(name, OPEN_MODE)) == -1) {
// edd 08 Jul 2010 we use this without TZ for dates only
// so no need to warn
//Rf_warning("unknown timezone '%s'", sname);
return -1;
}
}
nread = (int)read(fid, u.buf, sizeof u.buf);
if (close(fid) < 0 || nread <= 0)
return -1;
for (stored = 4; stored <= 8; stored *= 2) {
int ttisstdcnt;
int ttisgmtcnt;
ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
(ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
(ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
return -1;
if (nread - (p - u.buf) <
sp->timecnt * stored + /* ats */
sp->timecnt + /* types */
sp->typecnt * 6 + /* ttinfos */
sp->charcnt + /* chars */
sp->leapcnt * (stored + 4) + /* lsinfos */
ttisstdcnt + /* ttisstds */
ttisgmtcnt) /* ttisgmts */
return -1;
for (i = 0; i < sp->timecnt; ++i) {
sp->ats[i] = (stored == 4) ? detzcode(p) : detzcode64(p);
p += stored;
}
for (i = 0; i < sp->timecnt; ++i) {
sp->types[i] = (unsigned char) *p++;
if (sp->types[i] >= sp->typecnt)
return -1;
}
for (i = 0; i < sp->typecnt; ++i) {
struct ttinfo * ttisp;
ttisp = &sp->ttis[i];
ttisp->tt_gmtoff = detzcode(p);
p += 4;
ttisp->tt_isdst = (unsigned char) *p++;
if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
return -1;
ttisp->tt_abbrind = (unsigned char) *p++;
if (ttisp->tt_abbrind < 0 ||
ttisp->tt_abbrind > sp->charcnt)
return -1;
}
for (i = 0; i < sp->charcnt; ++i)
sp->chars[i] = *p++;
sp->chars[i] = '\0'; /* ensure '\0' at end */
for (i = 0; i < sp->leapcnt; ++i) {
struct lsinfo * lsisp;
lsisp = &sp->lsis[i];
lsisp->ls_trans = (stored == 4) ? detzcode(p) : detzcode64(p);
p += stored;
lsisp->ls_corr = detzcode(p);
p += 4;
}
for (i = 0; i < sp->typecnt; ++i) {
struct ttinfo * ttisp;
ttisp = &sp->ttis[i];
if (ttisstdcnt == 0)
ttisp->tt_ttisstd = FALSE;
else {
ttisp->tt_ttisstd = *p++;
if (ttisp->tt_ttisstd != TRUE && ttisp->tt_ttisstd != FALSE)
return -1;
}
}
for (i = 0; i < sp->typecnt; ++i) {
struct ttinfo * ttisp;
ttisp = &sp->ttis[i];
if (ttisgmtcnt == 0)
ttisp->tt_ttisgmt = FALSE;
else {
ttisp->tt_ttisgmt = *p++;
if (ttisp->tt_ttisgmt != TRUE && ttisp->tt_ttisgmt != FALSE)
return -1;
}
}
/*
** Out-of-sort ats should mean we're running on a
** signed time_t system but using a data file with
** unsigned values (or vice versa).
*/
for (i = 0; i < sp->timecnt - 2; ++i)
if (sp->ats[i] > sp->ats[i + 1]) {
++i;
if (TYPE_SIGNED(time_t)) {
/*
** Ignore the end (easy).
*/
sp->timecnt = i;
} else {
/*
** Ignore the beginning (harder).
*/
int j;
for (j = 0; j + i < sp->timecnt; ++j) {
sp->ats[j] = sp->ats[j + i];
sp->types[j] = sp->types[j + i];
}
sp->timecnt = j;
}
break;
}
/*
** If this is an old file, we're done.
*/
if (u.tzhead.tzh_version[0] == '\0')
break;
nread -= p - u.buf;
for (i = 0; i < nread; ++i)
u.buf[i] = p[i];
/*
** If this is a narrow integer time_t system, we're done.
*/
if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t))
break;
}
if (doextend && nread > 2 &&
u.buf[0] == '\n' && u.buf[nread - 1] == '\n' &&
sp->typecnt + 2 <= TZ_MAX_TYPES) {
struct state ts;
int result;
u.buf[nread - 1] = '\0';
result = tzparse(&u.buf[1], &ts, FALSE);
if (result == 0 && ts.typecnt == 2 &&
sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) {
for (i = 0; i < 2; ++i)
ts.ttis[i].tt_abbrind += sp->charcnt;
for (i = 0; i < ts.charcnt; ++i)
sp->chars[sp->charcnt++] = ts.chars[i];
i = 0;
while (i < ts.timecnt && ts.ats[i] <= sp->ats[sp->timecnt - 1])
++i;
while (i < ts.timecnt &&
sp->timecnt < TZ_MAX_TIMES) {
sp->ats[sp->timecnt] = ts.ats[i];
sp->types[sp->timecnt] = (unsigned char)sp->typecnt + ts.types[i];
++sp->timecnt;
++i;
}
sp->ttis[sp->typecnt++] = ts.ttis[0];
sp->ttis[sp->typecnt++] = ts.ttis[1];
}
}
i = 2 * YEARSPERREPEAT;
sp->goback = sp->goahead = sp->timecnt > i;
sp->goback = sp->goback &&
typesequiv(sp, sp->types[i], sp->types[0]) &&
differ_by_repeat(sp->ats[i], sp->ats[0]);
sp->goahead = sp->goahead &&
typesequiv(sp, sp->types[sp->timecnt - 1],
sp->types[sp->timecnt - 1 - i]) &&
differ_by_repeat(sp->ats[sp->timecnt - 1],
sp->ats[sp->timecnt - 1 - i]);
return 0;
}
/*
** Given a year, a rule, and the offset from UT at the time that rule takes
** effect, calculate the year-relative time that rule takes effect.
*/
static int_fast32_t transtime(const int year, const struct rule *const rulep, const int_fast32_t offset) {
int leapyear;
int_fast32_t value;
int d, m1, yy0, yy1, yy2, dow;
INITIALIZE(value);
leapyear = isleap(year);
switch (rulep->r_type) {
case JULIAN_DAY:
/*
** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
** years.
** In non-leap years, or if the day number is 59 or less, just
** add SECSPERDAY times the day number-1 to the time of
** January 1, midnight, to get the day.
*/
value = (rulep->r_day - 1) * SECSPERDAY;
if (leapyear && rulep->r_day >= 60)
value += SECSPERDAY;
break;
case DAY_OF_YEAR:
/*
** n - day of year.
** Just add SECSPERDAY times the day number to the time of
** January 1, midnight, to get the day.
*/
value = rulep->r_day * SECSPERDAY;
break;
case MONTH_NTH_DAY_OF_WEEK:
/*
** Mm.n.d - nth "dth day" of month m.
*/
/*
** Use Zeller's Congruence to get day-of-week of first day of
** month.
*/
m1 = (rulep->r_mon + 9) % 12 + 1;
yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
yy1 = yy0 / 100;
yy2 = yy0 % 100;
dow = ((26 * m1 - 2) / 10 +
1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
if (dow < 0)
dow += DAYSPERWEEK;
/*
** "dow" is the day-of-week of the first day of the month. Get
** the day-of-month (zero-origin) of the first "dow" day of the
** month.
*/
d = rulep->r_day - dow;
if (d < 0)
d += DAYSPERWEEK;
for (int i = 1; i < rulep->r_week; ++i) {
if (d + DAYSPERWEEK >=
mon_lengths[leapyear][rulep->r_mon - 1])
break;
d += DAYSPERWEEK;
}
/*
** "d" is the day-of-month (zero-origin) of the day we want.
*/
value = d * SECSPERDAY;
for (int i = 0; i < rulep->r_mon - 1; ++i)
value += mon_lengths[leapyear][i] * SECSPERDAY;
break;
}
/*
** "value" is the year-relative time of 00:00:00 UT on the day in
** question. To get the year-relative time of the specified local
** time on that day, add the transition time and the current offset
** from UT.
*/
return value + rulep->r_time + offset;
}
/*
** Given a POSIX section 8-style TZ string, fill in the rule tables as
** appropriate.
*/
static int tzparse(const char * name, struct state * const sp, const int lastditch) {
const char * stdname;
const char * dstname;
size_t stdlen;
size_t dstlen;
int_fast32_t stdoffset;
int_fast32_t dstoffset;
char * cp;
int load_result;
static struct ttinfo zttinfo;
INITIALIZE(dstname);
stdname = name;
if (lastditch) {
stdlen = strlen(name); /* length of standard zone name */
name += stdlen;
if (stdlen >= sizeof sp->chars)
stdlen = (sizeof sp->chars) - 1;
stdoffset = 0;
} else {
if (*name == '<') {
name++;
stdname = name;
name = getqzname(name, '>');
if (*name != '>')
return (-1);
stdlen = name - stdname;
name++;
} else {
name = getzname(name);
stdlen = name - stdname;
}
if (*name == '\0')
return -1;
name = getoffset(name, &stdoffset);
if (name == NULL)
return -1;
}
load_result = tzload(TZDEFRULES, sp, FALSE);
if (load_result != 0)
sp->leapcnt = 0; /* so, we're off a little */
if (*name != '\0') {
if (*name == '<') {
dstname = ++name;
name = getqzname(name, '>');
if (*name != '>')
return -1;
dstlen = name - dstname;
name++;
} else {
dstname = name;
name = getzname(name);
dstlen = name - dstname; /* length of DST zone name */
}
if (*name != '\0' && *name != ',' && *name != ';') {
name = getoffset(name, &dstoffset);
if (name == NULL)
return -1;
} else dstoffset = stdoffset - SECSPERHOUR;
if (*name == '\0' && load_result != 0)
name = TZDEFRULESTRING;
if (*name == ',' || *name == ';') {
struct rule start;
struct rule end;
int year;
int yearlim;
int timecnt;
time_t janfirst;
++name;
if ((name = getrule(name, &start)) == NULL)
return -1;
if (*name++ != ',')
return -1;
if ((name = getrule(name, &end)) == NULL)
return -1;
if (*name != '\0')
return -1;
sp->typecnt = 2; /* standard time and DST */
/*
** Two transitions per year, from EPOCH_YEAR forward.
*/
sp->ttis[0] = sp->ttis[1] = zttinfo;
sp->ttis[0].tt_gmtoff = -dstoffset;
sp->ttis[0].tt_isdst = 1;
sp->ttis[0].tt_abbrind = (int)(stdlen + 1);
sp->ttis[1].tt_gmtoff = -stdoffset;
sp->ttis[1].tt_isdst = 0;
sp->ttis[1].tt_abbrind = 0;
timecnt = 0;
janfirst = 0;
yearlim = EPOCH_YEAR + YEARSPERREPEAT;
for (year = EPOCH_YEAR; year < yearlim; year++) {
int_fast32_t
starttime = transtime(year, &start, stdoffset),
endtime = transtime(year, &end, dstoffset);
int_fast32_t
yearsecs = (year_lengths[isleap(year)]
* SECSPERDAY);
int reversed = endtime < starttime;
if (reversed) {
int_fast32_t swap = starttime;
starttime = endtime;
endtime = swap;
}
if (reversed
|| (starttime < endtime
&& (endtime - starttime
< (yearsecs
+ (stdoffset - dstoffset))))) {
if (TZ_MAX_TIMES - 2 < timecnt)
break;
yearlim = year + YEARSPERREPEAT + 1;
sp->ats[timecnt] = janfirst;
if (increment_overflow_time
(&sp->ats[timecnt], starttime))
break;
sp->types[timecnt++] = (unsigned char) reversed;
sp->ats[timecnt] = janfirst;
if (increment_overflow_time
(&sp->ats[timecnt], endtime))
break;
sp->types[timecnt++] = !reversed;
}
if (increment_overflow_time(&janfirst, yearsecs))
break;
}
sp->timecnt = timecnt;
if (!timecnt)
sp->typecnt = 1; /* Perpetual DST. */
} else {
int_fast32_t theirstdoffset, theirdstoffset, theiroffset;
int isdst;
if (*name != '\0')
return -1;
/*
** Initial values of theirstdoffset and theirdstoffset.
*/
theirstdoffset = 0;
for (int i = 0; i < sp->timecnt; ++i) {
int j = sp->types[i];
if (!sp->ttis[j].tt_isdst) {
theirstdoffset =
-sp->ttis[j].tt_gmtoff;
break;
}
}
theirdstoffset = 0;
for (int i = 0; i < sp->timecnt; ++i) {
int j = sp->types[i];
if (sp->ttis[j].tt_isdst) {
theirdstoffset =
-sp->ttis[j].tt_gmtoff;
break;
}
}
/*
** Initially we're assumed to be in standard time.
*/
isdst = FALSE;
theiroffset = theirstdoffset;
/*
** Now juggle transition times and types
** tracking offsets as you do.
*/
for (int i = 0; i < sp->timecnt; ++i) {
int j = sp->types[i];
sp->types[i] = (unsigned char)sp->ttis[j].tt_isdst;
if (sp->ttis[j].tt_ttisgmt) {
/* No adjustment to transition time */
} else {
/*
** If summer time is in effect, and the
** transition time was not specified as
** standard time, add the summer time
** offset to the transition time;
** otherwise, add the standard time
** offset to the transition time.
*/
/*
** Transitions from DST to DDST
** will effectively disappear since
** POSIX provides for only one DST
** offset.
*/
if (isdst && !sp->ttis[j].tt_ttisstd) {
sp->ats[i] += dstoffset -
theirdstoffset;
} else {
sp->ats[i] += stdoffset -
theirstdoffset;
}
}
theiroffset = -sp->ttis[j].tt_gmtoff;
if (sp->ttis[j].tt_isdst)
theirdstoffset = theiroffset;
else theirstdoffset = theiroffset;
}
/*
** Finally, fill in ttis.
*/
sp->ttis[0] = sp->ttis[1] = zttinfo;
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = FALSE;
sp->ttis[0].tt_abbrind = 0;
sp->ttis[1].tt_gmtoff = -dstoffset;
sp->ttis[1].tt_isdst = TRUE;
sp->ttis[1].tt_abbrind = (int)(stdlen + 1);
sp->typecnt = 2;
}
} else {
dstlen = 0;
sp->typecnt = 1; /* only standard time */
sp->timecnt = 0;
sp->ttis[0] = zttinfo;
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = 0;
sp->ttis[0].tt_abbrind = 0;
}
sp->charcnt = (int)(stdlen + 1);
if (dstlen != 0)
sp->charcnt += dstlen + 1;
if ((size_t) sp->charcnt > sizeof sp->chars)
return -1;
cp = sp->chars;
(void) strncpy(cp, stdname, stdlen);
cp += stdlen;
*cp++ = '\0';
if (dstlen != 0) {
(void) strncpy(cp, dstname, dstlen);
*(cp + dstlen) = '\0';
}
return 0;
}
static int typesequiv(const struct state * const sp, const int a, const int b) {
int result;
if (sp == NULL ||
a < 0 || a >= sp->typecnt ||
b < 0 || b >= sp->typecnt)
result = FALSE;
else {
const struct ttinfo * ap = &sp->ttis[a];
const struct ttinfo * bp = &sp->ttis[b];
result = ap->tt_gmtoff == bp->tt_gmtoff &&
ap->tt_isdst == bp->tt_isdst &&
ap->tt_ttisstd == bp->tt_ttisstd &&
ap->tt_ttisgmt == bp->tt_ttisgmt &&
strcmp(&sp->chars[ap->tt_abbrind],
&sp->chars[bp->tt_abbrind]) == 0;
}
return result;
} // #nocov end
static int leaps_thru_end_of(const int y) {
return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
-(leaps_thru_end_of(-(y + 1)) + 1);
}
static struct tm * timesub(const time_t *const timep, const int_fast32_t offset,
const struct state *const sp, struct tm *const tmp) {
const struct lsinfo * lp;
time_t tdays;
int idays; /* unsigned would be so 2003 */
int_fast64_t rem;
int y;
const int * ip;
int_fast64_t corr;
int hit;
int i;
corr = 0;
hit = 0;
i = sp->leapcnt;
while (--i >= 0) {
lp = &sp->lsis[i]; // #nocov start
if (*timep >= lp->ls_trans) {
if (*timep == lp->ls_trans) {
hit = ((i == 0 && lp->ls_corr > 0) ||
lp->ls_corr > sp->lsis[i - 1].ls_corr);
if (hit)
while (i > 0 &&
sp->lsis[i].ls_trans ==
sp->lsis[i - 1].ls_trans + 1 &&
sp->lsis[i].ls_corr ==
sp->lsis[i - 1].ls_corr + 1) {
++hit;
--i;
}
}
corr = lp->ls_corr;
break; // #nocov end
}
}
y = EPOCH_YEAR;
tdays = *timep / SECSPERDAY;
rem = *timep - tdays * SECSPERDAY;
while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
int newy;
time_t tdelta;
int idelta;
int leapdays;
tdelta = tdays / DAYSPERLYEAR;
if (! ((! TYPE_SIGNED(time_t) || INT_MIN <= tdelta)
&& tdelta <= INT_MAX))
return NULL; // #nocov
idelta = (int)tdelta;
if (idelta == 0)
idelta = (tdays < 0) ? -1 : 1;
newy = y;
if (increment_overflow(&newy, idelta))
return NULL; // #nocov
leapdays = leaps_thru_end_of(newy - 1) -
leaps_thru_end_of(y - 1);
tdays -= ((time_t) newy - y) * DAYSPERNYEAR;
tdays -= leapdays;
y = newy;
}
{
int_fast32_t seconds;
seconds = (int_fast32_t)(tdays * SECSPERDAY);
tdays = seconds / SECSPERDAY;
rem += seconds - tdays * SECSPERDAY;
}
/*
** Given the range, we can now fearlessly cast...
*/
idays = (int)tdays;
rem += offset - corr;
while (rem < 0) { // #nocov start
rem += SECSPERDAY;
--idays;
}
while (rem >= SECSPERDAY) {
rem -= SECSPERDAY;
++idays;
}
while (idays < 0) {
if (increment_overflow(&y, -1))
return NULL;
idays += year_lengths[isleap(y)];
}
while (idays >= year_lengths[isleap(y)]) {
idays -= year_lengths[isleap(y)];
if (increment_overflow(&y, 1))
return NULL; // #nocov end
}
// Previously we returned 'year + base', so keep behaviour
// It seems like R now returns just 'year - 1900' (as libc does)
// But better for continuity to do as before
tmp->tm_year = y + TM_YEAR_BASE;
if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
return NULL; // #nocov
tmp->tm_yday = idays;
/*
** The "extra" mods below avoid overflow problems.
*/
tmp->tm_wday = EPOCH_WDAY +
((y - EPOCH_YEAR) % DAYSPERWEEK) *
(DAYSPERNYEAR % DAYSPERWEEK) +
leaps_thru_end_of(y - 1) -
leaps_thru_end_of(EPOCH_YEAR - 1) +
idays;
tmp->tm_wday %= DAYSPERWEEK;
if (tmp->tm_wday < 0)
tmp->tm_wday += DAYSPERWEEK; // #nocov
tmp->tm_hour = (int) (rem / SECSPERHOUR);
rem %= SECSPERHOUR;
tmp->tm_min = (int) (rem / SECSPERMIN);
/*
** A positive leap second requires a special
** representation. This uses "... ??:59:60" et seq.
*/
tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
ip = mon_lengths[isleap(y)];
for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
idays -= ip[tmp->tm_mon];
tmp->tm_mday = (int) (idays + 1);
tmp->tm_isdst = 0;
#if ! (defined(__MINGW32__) || defined(__MINGW64__) || defined(__sun) || defined(sun) || defined(_AIX))
//#ifdef HAVE_TM_GMTOFF
tmp->tm_gmtoff = offset;
#endif
return tmp;
}
static void gmtload(struct state * const sp) {
if (tzload(gmt, sp, TRUE) != 0)
(void) tzparse(gmt, sp, TRUE);
}
/*
** gmtsub is to gmtime as localsub is to localtime.
*/
static struct tm * gmtsub(const time_t *const timep, const int_fast32_t offset, struct tm *const tmp) {
struct tm * result;
if (!gmt_is_set) {
gmt_is_set = TRUE;
gmtload(gmtptr);
}
result = timesub(timep, offset, gmtptr, tmp);
return result;
}
// [[Rcpp::register]]
struct tm * gmtime_(const time_t * const timep) {
return gmtsub(timep, 0L, &tm);
}
}
Rcpp/src/attributes.cpp 0000644 0001762 0000144 00000432341 15126566764 014670 0 ustar ligges users // attributes.cpp: Rcpp R/C++ interface class library -- Rcpp attributes
//
// Copyright (C) 2012 - 2020 JJ Allaire, Dirk Eddelbuettel and Romain Francois
// Copyright (C) 2021 - 2026 JJ Allaire, Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and Travers Ching
//
// This file is part of Rcpp.
//
// Rcpp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Rcpp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rcpp. If not, see .
#define COMPILING_RCPP
#include
#include
#include
#include
#include
#include
#include