Rcpp/0000755000176200001440000000000015130420312011145 5ustar liggesusersRcpp/tests/0000755000176200001440000000000015125252117012321 5ustar liggesusersRcpp/tests/tinytest.R0000644000176200001440000000473015125252117014333 0ustar liggesusers 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/.Rinstignore0000644000176200001440000000011412457514534013470 0ustar liggesusersinst/doc/Makefile inst/doc/jss.bst inst/doc/RJournal.sty inst/unitTests/src Rcpp/MD50000644000176200001440000013645315130420312011471 0ustar liggesusersf78cc2f0e2e03e422eef8622dacc0bd3 *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/0000755000176200001440000000000015126566764011401 5ustar liggesusersRcpp/R/RcppClass.R0000644000176200001440000001470514000602755013402 0ustar liggesusers# 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.R0000644000176200001440000001072315126566764013570 0ustar liggesusers# 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.R0000644000176200001440000014166115126566764013663 0ustar liggesusers # 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.R0000644000176200001440000000311413036432110013653 0ustar liggesusers# 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.R0000644000176200001440000000335313022667267014173 0ustar liggesusers# 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.R0000644000176200001440000000144613036432110012234 0ustar liggesusers# 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.R0000644000176200001440000000206215115301232012330 0ustar liggesusers# 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.R0000644000176200001440000000554614765550031012662 0ustar liggesusers# 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.R0000644000176200001440000002007613326145624014006 0ustar liggesusers# 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.R0000644000176200001440000000512615126566764012467 0ustar liggesusers## 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.R0000644000176200001440000001023013257743257012775 0ustar liggesusers# 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.R0000644000176200001440000000636313257743257013465 0ustar liggesusers# 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.R0000644000176200001440000000457113022667267013347 0ustar liggesusers# 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.R0000644000176200001440000004277715126566764012772 0ustar liggesusers# 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.R0000644000176200001440000000370615126566764013010 0ustar liggesusers# 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.R0000644000176200001440000000205612253723677013354 0ustar liggesusers# 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.R0000644000176200001440000002556515126566764015662 0ustar liggesusers# 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.R0000644000176200001440000001110015126566764013602 0ustar liggesusers# 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/cleanup0000755000176200001440000000325515127740111012537 0ustar liggesusers#!/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/0000755000176200001440000000000015127740111013165 5ustar liggesusersRcpp/vignettes/Rcpp-modules.pdf.asis0000644000176200001440000000023415115301232017161 0ustar liggesusers%\VignetteIndexEntry{Rcpp-modules} %\VignetteKeywords{Rcpp, modules, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-extending.pdf.asis0000644000176200001440000000024015115301232017473 0ustar liggesusers%\VignetteIndexEntry{Rcpp-extending} %\VignetteKeywords{Rcpp, extending, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-sugar.pdf.asis0000644000176200001440000000023015115301232016626 0ustar liggesusers%\VignetteIndexEntry{Rcpp-sugar} %\VignetteKeywords{Rcpp, sugar, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-FAQ.pdf.asis0000644000176200001440000000022415115301232016117 0ustar liggesusers%\VignetteIndexEntry{Rcpp-FAQ} %\VignetteKeywords{Rcpp, FAQ, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-attributes.pdf.asis0000644000176200001440000000024215115301232017676 0ustar liggesusers%\VignetteIndexEntry{Rcpp-attributes} %\VignetteKeywords{Rcpp, attributes, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-introduction.pdf.asis0000644000176200001440000000023015115301232020226 0ustar liggesusers%\VignetteIndexEntry{Rcpp-introduction} %\VignetteKeywords{Rcpp, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-quickref.pdf.asis0000644000176200001440000000023615115301232017324 0ustar liggesusers%\VignetteIndexEntry{Rcpp-quickref} %\VignetteKeywords{Rcpp, quickref, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-jss-2011.pdf.asis0000644000176200001440000000026715115301232016677 0ustar liggesusers%\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.asis0000644000176200001440000000023415115301232017104 0ustar liggesusers%\VignetteIndexEntry{Rcpp-package} %\VignetteKeywords{Rcpp, package, R, Cpp} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/vignettes/Rcpp-libraries.pdf.asis0000644000176200001440000000023715115301232017470 0ustar liggesusers%\VignetteIndexEntry{Rcpp-libraries} %\VignetteKeywords{Rcpp, Package, Library} %\VignettePackage{Rcpp} %\VignetteEncoding{UTF-8} %\VignetteEngine{Rcpp::asis} Rcpp/src/0000755000176200001440000000000015127740111011744 5ustar liggesusersRcpp/src/module.cpp0000644000176200001440000001554513701060673013753 0ustar liggesusers// -*- 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.win0000644000176200001440000000004312253723677014250 0ustar liggesusersPKG_CPPFLAGS = -I../inst/include/ Rcpp/src/barrier.cpp0000644000176200001440000001557515126566764014136 0ustar liggesusers // 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.cpp0000644000176200001440000013107414765550031013402 0ustar liggesusers// 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.cpp0000644000176200001440000043234115126566764014670 0ustar liggesusers// 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 #include #include #include // for std::endl #include #include #define RCPP_NO_SUGAR #include /******************************************************************* * AttributesUtil.h *******************************************************************/ namespace Rcpp { namespace attributes { // Utility class for getting file existence and last modified time class FileInfo { public: // create from path explicit FileInfo(const std::string& path); // create from R list explicit FileInfo(const List& fileInfo) { // #nocov start path_ = as(fileInfo["path"]); exists_ = as(fileInfo["exists"]); lastModified_ = as(fileInfo["lastModified"]); } // #nocov end // convert to R list List toList() const { List fileInfo; fileInfo["path"] = path_; fileInfo["exists"] = exists_; fileInfo["lastModified"] = lastModified_; return fileInfo; } std::string path() const { return path_; } bool exists() const { return exists_; } double lastModified() const { return lastModified_; } std::string extension() const { std::string::size_type pos = path_.find_last_of('.'); if (pos != std::string::npos) return path_.substr(pos); else return ""; // #nocov } bool operator<(const FileInfo& other) const { return path_ < other.path_; }; bool operator==(const FileInfo& other) const { return path_ == other.path_ && exists_ == other.exists_ && lastModified_ == other.lastModified_; }; bool operator!=(const FileInfo& other) const { return ! (*this == other); }; std::ostream& operator<<(std::ostream& os) const { os << path_; return os; } private: std::string path_; bool exists_; double lastModified_; }; // Remove a file bool removeFile(const std::string& path); // Recursively create a directory void createDirectory(const std::string& path); // Known whitespace chars extern const char * const kWhitespaceChars; // Query whether a character is whitespace bool isWhitespace(char ch); // Trim a string void trimWhitespace(std::string* pStr); // Strip trailing line comments void stripTrailingLineComments(std::string* pStr); // Strip balanced quotes from around a string (assumes already trimmed) void stripQuotes(std::string* pStr); // is the passed string quoted? bool isQuoted(const std::string& str); // does a string end with another string? bool endsWith(const std::string& str, const std::string& suffix); // show a warning message void showWarning(const std::string& msg); // is the line a C++ roxygen comment? (started with //') bool isRoxygenCpp(const std::string& str); } // namespace attributes } // namespace Rcpp /******************************************************************* * AttributesTypes.h *******************************************************************/ namespace Rcpp { namespace attributes { // Known attribute names & parameters const char * const kExportAttribute = "export"; const char * const kExportName = "name"; const char * const kExportRng = "rng"; const char * const kExportInvisible = "invisible"; const char * const kExportSignature = "signature"; const char * const kInitAttribute = "init"; const char * const kDependsAttribute = "depends"; const char * const kPluginsAttribute = "plugins"; const char * const kInterfacesAttribute = "interfaces"; const char * const kInterfaceR = "r"; const char * const kInterfaceCpp = "cpp"; const char * const kParamValueFalse = "false"; const char * const kParamValueTrue = "true"; const char * const kParamValueFALSE = "FALSE"; const char * const kParamValueTRUE = "TRUE"; const char * const kParamBlockStart = "{;"; const char * const kParamBlockEnd = "}"; // Type info class Type { public: Type(): isConst_(false), isReference_(false) {} Type(const std::string& name, bool isConst, bool isReference) : name_(name), isConst_(isConst), isReference_(isReference) { } bool empty() const { return name().empty(); } bool operator==(const Type& other) const { // #nocov start return name_ == other.name_ && isConst_ == other.isConst_ && isReference_ == other.isReference_; }; // #nocov end bool operator!=(const Type& other) const { return !(*this == other); }; const std::string& name() const { return name_; } std::string full_name() const { std::string res ; if( isConst() ) res += "const " ; res += name() ; if( isReference() ) res += "&" ; return res ; } bool isVoid() const { return name() == "void"; } bool isConst() const { return isConst_; } bool isReference() const { return isReference_; } private: std::string name_; bool isConst_; bool isReference_; }; // Argument info class Argument { public: Argument() {} Argument(const std::string& name, const Type& type, const std::string& defaultValue) : name_(name), type_(type), defaultValue_(defaultValue) { } bool empty() const { return type().empty(); } bool operator==(const Argument& other) const { // #nocov start return name_ == other.name_ && type_ == other.type_ && defaultValue_ == other.defaultValue_; }; // #nocov end bool operator!=(const Argument& other) const { return !(*this == other); }; const std::string& name() const { return name_; } const Type& type() const { return type_; } const std::string& defaultValue() const { return defaultValue_; } private: std::string name_; Type type_; std::string defaultValue_; }; // Function info class Function { public: Function() {} Function(const Type& type, const std::string& name, const std::vector& arguments) : type_(type), name_(name), arguments_(arguments) { } Function renamedTo(const std::string& name) const { // #nocov start return Function(type(), name, arguments()); } std::string signature() const { return signature(name()); } std::string signature(const std::string& name) const; bool isHidden() const { return name().find_first_of('.') == 0; } // #nocov end bool empty() const { return name().empty(); } bool operator==(const Function& other) const { // #nocov start return type_ == other.type_ && name_ == other.name_ && arguments_ == other.arguments_; }; // #nocov end bool operator!=(const Function& other) const { return !(*this == other); }; const Type& type() const { return type_; } const std::string& name() const { return name_; } const std::vector& arguments() const { return arguments_; } private: Type type_; std::string name_; std::vector arguments_; }; // Attribute parameter (with optional value) class Param { public: Param() {} explicit Param(const std::string& paramText); bool empty() const { return name().empty(); } bool operator==(const Param& other) const { // #nocov start return name_ == other.name_ && value_ == other.value_; }; // #nocov end bool operator!=(const Param& other) const { return !(*this == other); }; const std::string& name() const { return name_; } const std::string& value() const { return value_; } // #nocov private: std::string name_; std::string value_; }; // Attribute (w/ optional params and signature of function it qualifies) class Attribute { public: Attribute() {} Attribute(const std::string& name, const std::vector& params, const Function& function, const std::vector& roxygen) : name_(name), params_(params), function_(function), roxygen_(roxygen) { } bool empty() const { return name().empty(); } // #nocov start bool operator==(const Attribute& other) const { return name_ == other.name_ && params_ == other.params_ && function_ == other.function_ && roxygen_ == other.roxygen_; }; // #nocov end bool operator!=(const Attribute& other) const { return !(*this == other); }; const std::string& name() const { return name_; } const std::vector& params() const { return params_; } Param paramNamed(const std::string& name) const; bool hasParameter(const std::string& name) const { return !paramNamed(name).empty(); } const Function& function() const { return function_; } bool isExportedFunction() const { return (name() == kExportAttribute) && !function().empty(); } std::string exportedName() const { // check for explicit name parameter if (hasParameter(kExportName)) { return paramNamed(kExportName).value(); // #nocov } // otherwise un-named parameter in the first slot else if (!params().empty() && params()[0].value().empty()) { return params()[0].name(); // #nocov } // otherwise the actual function name { return function().name(); } } std::string exportedCppName() const { // #nocov start std::string name = exportedName(); std::replace(name.begin(), name.end(), '.', '_'); return name; } // #nocov end bool rng() const { Param rngParam = paramNamed(kExportRng); if (!rngParam.empty()) return rngParam.value() == kParamValueTrue || // #nocov rngParam.value() == kParamValueTRUE; // #nocov else return true; } bool invisible() const { Param invisibleParam = paramNamed(kExportInvisible); if (!invisibleParam.empty()) return invisibleParam.value() == kParamValueTrue || // #nocov invisibleParam.value() == kParamValueTRUE; // #nocov else return false; } const std::vector& roxygen() const { return roxygen_; } std::string customRSignature() const { Param sigParam = paramNamed(kExportSignature); std::string sig = sigParam.value(); trimWhitespace(&sig); if (sig.empty()) return sig; if (sig.back() == '}') sig = sig.substr(0, sig.size()-1); // check sig.empty again since we deleted an element if (sig.empty()) return sig; if (sig.front() == '{') sig.erase(0,1); return sig; } private: std::string name_; std::vector params_; Function function_; std::vector roxygen_; }; // Operator << for parsed types std::ostream& operator<<(std::ostream& os, const Type& type); std::ostream& operator<<(std::ostream& os, const Argument& argument); std::ostream& operator<<(std::ostream& os, const Function& function); std::ostream& operator<<(std::ostream& os, const Param& param); std::ostream& operator<<(std::ostream& os, const Attribute& attribute); // interface to source file attributes class SourceFileAttributes { public: virtual ~SourceFileAttributes() {}; virtual const std::string& sourceFile() const = 0; virtual bool hasInterface(const std::string& name) const = 0; typedef std::vector::const_iterator const_iterator; virtual const_iterator begin() const = 0; virtual const_iterator end() const = 0; virtual const std::vector& modules() const = 0; virtual const std::vector >& roxygenChunks() const = 0; virtual bool hasGeneratorOutput() const = 0; virtual bool hasPackageInit() const = 0; }; } // namespace attributes } // namespace Rcpp /******************************************************************* * AttributesParser.h *******************************************************************/ namespace Rcpp { namespace attributes { // Helper class for determining whether we are in a comment class CommentState { public: CommentState() : inComment_(false) {} private: // prohibit copying CommentState(const CommentState&); CommentState& operator=(const CommentState&); public: bool inComment() const { return inComment_; } void submitLine(const std::string& line); void reset() { inComment_ = false; } private: bool inComment_; }; // Class used to parse and return attribute information from a source file class SourceFileAttributesParser : public SourceFileAttributes { public: explicit SourceFileAttributesParser(const std::string& sourceFile, const std::string& packageFile, bool parseDependencies); private: // prohibit copying SourceFileAttributesParser(const SourceFileAttributesParser&); SourceFileAttributesParser& operator=(const SourceFileAttributesParser&); public: // implemetnation of SourceFileAttributes interface virtual const std::string& sourceFile() const { // #nocov return sourceFile_; // #nocov } virtual const_iterator begin() const { return attributes_.begin(); } virtual const_iterator end() const { return attributes_.end(); } virtual const std::vector& modules() const { return modules_; } virtual const std::vector >& roxygenChunks() const { return roxygenChunks_; } virtual bool hasGeneratorOutput() const { return !attributes_.empty() || !modules_.empty() || !roxygenChunks_.empty(); } virtual bool hasInterface(const std::string& name) const { for (const_iterator it=begin(); it != end(); ++it) { if (it->name() == kInterfacesAttribute) { return it->hasParameter(name); // #nocov } } // if there's no interfaces attrbute we default to R if (name == kInterfaceR) return true; else return false; } // Was a package init function found? bool hasPackageInit() const { return hasPackageInit_; } // Get lines of embedded R code const std::vector& embeddedR() const { return embeddedR_; } // Get source dependencies const std::vector& sourceDependencies() const { return sourceDependencies_; }; private: // Parsing helpers Attribute parseAttribute(const std::vector& match, int lineNumber); std::vector parseParameters(const std::string& input); Function parseFunction(size_t lineNumber); std::string parseSignature(size_t lineNumber); std::vector parseArguments(const std::string& argText); Type parseType(const std::string& text); // Validation helpers bool isKnownAttribute(const std::string& name) const; void attributeWarning(const std::string& message, const std::string& attribute, size_t lineNumber); void attributeWarning(const std::string& message, size_t lineNumber); void rcppExportWarning(const std::string& message, size_t lineNumber); void rcppExportNoFunctionFoundWarning(size_t lineNumber); void rcppExportInvalidParameterWarning(const std::string& param, size_t lineNumber); void rcppInterfacesWarning(const std::string& message, size_t lineNumber); private: std::string sourceFile_; CharacterVector lines_; std::vector attributes_; std::vector modules_; bool hasPackageInit_; std::vector embeddedR_; std::vector sourceDependencies_; std::vector > roxygenChunks_; std::vector roxygenBuffer_; }; } // namespace attributes } // namespace Rcpp /******************************************************************* * AttributesGen.h *******************************************************************/ namespace Rcpp { namespace attributes { // Abstract class which manages writing of code for compileAttributes class ExportsGenerator { protected: ExportsGenerator(const std::string& targetFile, const std::string& package, const std::string& commentPrefix); private: // prohibit copying ExportsGenerator(const ExportsGenerator&); ExportsGenerator& operator=(const ExportsGenerator&); public: virtual ~ExportsGenerator() {} // Name of target file and package const std::string& targetFile() const { return targetFile_; } const std::string& package() const { return package_; } const std::string& packageCpp() const { return packageCpp_; } const std::string packageCppPrefix() const { return "_" + packageCpp(); } // Abstract interface for code generation virtual void writeBegin() = 0; void writeFunctions(const SourceFileAttributes& attributes, bool verbose); // see doWriteFunctions below virtual void writeEnd(bool hasPackageInit) = 0; virtual bool commit(const std::vector& includes) = 0; // Remove the generated file entirely bool remove(); // Allow generator to appear as a std::ostream& operator std::ostream&() { return codeStream_; } protected: // Allow access to the output stream std::ostream& ostr() { return codeStream_; } bool hasCppInterface() const { return hasCppInterface_; } // Shared knowledge about function namees std::string exportValidationFunction() { return "RcppExport_validate"; } std::string exportValidationFunctionRegisteredName() { return packageCppPrefix() + "_" + exportValidationFunction(); } std::string registerCCallableExportedName() { // #nocov return packageCppPrefix() + "_RcppExport_registerCCallable"; // #nocov } // Commit the stream -- is a no-op if the existing code is identical // to the generated code. Returns true if data was written and false // if it wasn't (throws exception on io error) bool commit(const std::string& preamble = std::string()); // Convert a dot in package name to underscore for use in header file name std::string dotNameHelper(const std::string & name) const; private: // Private virtual for doWriteFunctions so the base class // can always intercept writeFunctions virtual void doWriteFunctions(const SourceFileAttributes& attributes, bool verbose) = 0; // Check whether it's safe to overwrite this file (i.e. whether we // generated the file in the first place) bool isSafeToOverwrite() const { return existingCode_.empty() || (existingCode_.find(generatorToken()) != std::string::npos); } // UUID that we write into a comment within the file (so that we can // strongly identify that a file was generated by us before overwriting it) std::string generatorToken() const { return "10BE3573-1514-4C36-9D1C-5A225CD40393"; } private: std::string targetFile_; std::string package_; std::string packageCpp_; std::string commentPrefix_; std::string existingCode_; std::ostringstream codeStream_; bool hasCppInterface_; }; // Class which manages generating RcppExports.cpp class CppExportsGenerator : public ExportsGenerator { public: explicit CppExportsGenerator(const std::string& packageDir, const std::string& package, const std::string& fileSep); virtual void writeBegin() {}; virtual void writeEnd(bool hasPackageInit); virtual bool commit(const std::vector& includes); private: virtual void doWriteFunctions(const SourceFileAttributes& attributes, bool verbose); std::string registerCCallable(size_t indent, const std::string& exportedName, const std::string& name) const; private: // for generating calls to init functions std::vector initFunctions_; // for generating C++ interfaces std::vector cppExports_; // for generating Rcpp::export native routine registration std::vector nativeRoutines_; // for generating module native routine registration std::vector modules_; }; // Class which manages generating PackageName_RcppExports.h header file class CppExportsIncludeGenerator : public ExportsGenerator { public: CppExportsIncludeGenerator(const std::string& packageDir, const std::string& package, const std::string& fileSep); virtual void writeBegin(); virtual void writeEnd(bool hasPackageInit); virtual bool commit(const std::vector& includes); private: virtual void doWriteFunctions(const SourceFileAttributes& attributes, bool verbose); std::string getCCallable(const std::string& function) const; std::string getHeaderGuard() const; private: std::string includeDir_; }; // Class which manages generating PackageName.h header file class CppPackageIncludeGenerator : public ExportsGenerator { public: CppPackageIncludeGenerator(const std::string& packageDir, const std::string& package, const std::string& fileSep); virtual void writeBegin() {} virtual void writeEnd(bool hasPackageInit); virtual bool commit(const std::vector& includes); private: virtual void doWriteFunctions(const SourceFileAttributes&, bool) {} std::string getHeaderGuard() const; private: std::string includeDir_; }; // Class which manages generator RcppExports.R class RExportsGenerator : public ExportsGenerator { public: RExportsGenerator(const std::string& packageDir, const std::string& package, bool registration, const std::string& fileSep); virtual void writeBegin() {} virtual void writeEnd(bool hasPackageInit); virtual bool commit(const std::vector& includes); private: virtual void doWriteFunctions(const SourceFileAttributes& attributes, bool verbose); bool registration_; }; // Class to manage and dispatch to a list of generators class ExportsGenerators { public: typedef std::vector::iterator Itr; ExportsGenerators() {} virtual ~ExportsGenerators(); void add(ExportsGenerator* pGenerator); void writeBegin(); void writeFunctions(const SourceFileAttributes& attributes, bool verbose); void writeEnd(bool hasPackageInit); // Commit and return a list of the files that were updated std::vector commit( const std::vector& includes); // Remove and return a list of files that were removed std::vector remove(); private: // prohibit copying ExportsGenerators(const ExportsGenerators&); ExportsGenerators& operator=(const ExportsGenerators&); private: std::vector generators_; }; // Standalone generation helpers (used by sourceCpp) std::string generateRArgList(const Function& function); bool checkRSignature(const Function& function, std::string args); void initializeGlobals(std::ostream& ostr); void generateCpp(std::ostream& ostr, const SourceFileAttributes& attributes, bool includePrototype, bool cppInterface, const std::string& contextId); } // namespace attributes } // namespace Rcpp /******************************************************************* * AttributesParser.cpp *******************************************************************/ namespace Rcpp { namespace attributes { namespace { Rcpp::List regexMatches(Rcpp::CharacterVector lines, const std::string& regex) { Rcpp::Environment base("package:base"); Rcpp::Function regexec = base["regexec"]; Rcpp::Function regmatches = base["regmatches"]; Rcpp::RObject result = regexec(regex, lines); Rcpp::List matches = regmatches(lines, result); return matches; } template void readFile(const std::string& file, Stream& os) { std::ifstream ifs(file.c_str()); if (ifs.fail()) throw Rcpp::file_io_error(file); // #nocov os << ifs.rdbuf(); ifs.close(); } template void readLines(std::istream& is, Collection* pLines) { pLines->clear(); std::string line; while(std::getline(is, line)) { // strip \r (for the case of windows line terminators on posix) if (line.length() > 0 && *line.rbegin() == '\r') line.erase(line.length()-1, 1); stripTrailingLineComments(&line); pLines->push_back(line); } } bool addUniqueDependency(Rcpp::CharacterVector include, std::vector* pDependencies) { // return false if we already have this include std::string path = Rcpp::as(include); for (size_t i = 0; isize(); ++i) { if (pDependencies->at(i).path() == path) return false; } // add it and return true pDependencies->push_back(FileInfo(path)); return true; } void parseSourceDependencies(const std::string& sourceFile, std::vector* pDependencies) { // import R functions Rcpp::Environment baseEnv = Rcpp::Environment::base_env(); Rcpp::Function dirname = baseEnv["dirname"]; Rcpp::Function filepath = baseEnv["file.path"]; Rcpp::Function normalizePath = baseEnv["normalizePath"]; Rcpp::Function fileExists = baseEnv["file.exists"]; Rcpp::Environment toolsEnv = Rcpp::Environment::namespace_env( "tools"); Rcpp::Function filePathSansExt = toolsEnv["file_path_sans_ext"]; // get the path to the source file's directory Rcpp::CharacterVector sourceDir = dirname(sourceFile); // read the source file into a buffer std::stringstream buffer; readFile(sourceFile, buffer); // Now read into a list of strings (which we can pass to regexec) // First read into a std::deque (which will handle lots of append // operations efficiently) then copy into an R chracter vector std::deque lines; readLines(buffer, &lines); Rcpp::CharacterVector linesVector = Rcpp::wrap(lines); // look for local includes Rcpp::List matches = regexMatches( linesVector, "^\\s*#include\\s*\"([^\"]+)\"\\s*$"); // accumulate local includes (skip commented sections) CommentState commentState; std::vector newDependencies; for (int i = 0; i(include))); } std::vector exts; exts.push_back(".cc"); exts.push_back(".cpp"); for (size_t i = 0; i( // #nocov filePathSansExt(include)) + exts[i]; exists = fileExists(file); if (exists[0]) { if (addUniqueDependency(file, pDependencies)) { FileInfo fileInfo(file); newDependencies.push_back(fileInfo); } } } } } } } // look for dependencies recursively for (size_t i = 0; i parseSourceDependencies( std::string sourceFile) { // normalize source file Rcpp::Environment baseEnv = Rcpp::Environment::base_env(); Rcpp::Function normalizePath = baseEnv["normalizePath"]; sourceFile = Rcpp::as(normalizePath(sourceFile, "/")); // parse dependencies std::vector dependencies; parseSourceDependencies(sourceFile, &dependencies); // remove main source file dependencies.erase(std::remove(dependencies.begin(), // #nocov dependencies.end(), FileInfo(sourceFile)), dependencies.end()); return dependencies; } // Parse embedded R code chunks from a file (receives the lines of the // file as a CharcterVector for using with regexec and as a standard // stl vector for traversal/insepection) std::vector parseEmbeddedR( Rcpp::CharacterVector linesVector, const std::deque& lines) { Rcpp::List matches = regexMatches(linesVector, "^\\s*/\\*{3,}\\s*[Rr]\\s*$"); bool withinRBlock = false; CommentState commentState; std::vector embeddedR; for (int i = 0; i 0; // check state and do the right thing if (beginRBlock) { withinRBlock = true; // #nocov } else if (withinRBlock) { if (commentState.inComment()) // #nocov start embeddedR.push_back(line); else withinRBlock = false; // #nocov end } } return embeddedR; } } // anonymous namespace // Generate a type signature for the function with the provided name // (type signature == function pointer declaration) std::string Function::signature(const std::string& name) const { // #nocov start std::ostringstream ostr; ostr << type() << "(*" << name << ")("; const std::vector& args = arguments(); for (std::size_t i = 0; i::const_iterator it = params_.begin(); it != params_.end(); ++it) { if (it->name() == name) // #nocov return *it; // #nocov } return Param(); } // Type operator << std::ostream& operator<<(std::ostream& os, const Type& type) { if (!type.empty()) { if (type.isConst()) os << "const "; os << type.name(); if (type.isReference()) os << "&"; } return os; } // Print argument void printArgument(std::ostream& os, const Argument& argument, bool printDefault = true) { if (!argument.empty()) { os << argument.type(); if (!argument.name().empty()) { os << " "; os << argument.name(); if (printDefault && !argument.defaultValue().empty()) os << " = " << argument.defaultValue(); // #nocov } } } // Argument operator << std::ostream& operator<<(std::ostream& os, const Argument& argument) {// #nocov start printArgument(os, argument); return os; // #nocov end } // Print function void printFunction(std::ostream& os, const Function& function, bool printArgDefaults = true) { if (!function.empty()) { if (!function.type().empty()) { os << function.type(); os << " "; } os << function.name(); os << "("; const std::vector& arguments = function.arguments(); for (std::size_t i = 0; i& params = attribute.params(); if (params.size() > 0) { os << "("; for (std::size_t i = 0; i lines; readLines(buffer, &lines); lines_ = Rcpp::wrap(lines); // Scan for attributes CommentState commentState; Rcpp::List matches = regexMatches(lines_, "^\\s*//\\s*\\[\\[Rcpp::(\\w+)(\\(.*?\\))?\\]\\]\\s*$"); for (int i = 0; i 0) { // if the match size isn't 3 then regmatches has not behaved // as expected (it should return a vector of either 0 or 3 // elements). we don't ever expect this to occur but if it // does let's not crash if (match.size() != 3) continue; // #nocov // add the attribute Attribute attr = parseAttribute( Rcpp::as >(match), i); attributes_.push_back(attr); } // if it's not an attribute line then it could still be a // line of interest (e.g. roxygen comment) else { // save roxygen comments if (line.find("//'") == 0) { std::string roxLine = "#" + line.substr(2); roxygenBuffer_.push_back(roxLine); } // a non-roxygen line causes us to clear the roxygen buffer else if (!roxygenBuffer_.empty()) { roxygenChunks_.push_back(roxygenBuffer_); // #nocov roxygenBuffer_.clear(); // #nocov } } } // Scan for Rcpp modules commentState.reset(); Rcpp::List modMatches = regexMatches(lines_, "^\\s*RCPP_MODULE\\s*\\(\\s*(\\w+)\\s*\\).*$"); for (int i = 0; i 0) { const char * name = match[1]; modules_.push_back(name); } } // Scan for package init function hasPackageInit_ = false; commentState.reset(); std::string pkgInit = "R_init_" + packageNameCpp; Rcpp::List initMatches = regexMatches(lines_, "^[^/]+" + pkgInit + ".*DllInfo.*$"); for (int i = 0; i 0) { hasPackageInit_ = true; // #nocov start break; } // #nocov end } // Parse embedded R embeddedR_ = parseEmbeddedR(lines_, lines); // Recursively parse dependencies if requested if (parseDependencies) { // get source dependencies sourceDependencies_ = parseSourceDependencies(sourceFile); // parse attributes and modules from each dependent file for (size_t i = 0; i& match, int lineNumber) { // Attribute name std::string name = match[1]; // Warn if this is an unknown attribute if (!isKnownAttribute(name)) { attributeWarning("Unrecognized attribute Rcpp::" + name, // #nocov lineNumber); // #nocov } // Extract params if we've got them std::vector params; std::string paramsText = match[2]; if (!paramsText.empty()) { // we know from the regex that it's enclosed in parens so remove // trim before we do this just in case someone updates the regex // to allow for whitespace around the call trimWhitespace(¶msText); paramsText = paramsText.substr(1, paramsText.size()-2); // parse the parameters params = parseParameters(paramsText); } // Extract function signature if this is a function attribute // and it doesn't appear at the end of the file Function function; // special handling for export and init if (name == kExportAttribute || name == kInitAttribute) { // parse the function (unless we are at the end of the file in // which case we print a warning) if ((lineNumber + 1) < lines_.size()) function = parseFunction(lineNumber + 1); else rcppExportWarning("No function found", lineNumber); // #nocov // validate parameters for (std::size_t i=0; i 0)) { rcppExportWarning("No value specified for parameter '" + name + "'", lineNumber); } // parameter that isn't name or rng else if (!value.empty() && (name != kExportName) && (name != kExportRng) && (name != kExportInvisible) && (name != kExportSignature)) { rcppExportWarning("Unrecognized parameter '" + name + "'", lineNumber); } // rng that isn't true or false else if (name == kExportRng) { if (value != kParamValueFalse && value != kParamValueTrue && value != kParamValueFALSE && value != kParamValueTRUE) { rcppExportWarning("rng value must be true or false", lineNumber); } } // invisible that isn't true of false else if (name == kExportInvisible) { if (value != kParamValueFalse && value != kParamValueTrue && value != kParamValueFALSE && value != kParamValueTRUE) { rcppExportWarning("invisible value must be true or false", lineNumber); // #nocov end } } } } // validate interfaces parameter else if (name == kInterfacesAttribute) { if (params.empty()) { // #nocov start rcppInterfacesWarning("No interfaces specified", lineNumber);// } else { for (std::size_t i=0; i SourceFileAttributesParser::parseParameters( const std::string& input) { std::string::size_type blockstart = input.find_first_of(kParamBlockStart); std::string::size_type blockend = input.find_last_of(kParamBlockEnd); const std::string delimiters(","); std::vector params; std::string::size_type current; std::string::size_type next = std::string::npos; std::string::size_type signature_param_start = std::string::npos; do { // #nocov next = input.find_first_not_of(delimiters, next + 1); if (next == std::string::npos) break; // #nocov current = next; do { next = input.find_first_of(delimiters, next + 1); } while((next >= blockstart) && (next <= blockend) && (next != std::string::npos)); params.push_back(Param(input.substr(current, next - current))); if(params.back().name() == kExportSignature) { signature_param_start = current; } } while(next != std::string::npos); // if the signature param was found, then check that the name, // start block and end block exist and are in the correct order if(signature_param_start != std::string::npos) { bool sigchecks = signature_param_start < blockstart && blockstart < blockend && blockstart != std::string::npos && blockend != std::string::npos; if(!sigchecks) { throw Rcpp::exception("signature parameter found but missing {}"); } } return params; } // Parse a function from the specified spot in the source file Function SourceFileAttributesParser::parseFunction(size_t lineNumber) { // Establish the text to parse for the signature std::string signature = parseSignature(lineNumber); if (signature.empty()) { rcppExportNoFunctionFoundWarning(lineNumber); // #nocov return Function(); // #nocov } // Start at the end and look for the () that deliniates the arguments // (bail with an empty result if we can't find them) std::string::size_type endParenLoc = signature.find_last_of(')'); std::string::size_type beginParenLoc = signature.find_first_of('('); if (endParenLoc == std::string::npos || beginParenLoc == std::string::npos || endParenLoc < beginParenLoc) { rcppExportNoFunctionFoundWarning(lineNumber); // #nocov return Function(); // #nocov } // Find the type and name by scanning backwards for the whitespace that // delimites the type and name Type type; std::string name; const std::string preambleText = signature.substr(0, beginParenLoc); for (std::string::const_reverse_iterator it = preambleText.rbegin(); it != preambleText.rend(); ++it) { char ch = *it; if (isWhitespace(ch)) { if (!name.empty()) { // we are at the break between type and name so we can also // extract the type std::string typeText; while (++it != preambleText.rend()) typeText.insert(0U, 1U, *it); type = parseType(typeText); // break (since we now have the name and the type) break; } else continue; // #nocov } else { name.insert(0U, 1U, ch); } } // If we didn't find a name then bail if (name.empty()) { rcppExportNoFunctionFoundWarning(lineNumber); // #nocov return Function(); // #nocov } // If we didn't find a type then bail if (type.empty()) { // #nocov start rcppExportWarning("No function return type found", lineNumber); return Function(); // #nocov end } // Now scan for arguments std::vector arguments; std::string argsText = signature.substr(beginParenLoc + 1, endParenLoc-beginParenLoc-1); std::vector args = parseArguments(argsText); for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) { // Get argument sans whitespace (bail if the arg is empty) std::string arg = *it; trimWhitespace(&arg); if (arg.empty()) { // we don't warn here because the compilation will fail anyway continue; // #nocov } // If the argument has an = within it then it has a default value std::string defaultValue; std::string::size_type eqPos = arg.find_first_of('='); if ( (eqPos != std::string::npos) && ((eqPos + 1) < arg.size()) ) { defaultValue = arg.substr(eqPos+1); trimWhitespace(&defaultValue); arg = arg.substr(0, eqPos); trimWhitespace(&arg); } // Scan backwards for whitespace to determine where the type ends // (we go backwards because whitespace is valid inside the type // identifier but invalid inside the variable name). Note that if // there is no whitespace we'll end up taking the whole string, // which allows us to capture a type with no variable (but note // we'll ultimately fail to parse types with no variable if they // have embedded whitespace) std::string::size_type pos = arg.find_last_of(kWhitespaceChars); // check for name std::string name; if (pos != std::string::npos) { // insert whitespace if variables are joint with '&' std::string::size_type ref_pos = arg.substr(pos).find_last_of("&"); if (ref_pos != std::string::npos) { pos += ref_pos + 1; // #nocov arg.insert(pos, " "); // #nocov } name = arg.substr(pos); trimWhitespace(&name); } if (name.empty()) { // #nocov start rcppExportInvalidParameterWarning(arg, lineNumber); return Function(); // #nocov end } // check for type string Type type = parseType(arg.substr(0, pos)); if (type.empty()) { // #nocov start rcppExportInvalidParameterWarning(arg, lineNumber); return Function(); // #nocov end } // add argument arguments.push_back(Argument(name, type, defaultValue)); } return Function(type, name, arguments); } // Parse the text of a function signature from the specified line std::string SourceFileAttributesParser::parseSignature(size_t lineNumber) { // Look for the signature termination ({ or ; not inside quotes) // on this line and then subsequent lines if necessary std::string signature; for (size_t i = lineNumber; i < (size_t)lines_.size(); i++) { std::string line; line = lines_[i]; bool insideQuotes = false; char prevChar = 0; // scan for { or ; not inside quotes for (size_t c = 0; c < line.length(); ++c) { // alias character char ch = line.at(c); // update quotes state if (ch == '"' && prevChar != '\\') insideQuotes = !insideQuotes; // found signature termination, append and return if (!insideQuotes && ((ch == '{') || (ch == ';'))) { signature.append(line.substr(0, c)); return signature; } // record prev char (used to check for escaped quote i.e. \") prevChar = ch; } // if we didn't find a terminator on this line then just append the line // and move on to the next line signature.append(line); signature.push_back(' '); } // Not found return std::string(); // #nocov } // Parse arguments from function signature. This is tricky because commas // are used to delimit arguments but are also valid inside template type // qualifiers. std::vector SourceFileAttributesParser::parseArguments( const std::string& argText) { int templateCount = 0; int parenCount = 0; std::string currentArg; std::vector args; char quote = 0; bool escaped = false; typedef std::string::const_iterator it_t; for (it_t it = argText.begin(); it != argText.end(); ++it) { // Store current character char ch = *it; // Ignore quoted strings and character values in single quotes if ( ! quote && (ch == '"' || ch == '\'')) quote = ch; else if (quote && ch == quote && ! escaped) quote = 0; // Escaped character inside quotes if (escaped) escaped = false; else if (quote && ch == '\\') escaped = true; // Detect end of argument declaration if ( ! quote && (ch == ',') && (templateCount == 0) && (parenCount == 0)) { args.push_back(currentArg); currentArg.clear(); continue; } // Append current character if not a space at start if ( ! currentArg.empty() || ch != ' ') currentArg.push_back(ch); // Count use of potentially enclosed brackets if ( ! quote) { switch(ch) { case '<': templateCount++; break; case '>': templateCount--; break; case '(': // #nocov start parenCount++; break; case ')': parenCount--; break; // #nocov end } } } if (!currentArg.empty()) args.push_back(currentArg); return args; } Type SourceFileAttributesParser::parseType(const std::string& text) { const std::string constQualifier("const"); const std::string referenceQualifier("&"); // trim whitespace std::string type = text; trimWhitespace(&type); // check for const and reference bool isConst = false; bool isReference = false; if (type.find(constQualifier) == 0) { isConst = true; type.erase(0, constQualifier.length()); } // if the type is now empty (because it was detected as only const) // then this is an invalid state so we bail if (type.empty()) return Type(); // #nocov if (type.find(referenceQualifier) == (type.length() - referenceQualifier.length())) { isReference = true; type.erase(type.length() - referenceQualifier.length()); } trimWhitespace(&type); // if the type is now empty because of some strange parse then bail if (type.empty()) return Type(); // #nocov return Type(type, isConst, isReference); } // Validation helpers bool SourceFileAttributesParser::isKnownAttribute(const std::string& name) const { return name == kExportAttribute || name == kInitAttribute || name == kDependsAttribute || name == kPluginsAttribute || name == kInterfacesAttribute; } // Print an attribute parsing related warning void SourceFileAttributesParser::attributeWarning( // #nocov start const std::string& message, const std::string& attribute, size_t lineNumber) { // get basename of source file for warning message Rcpp::Function basename = Rcpp::Environment::base_env()["basename"]; std::string file = Rcpp::as(basename(sourceFile_)); std::ostringstream ostr; ostr << message; if (!attribute.empty()) ostr << " for " << attribute << " attribute"; ostr << " at " << file << ":" << lineNumber; showWarning(ostr.str()); } void SourceFileAttributesParser::attributeWarning( const std::string& message, size_t lineNumber) { attributeWarning(message, "", lineNumber); } void SourceFileAttributesParser::rcppExportWarning( const std::string& message, size_t lineNumber) { attributeWarning(message, "Rcpp::export", lineNumber); } void SourceFileAttributesParser::rcppExportNoFunctionFoundWarning( size_t lineNumber) { rcppExportWarning("No function found", lineNumber); } void SourceFileAttributesParser::rcppExportInvalidParameterWarning( const std::string& param, size_t lineNumber) { rcppExportWarning("Invalid parameter: " "'" + param + "'", lineNumber); } void SourceFileAttributesParser::rcppInterfacesWarning( const std::string& message, size_t lineNumber) { attributeWarning(message + " (valid interfaces are 'r' and 'cpp')", "Rcpp::interfaces", lineNumber); } // #nocov end // Track /* */ comment state void CommentState::submitLine(const std::string& line) { std::size_t pos = 0; while (pos != std::string::npos) { // check for a // which would invalidate any other token found std::size_t lineCommentPos = line.find("//", pos); // look for the next token std::string token = inComment() ? "*/" : "/*"; pos = line.find(token, pos); // process the comment token if found if (pos != std::string::npos) { // break if the line comment precedes the comment token if (lineCommentPos != std::string::npos && lineCommentPos < pos) break; // #nocov inComment_ = !inComment_; pos += token.size(); } } } } // namespace attributes } // namespace Rcpp /******************************************************************* * AttributesGen.cpp *******************************************************************/ namespace Rcpp { namespace attributes { // constants namespace { const char * const kRcppExportsSuffix = "_RcppExports.h"; const char * const kTrySuffix = "_try"; } ExportsGenerator::ExportsGenerator(const std::string& targetFile, const std::string& package, const std::string& commentPrefix) : targetFile_(targetFile), package_(package), packageCpp_(package), commentPrefix_(commentPrefix), hasCppInterface_(false) { // read the existing target file if it exists if (FileInfo(targetFile_).exists()) { std::ifstream ifs(targetFile_.c_str()); // #nocov start if (ifs.fail()) throw Rcpp::file_io_error(targetFile_); std::stringstream buffer; buffer << ifs.rdbuf(); existingCode_ = buffer.str(); // #nocov end } std::replace(packageCpp_.begin(), packageCpp_.end(), '.', '_'); // see if this is safe to overwite and throw if it isn't if (!isSafeToOverwrite()) throw Rcpp::file_exists(targetFile_); // #nocov } void ExportsGenerator::writeFunctions( const SourceFileAttributes& attributes, bool verbose) { if (attributes.hasInterface(kInterfaceCpp)) hasCppInterface_ = true; // #nocov doWriteFunctions(attributes, verbose); } // Commit the stream -- is a no-op if the existing code is identical // to the generated code. Returns true if data was written and false // if it wasn't (throws exception on io error) bool ExportsGenerator::commit(const std::string& preamble) { // get the generated code std::string code = codeStream_.str(); // if there is no generated code AND the exports file does not // currently exist then do nothing if (code.empty() && !FileInfo(targetFile_).exists()) return false; // #nocov // write header/preamble std::ostringstream headerStream; headerStream << commentPrefix_ << " Generated by using " << "Rcpp::compileAttributes()" << " -> do not edit by hand" << std::endl; headerStream << commentPrefix_ << " Generator token: " << generatorToken() << std::endl << std::endl; if (!preamble.empty()) headerStream << preamble; // get generated code and only write it if there was a change std::string generatedCode = headerStream.str() + code; if (generatedCode != existingCode_) { // open the file std::ofstream ofs(targetFile_.c_str(), std::ofstream::out | std::ofstream::trunc); if (ofs.fail()) throw Rcpp::file_io_error(targetFile_); // #nocov // write generated code and return ofs << generatedCode; ofs.close(); return true; } else { return false; // #nocov } } // Remove the generated file entirely bool ExportsGenerator::remove() { return removeFile(targetFile_); } // Convert a possible dot in package name to underscore as needed for header file std::string ExportsGenerator::dotNameHelper(const std::string & name) const { std::string newname(name); std::replace(newname.begin(), newname.end(), '.', '_'); return newname; } CppExportsGenerator::CppExportsGenerator(const std::string& packageDir, const std::string& package, const std::string& fileSep) : ExportsGenerator( packageDir + fileSep + "src" + fileSep + "RcppExports.cpp", package, "//") { } void CppExportsGenerator::doWriteFunctions( const SourceFileAttributes& attributes, bool verbose) { // generate functions generateCpp(ostr(), attributes, true, attributes.hasInterface(kInterfaceCpp), packageCppPrefix()); // track cppExports, signatures, and native routines (we use these // at the end to generate the ValidateSignature and RegisterCCallable // functions, and to generate a package init function with native // routine registration) for (SourceFileAttributes::const_iterator // #nocov start it = attributes.begin(); it != attributes.end(); ++it) { if (it->isExportedFunction()) { // add it to the cpp exports list if we are generating // a C++ interface and it's not hidden if (attributes.hasInterface(kInterfaceCpp)) { Function fun = it->function().renamedTo(it->exportedCppName()); if (!fun.isHidden()) cppExports_.push_back(*it); } // add it to the native routines list nativeRoutines_.push_back(*it); } else if (it->name() == kInitAttribute) { initFunctions_.push_back(*it); } } // #nocov end // record modules const std::vector& modules = attributes.modules(); modules_.insert(modules_.end(), modules.begin(), modules.end()); // verbose if requested if (verbose) { // #nocov start Rcpp::Rcout << "Exports from " << attributes.sourceFile() << ":" << std::endl; for (std::vector::const_iterator it = attributes.begin(); it != attributes.end(); ++it) { if (it->isExportedFunction()) Rcpp::Rcout << " " << it->function() << std::endl; } Rcpp::Rcout << std::endl; // #nocov end } } void CppExportsGenerator::writeEnd(bool hasPackageInit) { // generate a function that can be used to validate exported // functions and their signatures prior to looking up with // GetCppCallable (otherwise inconsistent signatures between // client and library would cause a crash) if (hasCppInterface()) { ostr() << std::endl; // #nocov start ostr() << "// validate" << " (ensure exported C++ functions exist before " << "calling them)" << std::endl; ostr() << "static int " << exportValidationFunctionRegisteredName() << "(const char* sig) { " << std::endl; ostr() << " static std::set signatures;" << std::endl; ostr() << " if (signatures.empty()) {" << std::endl; for (std::size_t i=0;i routineNames; std::vector routineArgs; for (std::size_t i=0;i declarations = extraRoutines["declarations"]; std::vector callEntries = extraRoutines["call_entries"]; // add declarations for modules for (std::size_t i=0;i 0) { ostr() << std::endl; for (std::size_t i = 0; i 0) { for (std::size_t i = 0; i& includes) { // includes std::ostringstream ostr; if (!includes.empty()) { for (std::size_t i=0;i" << std::endl; // #nocov ostr << "#include " << std::endl; // #nocov } ostr << std::endl; // always bring in Rcpp ostr << "using namespace Rcpp;" << std::endl << std::endl; // initialize references to global Rostreams initializeGlobals(ostr); // commit with preamble return ExportsGenerator::commit(ostr.str()); } CppExportsIncludeGenerator::CppExportsIncludeGenerator( const std::string& packageDir, const std::string& package, const std::string& fileSep) : ExportsGenerator( packageDir + fileSep + "inst" + fileSep + "include" + fileSep + dotNameHelper(package) + kRcppExportsSuffix, package, "//") { includeDir_ = packageDir + fileSep + "inst" + fileSep + "include"; } void CppExportsIncludeGenerator::writeBegin() { ostr() << "namespace " << packageCpp() << " {" << std::endl << std::endl; // Import Rcpp into this namespace. This allows declarations to // be written without fully qualifying all Rcpp types. The only // negative side-effect is that when this package's namespace // is imported it will also pull in Rcpp. However since this is // opt-in and represents a general desire to do namespace aliasing // this seems okay ostr() << " using namespace Rcpp;" << std::endl << std::endl; // Write our export validation helper function. Putting it in // an anonymous namespace will hide it from callers and give // it per-translation unit linkage ostr() << " namespace {" << std::endl; ostr() << " void validateSignature(const char* sig) {" << std::endl; ostr() << " Rcpp::Function require = " << "Rcpp::Environment::base_env()[\"require\"];" << std::endl; ostr() << " require(\"" << package() << "\", " << "Rcpp::Named(\"quietly\") = true);" << std::endl; std::string validate = "validate"; std::string fnType = "Ptr_" + validate; ostr() << " typedef int(*" << fnType << ")(const char*);" << std::endl; std::string ptrName = "p_" + validate; ostr() << " static " << fnType << " " << ptrName << " = " << "(" << fnType << ")" << std::endl << " " << getCCallable(exportValidationFunctionRegisteredName()) << ";" << std::endl; ostr() << " if (!" << ptrName << "(sig)) {" << std::endl; ostr() << " throw Rcpp::function_not_exported(" << std::endl << " " << "\"C++ function with signature '\" + std::string(sig) + \"' not found in " << package() << "\");" << std::endl; ostr() << " }" << std::endl; ostr() << " }" << std::endl; ostr() << " }" << std::endl << std::endl; } void CppExportsIncludeGenerator::doWriteFunctions( const SourceFileAttributes& attributes, bool) { // don't write anything if there is no C++ interface if (!attributes.hasInterface(kInterfaceCpp)) return; for(std::vector::const_iterator // #nocov start it = attributes.begin(); it != attributes.end(); ++it) { if (it->isExportedFunction()) { Function function = it->function().renamedTo(it->exportedCppName()); // if it's hidden then don't generate a C++ interface if (function.isHidden()) continue; ostr() << " inline " << function << " {" << std::endl; std::string fnType = "Ptr_" + function.name(); ostr() << " typedef SEXP(*" << fnType << ")("; for (size_t i=0; irng()) ostr() << " RNGScope RCPP_rngScope_gen;" << std::endl; ostr() << " rcpp_result_gen = " << ptrName << "("; const std::vector& args = function.arguments(); for (std::size_t i = 0; i(Rcpp::wrap(" << args[i].name() << "))"; if (i != (args.size()-1)) ostr() << ", "; } ostr() << ");" << std::endl; ostr() << " }" << std::endl; ostr() << " if (rcpp_result_gen.inherits(\"interrupted-error\"))" << std::endl << " throw Rcpp::internal::InterruptedException();" << std::endl; ostr() << " if (Rcpp::internal::isLongjumpSentinel(rcpp_result_gen))" << std::endl << " throw Rcpp::LongjumpException(rcpp_result_gen);" << std::endl; ostr() << " if (rcpp_result_gen.inherits(\"try-error\"))" << std::endl << " throw Rcpp::exception(Rcpp::as(" << "rcpp_result_gen).c_str());" << std::endl; if (!function.type().isVoid()) { ostr() << " return Rcpp::as<" << function.type() << " >" << "(rcpp_result_gen);" << std::endl; } ostr() << " }" << std::endl << std::endl; // #nocov end } } } void CppExportsIncludeGenerator::writeEnd(bool) { ostr() << "}" << std::endl; ostr() << std::endl; ostr() << "#endif // " << getHeaderGuard() << std::endl; } bool CppExportsIncludeGenerator::commit( const std::vector& includes) { if (hasCppInterface()) { // create the include dir if necessary createDirectory(includeDir_); // #nocov start // generate preamble std::ostringstream ostr; // header guard std::string guard = getHeaderGuard(); ostr << "#ifndef " << guard << std::endl; ostr << "#define " << guard << std::endl << std::endl; // includes if (!includes.empty()) { for (std::size_t i=0;i&) { if (hasCppInterface()) { // create the include dir if necessary createDirectory(includeDir_); // #nocov // commit return ExportsGenerator::commit(); // #nocov } else { return ExportsGenerator::remove(); } } std::string CppPackageIncludeGenerator::getHeaderGuard() const { // #nocov return "RCPP_" + packageCpp() + "_H_GEN_"; // #nocov } RExportsGenerator::RExportsGenerator(const std::string& packageDir, const std::string& package, bool registration, const std::string& fileSep) : ExportsGenerator( packageDir + fileSep + "R" + fileSep + "RcppExports.R", package, "#"), registration_(registration) { } void RExportsGenerator::doWriteFunctions( const SourceFileAttributes& attributes, bool) { // write standalone roxygen chunks const std::vector >& roxygenChunks = attributes.roxygenChunks(); for (std::size_t i = 0; i& chunk = roxygenChunks[i]; // #nocov start for (std::size_t l = 0; l < chunk.size(); l++) ostr() << chunk[l] << std::endl; ostr() << "NULL" << std::endl << std::endl; // #nocov end } // write exported functions if (attributes.hasInterface(kInterfaceR)) { // process each attribute for(std::vector::const_iterator it = attributes.begin(); it != attributes.end(); ++it) { // alias the attribute and function (bail if not export) const Attribute& attribute = *it; if (!attribute.isExportedFunction()) continue; // #nocov const Function& function = attribute.function(); // print roxygen lines for (size_t i=0; i& arguments = function.arguments(); for (size_t i = 0; i&) { return ExportsGenerator::commit(); } ExportsGenerators::~ExportsGenerators() { try { for(Itr it = generators_.begin(); it != generators_.end(); ++it) delete *it; generators_.clear(); } catch(...) {} } void ExportsGenerators::add(ExportsGenerator* pGenerator) { generators_.push_back(pGenerator); } void ExportsGenerators::writeBegin() { for(Itr it = generators_.begin(); it != generators_.end(); ++it) (*it)->writeBegin(); } void ExportsGenerators::writeFunctions( const SourceFileAttributes& attributes, bool verbose) { for(Itr it = generators_.begin(); it != generators_.end(); ++it) (*it)->writeFunctions(attributes, verbose); } void ExportsGenerators::writeEnd(bool hasPackageInit) { for(Itr it = generators_.begin(); it != generators_.end(); ++it) (*it)->writeEnd(hasPackageInit); } // Commit and return a list of the files that were updated std::vector ExportsGenerators::commit( const std::vector& includes) { std::vector updated; for(Itr it = generators_.begin(); it != generators_.end(); ++it) { if ((*it)->commit(includes)) updated.push_back((*it)->targetFile()); } return updated; } // Remove and return a list of files that were removed std::vector ExportsGenerators::remove() { // #nocov start std::vector removed; for(Itr it = generators_.begin(); it != generators_.end(); ++it) { if ((*it)->remove()) removed.push_back((*it)->targetFile()); } return removed; } // Helpers for converting C++ default arguments to R default arguments namespace { // convert a C++ numeric argument to an R argument value // (returns empty string if no conversion is possible) std::string cppNumericArgToRArg(const std::string& type, const std::string& cppArg) { // check for a number double num; std::stringstream argStream(cppArg); if ((argStream >> num)) { // L suffix means return the value literally if (!argStream.eof()) { std::string suffix; argStream >> suffix; if (argStream.eof() && suffix == "L") return cppArg; } // no decimal and the type isn't explicitly double or // float means integer if (cppArg.find('.') == std::string::npos && type != "double" && type != "float") return cppArg + "L"; // otherwise return arg literally else return cppArg; } else { return std::string(); } } // convert a C++ ::create style argument value to an R argument // value (returns empty string if no conversion is possible) std::string cppCreateArgToRArg(const std::string& cppArg) { std::string create = "::create"; size_t createLoc = cppArg.find(create); if (createLoc == std::string::npos || ((createLoc + create.length()) >= cppArg.size())) { return std::string(); } std::string type = cppArg.substr(0, createLoc); std::string rcppScope = "Rcpp::"; size_t rcppLoc = type.find(rcppScope); if (rcppLoc == 0 && type.size() > rcppScope.length()) type = type.substr(rcppScope.length()); std::string args = cppArg.substr(createLoc + create.length()); if (type == "CharacterVector") return "as.character( c" + args + ")"; if (type == "IntegerVector") return "as.integer( c" + args + ")"; if (type == "NumericVector") return "as.numeric( c" + args + ")"; if (type == "LogicalVector") return "as.logical( c" + args + ")"; return std::string(); } // convert a C++ Matrix to an R argument (returns empty string // if no conversion possible) std::string cppMatrixArgToRArg(const std::string& cppArg) { // look for Matrix std::string matrix = "Matrix"; size_t matrixLoc = cppArg.find(matrix); if (matrixLoc == std::string::npos || ((matrixLoc + matrix.length()) >= cppArg.size())) { return std::string(); } std::string args = cppArg.substr(matrixLoc + matrix.length()); return "matrix" + args; // #nocov end } // convert a C++ literal to an R argument (returns empty string // if no conversion possible) std::string cppLiteralArgToRArg(const std::string& cppArg) { if (cppArg == "true") return "TRUE"; else if (cppArg == "false") return "FALSE"; else if (cppArg == "R_NilValue") return "NULL"; else if (cppArg == "NA_STRING") // #nocov start return "NA_character_"; else if (cppArg == "NA_INTEGER") return "NA_integer_"; else if (cppArg == "NA_LOGICAL") return "NA_integer_"; else if (cppArg == "NA_REAL") return "NA_real_"; else return std::string(); } // convert an Rcpp container constructor to an R argument // (returns empty string if no conversion possible) std::string cppConstructorArgToRArg(const std::string& cppArg) { // map Rcpp containers to R default initializers static std::map RcppContainerToR; RcppContainerToR.insert(std::make_pair("NumericVector", "numeric")); RcppContainerToR.insert(std::make_pair("DoubleVector", "numeric")); RcppContainerToR.insert(std::make_pair("CharacterVector", "character")); RcppContainerToR.insert(std::make_pair("IntegerVector", "integer")); RcppContainerToR.insert(std::make_pair("LogicalVector", "logical")); RcppContainerToR.insert(std::make_pair("ComplexVector", "complex")); // for each entry in the map above, see if we find it; if we do, // return the R version typedef std::map::const_iterator Iterator; for (Iterator it = RcppContainerToR.begin(); it != RcppContainerToR.end(); ++it) { size_t loc = cppArg.find(it->first); if (loc != std::string::npos) { return it->second + cppArg.substr(it->first.size(), std::string::npos); } } return std::string(); // #nocov end } // convert a C++ argument value to an R argument value (returns empty // string if no conversion is possible) std::string cppArgToRArg(const std::string& type, const std::string& cppArg) { // try for quoted string if (isQuoted(cppArg)) return cppArg; // try for literal std::string rArg = cppLiteralArgToRArg(cppArg); if (!rArg.empty()) return rArg; // try for a create arg rArg = cppCreateArgToRArg(cppArg); // #nocov start if (!rArg.empty()) return rArg; // try for a matrix arg rArg = cppMatrixArgToRArg(cppArg); if (!rArg.empty()) return rArg; // try for a numeric arg rArg = cppNumericArgToRArg(type, cppArg); if (!rArg.empty()) return rArg; // try for a constructor arg rArg = cppConstructorArgToRArg(cppArg); if (!rArg.empty()) return rArg; // couldn't parse the arg return std::string(); // #nocov end } } // anonymous namespace // Generate an R argument list for a function std::string generateRArgList(const Function& function) { std::ostringstream argsOstr; const std::vector& arguments = function.arguments(); for (size_t i = 0; i required_args; const std::vector& arguments = function.arguments(); for (size_t i = 0; i parsed_args = Rcpp::as >(pargs_cv); for(size_t i=0; i& Rcpp::Rcout = Rcpp::Rcpp_cout_get();"; ostr << std::endl; ostr << "Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();"; ostr << std::endl; ostr << "#endif" << std::endl << std::endl; } // Generate the C++ code required to make [[Rcpp::export]] functions // available as C symbols with SEXP parameters and return void generateCpp(std::ostream& ostr, const SourceFileAttributes& attributes, bool includePrototype, bool cppInterface, const std::string& contextId) { // process each attribute for(std::vector::const_iterator it = attributes.begin(); it != attributes.end(); ++it) { // alias the attribute and function (bail if not export) const Attribute& attribute = *it; if (!attribute.isExportedFunction()) continue; const Function& function = attribute.function(); // include prototype if requested if (includePrototype) { ostr << "// " << function.name() << std::endl; printFunction(ostr, function, false); ostr << ";"; } // write the C++ callable SEXP-based function (this version // returns errors via "try-error") ostr << std::endl; ostr << (cppInterface ? "static" : "RcppExport"); ostr << " SEXP "; std::string funcName = contextId + "_" + function.name(); ostr << funcName; if (cppInterface) ostr << kTrySuffix; // #nocov ostr << "("; std::ostringstream ostrArgs; const std::vector& arguments = function.arguments(); for (size_t i = 0; i::type " << argument.name() << "(" << argument.name() << "SEXP);" << std::endl; } ostr << " "; if (!function.type().isVoid()) ostr << "rcpp_result_gen = Rcpp::wrap("; ostr << function.name() << "("; for (size_t i = 0; i(buffer.st_mtime); } } // Remove a file (call back into R for this) bool removeFile(const std::string& path) { if (FileInfo(path).exists()) { Rcpp::Function rm = Rcpp::Environment::base_env()["file.remove"]; // #nocov start rm(path); return true; // #nocov end } else { return false; } } // Recursively create a directory (call back into R for this) void createDirectory(const std::string& path) { // #nocov start if (!FileInfo(path).exists()) { Rcpp::Function mkdir = Rcpp::Environment::base_env()["dir.create"]; mkdir(path, Rcpp::Named("recursive") = true); } } // #nocov end // Known whitespace chars const char * const kWhitespaceChars = " \f\n\r\t\v"; // Query whether a character is whitespace bool isWhitespace(char ch) { return std::strchr(kWhitespaceChars, ch) != NULL; } // Remove trailing line comments -- ie, find comments that don't begin // a line, and remove them. We avoid stripping attributes. void stripTrailingLineComments(std::string* pStr) { if (pStr->empty()) return; size_t len = pStr->length(); bool inString = false; size_t idx = 0; // if this is an roxygen comment, then bail if (isRoxygenCpp(*pStr)) return; // skip over initial whitespace idx = pStr->find_first_not_of(kWhitespaceChars); if (idx == std::string::npos) return; // skip over a first comment if (idx + 1 < len && pStr->at(idx) == '/' && pStr->at(idx + 1) == '/') { idx = idx + 2; } // since we are searching for "//", we iterate up to 2nd last character while (idx < len - 1) { if (inString) { if (pStr->at(idx) == '"' && pStr->at(idx - 1) != '\\') { inString = false; } } else { if (pStr->at(idx) == '"') { inString = true; } } if (!inString && pStr->at(idx) == '/' && pStr->at(idx + 1) == '/') { pStr->erase(idx); return; } ++idx; } } // Trim a string void trimWhitespace(std::string* pStr) { // skip empty case if (pStr->empty()) return; // #nocov // trim right std::string::size_type pos = pStr->find_last_not_of(kWhitespaceChars); if (pos != std::string::npos) pStr->erase(pos + 1); // trim left pos = pStr->find_first_not_of(kWhitespaceChars); pStr->erase(0, pos); } // Strip balanced quotes from around a string (assumes already trimmed) void stripQuotes(std::string* pStr) { if (pStr->length() < 2) return; char quote = *(pStr->begin()); if ( (quote == '\'' || quote == '\"') && (*(pStr->rbegin()) == quote) ) *pStr = pStr->substr(1, pStr->length()-2); // #nocov } // is the passed string quoted? bool isQuoted(const std::string& str) { if (str.length() < 2) return false; // #nocov char quote = *(str.begin()); return (quote == '\'' || quote == '\"') && (*(str.rbegin()) == quote); } // does a string end with another string? bool endsWith(const std::string& str, const std::string& suffix) { return str.size() >= suffix.size() && str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; } // show a warning message void showWarning(const std::string& msg) { // #nocov start Rcpp::Function warning = Rcpp::Environment::base_env()["warning"]; warning(msg, Rcpp::Named("call.") = false); } // #nocov end bool isRoxygenCpp(const std::string& str) { size_t len = str.length(); if (len < 3) return false; size_t idx = str.find_first_not_of(kWhitespaceChars); if (idx == std::string::npos) return false; // make sure there are characters to check if (len - 2 < idx) return false; if (str[idx] == '/' && str[idx + 1] == '/' && str[idx + 2] == '\'') { return true; } return false; } } // namespace attributes } // namespace Rcpp /******************************************************************* * Attributes.cpp *******************************************************************/ using namespace Rcpp::attributes; // Implementation helpers for sourceCppContext namespace { // Class that manages generation of source code for the sourceCpp dynlib class SourceCppDynlib { public: SourceCppDynlib() {} SourceCppDynlib(const std::string& cacheDir, const std::string& cppSourcePath, Rcpp::List platform) : cppSourcePath_(cppSourcePath) { // get cpp source file info FileInfo cppSourceFilenameInfo(cppSourcePath_); if (!cppSourceFilenameInfo.exists()) throw Rcpp::file_not_found(cppSourcePath_); // #nocov // record the base name of the source file Rcpp::Function basename = Rcpp::Environment::base_env()["basename"]; cppSourceFilename_ = Rcpp::as(basename(cppSourcePath_)); // get platform info fileSep_ = Rcpp::as(platform["file.sep"]); dynlibExt_ = Rcpp::as(platform["dynlib.ext"]); // generate temp directory Rcpp::Function tempfile = Rcpp::Environment::base_env()["tempfile"]; buildDirectory_ = Rcpp::as(tempfile("sourcecpp_", cacheDir)); std::replace(buildDirectory_.begin(), buildDirectory_.end(), '\\', '/'); Rcpp::Function dircreate = Rcpp::Environment::base_env()["dir.create"]; dircreate(buildDirectory_); // generate a random context id contextId_ = "sourceCpp_" + uniqueToken(cacheDir); // regenerate the source code regenerateSource(cacheDir); } // create from list explicit SourceCppDynlib(const Rcpp::List& dynlib) { using namespace Rcpp; cppSourcePath_ = as(dynlib["cppSourcePath"]); generatedCpp_ = as(dynlib["generatedCpp"]); cppSourceFilename_ = as(dynlib["cppSourceFilename"]); contextId_ = as(dynlib["contextId"]); buildDirectory_ = as(dynlib["buildDirectory"]); fileSep_ = as(dynlib["fileSep"]); dynlibFilename_ = as(dynlib["dynlibFilename"]); previousDynlibFilename_ = as(dynlib["previousDynlibFilename"]); dynlibExt_ = as(dynlib["dynlibExt"]); exportedFunctions_ = as >(dynlib["exportedFunctions"]); modules_ = as >(dynlib["modules"]); depends_ = as >(dynlib["depends"]); plugins_ = as >(dynlib["plugins"]); embeddedR_ = as >(dynlib["embeddedR"]); List sourceDependencies = as(dynlib["sourceDependencies"]); for (R_xlen_t i = 0; i(sourceDependencies.at(i)); // #nocov sourceDependencies_.push_back(FileInfo(fileInfo)); // #nocov } } // convert to list Rcpp::List toList() const { using namespace Rcpp; List dynlib; dynlib["cppSourcePath"] = cppSourcePath_; dynlib["generatedCpp"] = generatedCpp_; dynlib["cppSourceFilename"] = cppSourceFilename_; dynlib["contextId"] = contextId_; dynlib["buildDirectory"] = buildDirectory_; dynlib["fileSep"] = fileSep_; dynlib["dynlibFilename"] = dynlibFilename_; dynlib["previousDynlibFilename"] = previousDynlibFilename_; dynlib["dynlibExt"] = dynlibExt_; dynlib["exportedFunctions"] = exportedFunctions_; dynlib["modules"] = modules_; dynlib["depends"] = depends_; dynlib["plugins"] = plugins_; dynlib["embeddedR"] = embeddedR_; List sourceDependencies; for (std::size_t i = 0; i FileInfo(generatedCppSourcePath()).lastModified()) return true; // #nocov // no dynlib means we're dirty if (!FileInfo(dynlibPath()).exists()) return true; // #nocov // variation in source dependencies means we're dirty std::vector sourceDependencies = parseSourceDependencies( cppSourcePath_); if (sourceDependencies != sourceDependencies_) return true; // #nocov // not dirty return false; } void regenerateSource(const std::string& cacheDir) { // create new dynlib filename previousDynlibFilename_ = dynlibFilename_; dynlibFilename_ = "sourceCpp_" + uniqueToken(cacheDir) + dynlibExt_; // copy the source file to the build dir Rcpp::Function filecopy = Rcpp::Environment::base_env()["file.copy"]; filecopy(cppSourcePath_, generatedCppSourcePath(), true, Rcpp::_["copy.mode"] = false); // parse attributes SourceFileAttributesParser sourceAttributes(cppSourcePath_, "", true); // generate cpp for attributes and append them std::ostringstream ostr; // always include Rcpp.h in case the user didn't ostr << std::endl << std::endl; ostr << "#include " << std::endl; // initialize references to global Rostreams initializeGlobals(ostr); generateCpp(ostr, sourceAttributes, true, false, contextId_); generatedCpp_ = ostr.str(); std::ofstream cppOfs(generatedCppSourcePath().c_str(), std::ofstream::out | std::ofstream::app); if (cppOfs.fail()) throw Rcpp::file_io_error(generatedCppSourcePath()); // #nocov cppOfs << generatedCpp_; cppOfs.close(); // generate R for attributes and write it into the build directory std::ofstream rOfs(generatedRSourcePath().c_str(), std::ofstream::out | std::ofstream::trunc); if (rOfs.fail()) throw Rcpp::file_io_error(generatedRSourcePath()); // #nocov // DLLInfo - hide using . and ensure uniqueness using contextId std::string dllInfo = "`." + contextId_ + "_DLLInfo`"; rOfs << dllInfo << " <- dyn.load('" << dynlibPath() << "')" << std::endl << std::endl; // Generate R functions generateR(rOfs, sourceAttributes, dllInfo); // remove the DLLInfo rOfs << std::endl << "rm(" << dllInfo << ")" << std::endl; rOfs.close(); // discover exported functions and dependencies exportedFunctions_.clear(); depends_.clear(); plugins_.clear(); for (SourceFileAttributesParser::const_iterator it = sourceAttributes.begin(); it != sourceAttributes.end(); ++it) { if (it->name() == kExportAttribute && !it->function().empty()) exportedFunctions_.push_back(it->exportedName()); else if (it->name() == kDependsAttribute) { for (size_t i = 0; iparams().size(); ++i) // #nocov depends_.push_back(it->params()[i].name()); // #nocov } else if (it->name() == kPluginsAttribute) { for (size_t i = 0; iparams().size(); ++i) plugins_.push_back(it->params()[i].name()); } } // capture modules modules_ = sourceAttributes.modules(); // capture embededded R embeddedR_ = sourceAttributes.embeddedR(); // capture source dependencies sourceDependencies_ = sourceAttributes.sourceDependencies(); } const std::string& contextId() const { return contextId_; } const std::string& cppSourcePath() const { return cppSourcePath_; } const std::vector cppDependencySourcePaths() { std::vector dependencies; for (size_t i = 0; i& exportedFunctions() const { return exportedFunctions_; } const std::vector& modules() const { return modules_; } const std::vector& depends() const { return depends_; }; const std::vector& plugins() const { return plugins_; }; const std::vector& embeddedR() const { return embeddedR_; } private: std::string generatedCppSourcePath() const { return buildDirectory_ + fileSep_ + cppSourceFilename(); } std::string generatedRSourcePath() const { return buildDirectory_ + fileSep_ + rSourceFilename(); } void generateR(std::ostream& ostr, const SourceFileAttributes& attributes, const std::string& dllInfo) const { // process each attribute for(std::vector::const_iterator it = attributes.begin(); it != attributes.end(); ++it) { // alias the attribute and function (bail if not export) const Attribute& attribute = *it; if (!attribute.isExportedFunction()) continue; const Function& function = attribute.function(); // build the parameter list std::string args = generateRArgList(function); // check if has a custom signature if(attribute.hasParameter(kExportSignature)) { args = attribute.customRSignature(); if(!checkRSignature(function, args)) { std::string rsig_err_msg = "Missing args in " + args; throw Rcpp::exception(rsig_err_msg.c_str()); } } // export the function ostr << attribute.exportedName() << " <- Rcpp:::sourceCppFunction(" << "function(" << args << ") {}, " << (function.type().isVoid() ? "TRUE" : "FALSE") << ", " << dllInfo << ", " << "'" << contextId_ + "_" + function.name() << "')" << std::endl; } // modules std::vector modules = attributes.modules(); if (modules.size() > 0) { // modules require definition of C++Object to be loaded ostr << "library(Rcpp)" << std::endl; // load each module for (std::vector::const_iterator it = modules.begin(); it != modules.end(); ++it) { ostr << " populate( Rcpp::Module(\"" << *it << "\"," << dllInfo << "), environment() ) " << std::endl; } } } std::string uniqueToken(const std::string& cacheDir) { Rcpp::Environment rcppEnv = Rcpp::Environment::namespace_env("Rcpp"); Rcpp::Function uniqueTokenFunc = rcppEnv[".sourceCppDynlibUniqueToken"]; return Rcpp::as(uniqueTokenFunc(cacheDir)); } private: std::string cppSourcePath_; std::string generatedCpp_; std::string cppSourceFilename_; std::string contextId_; std::string buildDirectory_; std::string fileSep_; std::string dynlibFilename_; std::string previousDynlibFilename_; std::string dynlibExt_; std::vector exportedFunctions_; std::vector modules_; std::vector depends_; std::vector plugins_; std::vector embeddedR_; std::vector sourceDependencies_; }; // Dynlib cache that allows lookup by either file path or code contents void dynlibCacheInsert(const std::string& cacheDir, const std::string& file, const std::string& code, const SourceCppDynlib& dynlib) { Rcpp::Environment rcppEnv = Rcpp::Environment::namespace_env("Rcpp"); Rcpp::Function dynlibInsertFunc = rcppEnv[".sourceCppDynlibInsert"]; dynlibInsertFunc(cacheDir, file, code, dynlib.toList()); } void dynlibCacheInsertFile(const std::string& cacheDir, const std::string& file, const SourceCppDynlib& dynlib) { dynlibCacheInsert(cacheDir, file, "", dynlib); } void dynlibCacheInsertCode(const std::string& cacheDir, const std::string& code, const SourceCppDynlib& dynlib) { dynlibCacheInsert(cacheDir, "", code, dynlib); } SourceCppDynlib dynlibCacheLookup(const std::string& cacheDir, const std::string& file, const std::string& code) { Rcpp::Environment rcppEnv = Rcpp::Environment::namespace_env("Rcpp"); Rcpp::Function dynlibLookupFunc = rcppEnv[".sourceCppDynlibLookup"]; Rcpp::List dynlibList = dynlibLookupFunc(cacheDir, file, code); if (dynlibList.length() > 0) return SourceCppDynlib(dynlibList); else return SourceCppDynlib(); } SourceCppDynlib dynlibCacheLookupByFile(const std::string& cacheDir, const std::string& file) { return dynlibCacheLookup(cacheDir, file, ""); } SourceCppDynlib dynlibCacheLookupByCode(const std::string& cacheDir, const std::string& code) { return dynlibCacheLookup(cacheDir, "", code); } } // anonymous namespace // Create temporary build directory, generate code as necessary, and return // the context required for the sourceCpp function to complete it's work RcppExport SEXP sourceCppContext(SEXP sFile, SEXP sCode, SEXP sRebuild, SEXP sCacheDir, SEXP sPlatform) { BEGIN_RCPP // parameters std::string file = Rcpp::as(sFile); std::string code = sCode != R_NilValue ? Rcpp::as(sCode) : ""; bool rebuild = Rcpp::as(sRebuild); std::string cacheDir = Rcpp::as(sCacheDir); Rcpp::List platform = Rcpp::as(sPlatform); // get dynlib (using cache if possible) SourceCppDynlib dynlib = !code.empty() ? dynlibCacheLookupByCode(cacheDir, code) : dynlibCacheLookupByFile(cacheDir, file); // check dynlib build state bool buildRequired = false; // if there is no dynlib in the cache then create a new one if (dynlib.isEmpty()) { buildRequired = true; dynlib = SourceCppDynlib(cacheDir, file, platform); } // if the cached dynlib is dirty then regenerate the source else if (rebuild || dynlib.isSourceDirty()) { buildRequired = true; // #nocov dynlib.regenerateSource(cacheDir); // #nocov } // if the dynlib hasn't yet been built then note that else if (!dynlib.isBuilt()) { buildRequired = true; // #nocov } // save the dynlib to the cache if (!code.empty()) dynlibCacheInsertCode(cacheDir, code, dynlib); else dynlibCacheInsertFile(cacheDir, file, dynlib); // return context as a list using namespace Rcpp; return List::create( _["contextId"] = dynlib.contextId(), _["cppSourcePath"] = dynlib.cppSourcePath(), _["cppDependencySourcePaths"] = dynlib.cppDependencySourcePaths(), _["buildRequired"] = buildRequired, _["buildDirectory"] = dynlib.buildDirectory(), _["generatedCpp"] = dynlib.generatedCpp(), _["exportedFunctions"] = dynlib.exportedFunctions(), _["modules"] = dynlib.modules(), _["cppSourceFilename"] = dynlib.cppSourceFilename(), _["rSourceFilename"] = dynlib.rSourceFilename(), _["dynlibFilename"] = dynlib.dynlibFilename(), _["dynlibPath"] = dynlib.dynlibPath(), _["previousDynlibPath"] = dynlib.previousDynlibPath(), _["depends"] = dynlib.depends(), _["plugins"] = dynlib.plugins(), _["embeddedR"] = dynlib.embeddedR()); END_RCPP } // Compile the attributes within the specified package directory into // RcppExports.cpp and RcppExports.R RcppExport SEXP compileAttributes(SEXP sPackageDir, SEXP sPackageName, SEXP sDepends, SEXP sRegistration, SEXP sCppFiles, SEXP sCppFileBasenames, SEXP sIncludes, SEXP sVerbose, SEXP sPlatform) { BEGIN_RCPP // arguments std::string packageDir = Rcpp::as(sPackageDir); std::string packageName = Rcpp::as(sPackageName); Rcpp::CharacterVector vDepends = Rcpp::as(sDepends); std::set depends; for (Rcpp::CharacterVector::iterator it = vDepends.begin(); it != vDepends.end(); ++it) { depends.insert(std::string(*it)); } bool registration = Rcpp::as(sRegistration); std::vector cppFiles = Rcpp::as >(sCppFiles); std::vector cppFileBasenames = Rcpp::as >(sCppFileBasenames); std::vector includes = Rcpp::as >(sIncludes); bool verbose = Rcpp::as(sVerbose); Rcpp::List platform = Rcpp::as(sPlatform); std::string fileSep = Rcpp::as(platform["file.sep"]); // initialize generators ExportsGenerators generators; generators.add(new CppExportsGenerator(packageDir, packageName, fileSep)); generators.add(new RExportsGenerator(packageDir, packageName, registration, fileSep)); // catch file exists exception if the include file already exists // and we are unable to overwrite it try { generators.add(new CppExportsIncludeGenerator(packageDir, packageName, fileSep)); } catch(const Rcpp::file_exists& e) { std::string msg = "The header file '" + e.filePath() + "' already exists so " "cannot be overwritten by Rcpp::interfaces"; throw Rcpp::exception(msg.c_str(), __FILE__, __LINE__); } // catch file exists exception for package include (because if it // already exists we simply leave it alone) try { generators.add(new CppPackageIncludeGenerator(packageDir, packageName, fileSep)); } catch(const Rcpp::file_exists& e) {} // write begin generators.writeBegin(); // Parse attributes from each file and generate code as required. bool hasPackageInit = false; bool haveAttributes = false; std::set dependsAttribs; for (std::size_t i=0; iname() == kDependsAttribute) { for (size_t i = 0; iparams().size(); ++i) // #nocov dependsAttribs.insert(it->params()[i].name()); // #nocov } } } // write end generators.writeEnd(hasPackageInit); // commit or remove std::vector updated; if (haveAttributes) updated = generators.commit(includes); else updated = generators.remove(); // #nocov // print warning if there are depends attributes that don't have // corresponding entries in the DESCRIPTION file std::vector diff; std::set_difference(dependsAttribs.begin(), dependsAttribs.end(), depends.begin(), depends.end(), std::back_inserter(diff)); if (!diff.empty()) { std::string msg = // #nocov start "The following packages are referenced using Rcpp::depends " "attributes however are not listed in the Depends, Imports or " "LinkingTo fields of the package DESCRIPTION file: "; for (size_t i=0; i >(updated); END_RCPP } Rcpp/src/Makevars0000644000176200001440000000004314370331407013440 0ustar liggesusersPKG_CPPFLAGS = -I../inst/include/ Rcpp/src/internal.h0000644000176200001440000001321315122065020013723 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // internal.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2012 - 2015 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 . #ifndef Rcpp_internal_h #define Rcpp_internal_h #include #define CALLFUN_0(name) SEXP name() #define CALLFUN_1(name) SEXP name(SEXP) #define CALLFUN_2(name) SEXP name(SEXP,SEXP) #define CALLFUN_3(name) SEXP name(SEXP,SEXP,SEXP) #define CALLFUN_4(name) SEXP name(SEXP,SEXP,SEXP,SEXP) #define CALLFUN_5(name) SEXP name(SEXP,SEXP,SEXP,SEXP,SEXP) #define EXTFUN(name) SEXP name(SEXP) // this file contains declarations of functions that are not // exported via Rcpp.h but are needed to make Rcpp work internally #define MAX_ARGS 65 #define UNPACK_EXTERNAL_ARGS(__CARGS__,__P__) \ SEXP __CARGS__[MAX_ARGS]; \ int nargs = 0; \ for (; nargs. #define COMPILING_RCPP #define RCPP_USE_GLOBAL_ROSTREAM #include using namespace Rcpp; #include "internal.h" #ifdef RCPP_HAS_DEMANGLING #include #endif namespace Rcpp { // [[Rcpp::register]] Rostream& Rcpp_cout_get() { static Rostream Rcpp_cout; return Rcpp_cout; } // [[Rcpp::register]] Rostream& Rcpp_cerr_get() { static Rostream Rcpp_cerr; return Rcpp_cerr; } Rostream& Rcout = Rcpp_cout_get(); Rostream& Rcerr = Rcpp_cerr_get(); namespace internal { int rngSynchronizationSuspended = 0; // [[Rcpp::register]] unsigned long enterRNGScope() { if (rngSynchronizationSuspended == 0) GetRNGstate(); return 0; } // [[Rcpp::register]] unsigned long exitRNGScope() { if (rngSynchronizationSuspended == 0) PutRNGstate(); return 0; } // [[Rcpp::register]] unsigned long beginSuspendRNGSynchronization() { // #nocov start ++rngSynchronizationSuspended; return rngSynchronizationSuspended; } // [[Rcpp::register]] unsigned long endSuspendRNGSynchronization() { --rngSynchronizationSuspended; return rngSynchronizationSuspended; } // #nocov end // [[Rcpp::register]] char* get_string_buffer() { static char buffer[MAXELTSIZE]; return buffer; } } // [[Rcpp::register]] const char * type2name(SEXP x) { // #nocov start switch (TYPEOF(x)) { case NILSXP: return "NILSXP"; case SYMSXP: return "SYMSXP"; case RAWSXP: return "RAWSXP"; case LISTSXP: return "LISTSXP"; case CLOSXP: return "CLOSXP"; case ENVSXP: return "ENVSXP"; case PROMSXP: return "PROMSXP"; case LANGSXP: return "LANGSXP"; case SPECIALSXP: return "SPECIALSXP"; case BUILTINSXP: return "BUILTINSXP"; case CHARSXP: return "CHARSXP"; case LGLSXP: return "LGLSXP"; case INTSXP: return "INTSXP"; case REALSXP: return "REALSXP"; case CPLXSXP: return "CPLXSXP"; case STRSXP: return "STRSXP"; case DOTSXP: return "DOTSXP"; case ANYSXP: return "ANYSXP"; case VECSXP: return "VECSXP"; case EXPRSXP: return "EXPRSXP"; case BCODESXP: return "BCODESXP"; case EXTPTRSXP: return "EXTPTRSXP"; case WEAKREFSXP: return "WEAKREFSXP"; #if R_VERSION >= R_Version(4,4,0) // replaces S4SXP in R 4.4.0 case OBJSXP: return Rf_isS4(x) ? "S4SXP" : "OBJSXP"; // cf src/main/inspect.c #else case S4SXP: return "S4SXP"; #endif default: return ""; } } // #nocov end } // namespace Rcpp // [[Rcpp::register]] std::string demangle(const std::string& name) { #ifdef RCPP_HAS_DEMANGLING std::string real_class; int status =-1; char *dem = 0; dem = abi::__cxa_demangle(name.c_str(), 0, 0, &status); if (status == 0) { real_class = dem; free(dem); } else { real_class = name; } return real_class; #else return name; #endif } // NOTE: remains registered but this routine is now effectively unused by Rcpp; // we retain it for backwards compatibility with any existing packages which // (explicitly or implicitly) rely on its existence. See also: // https://github.com/RcppCore/Rcpp/issues/1066 // [[Rcpp::register]] const char* short_file_name(const char* file) { // #nocov start static std::string f; f = file; size_t index = f.find("/include/"); if (index != std::string::npos) { f = f.substr(index + 9); } return f.c_str(); } // [[Rcpp::internal]] SEXP as_character_externalptr(SEXP xp) { char buffer[20]; snprintf(buffer, 20, "%p", (void*)R_ExternalPtrAddr(xp)); return Rcpp::wrap((const char*)buffer); } // #nocov end // [[Rcpp::internal]] SEXP rcpp_capabilities() { Shield cap(Rf_allocVector(LGLSXP, 13)); Shield names(Rf_allocVector(STRSXP, 13)); LOGICAL(cap)[0] = TRUE; // HAS_VARIADIC_TEMPLATES LOGICAL(cap)[1] = TRUE; // HAS_CXX0X_INITIALIZER_LIST LOGICAL(cap)[2] = TRUE; /* exceptions are always supported */ LOGICAL(cap)[3] = TRUE; // HAS_TR1_UNORDERED_MAP LOGICAL(cap)[4] = TRUE; // HAS_TR1_UNORDERED_SET LOGICAL(cap)[5] = TRUE; // Modules (TODO respect header choice ?) #ifdef RCPP_HAS_DEMANGLING LOGICAL(cap)[6] = TRUE; #else LOGICAL(cap)[6] = FALSE; #endif LOGICAL(cap)[7] = FALSE; // Classic API LOGICAL(cap)[8] = TRUE; // RCPP_HAS_LONG_LONG_TYPES LOGICAL(cap)[9] = TRUE; // HAS_CXX0X_UNORDERED_MAP LOGICAL(cap)[10] = TRUE; // HAS_CXX0X_UNORDERED_SET LOGICAL(cap)[11] = TRUE; // RCPP_USING_CXX11 #ifdef RCPP_NEW_DATE_DATETIME_VECTORS LOGICAL(cap)[12] = TRUE; #else LOGICAL(cap)[12] = FALSE; #endif SET_STRING_ELT(names, 0, Rf_mkChar("variadic templates")); SET_STRING_ELT(names, 1, Rf_mkChar("initializer lists")); SET_STRING_ELT(names, 2, Rf_mkChar("exception handling")); SET_STRING_ELT(names, 3, Rf_mkChar("tr1 unordered maps")); SET_STRING_ELT(names, 4, Rf_mkChar("tr1 unordered sets")); SET_STRING_ELT(names, 5, Rf_mkChar("Rcpp modules")); SET_STRING_ELT(names, 6, Rf_mkChar("demangling")); SET_STRING_ELT(names, 7, Rf_mkChar("classic api")); SET_STRING_ELT(names, 8, Rf_mkChar("long long")); SET_STRING_ELT(names, 9, Rf_mkChar("C++0x unordered maps")); SET_STRING_ELT(names, 10, Rf_mkChar("C++0x unordered sets")); SET_STRING_ELT(names, 11, Rf_mkChar("Full C++11 support")); SET_STRING_ELT(names, 12, Rf_mkChar("new date(time) vectors")); Rf_setAttrib(cap, R_NamesSymbol, names); return cap; } // [[Rcpp::internal]] SEXP rcpp_can_use_cxx0x() { // #nocov start return Rf_ScalarLogical(TRUE); } // [[Rcpp::internal]] SEXP rcpp_can_use_cxx11() { return Rf_ScalarLogical(TRUE); } // [[Rcpp::register]] SEXP stack_trace(const char* file, int line) { return R_NilValue; } // #nocov end // // [ [ Rcpp::register ] ] // void print(SEXP s) { // Rf_PrintValue(s); // defined in Rinternals.h // } // }}} // [[Rcpp::internal]] SEXP getRcppVersionStrings() { Shield versionstring(Rf_allocVector(STRSXP,2)); SET_STRING_ELT(versionstring, 0, Rf_mkChar(RCPP_VERSION_STRING)); SET_STRING_ELT(versionstring, 1, Rf_mkChar(RCPP_DEV_VERSION_STRING)); return versionstring; } Rcpp/src/rcpp_init.cpp0000644000176200001440000001126115122257611014443 0ustar liggesusers // Rcpp_init.cpp : Rcpp R/C++ interface class library -- Initialize and register // // Copyright (C) 2010 - 2020 John Chambers, Dirk Eddelbuettel and Romain Francois // Copyright (C) 2021 John Chambers, 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 #include #include "internal.h" // borrowed from Matrix #define CALLDEF(name, n) {#name, (DL_FUNC) &name, n} #define EXTDEF(name) {#name, (DL_FUNC) &name, -1} static R_CallMethodDef callEntries[] = { CALLDEF(Class__name,1), CALLDEF(Class__has_default_constructor,1), CALLDEF(CppClass__complete,1), CALLDEF(CppClass__methods,1), CALLDEF(CppObject__finalize,2), CALLDEF(Module__classes_info,1), CALLDEF(Module__complete,1), CALLDEF(Module__get_class,2), CALLDEF(Module__has_class,2), CALLDEF(Module__has_function,2), CALLDEF(Module__functions_arity,1), CALLDEF(Module__functions_names,1), CALLDEF(Module__name,1), CALLDEF(Module__get_function, 2), CALLDEF(get_rcpp_cache,0), CALLDEF(rcpp_error_recorder,1), CALLDEF(as_character_externalptr,1), CALLDEF(CppField__get,3), CALLDEF(CppField__set,4), CALLDEF(rcpp_capabilities,0), CALLDEF(rcpp_can_use_cxx0x,0), CALLDEF(rcpp_can_use_cxx11,0), CALLDEF(getRcppVersionStrings,0), {NULL, NULL, 0} }; static R_ExternalMethodDef extEntries[] = { EXTDEF(CppMethod__invoke), EXTDEF(CppMethod__invoke_void), EXTDEF(CppMethod__invoke_notvoid), EXTDEF(InternalFunction_invoke), EXTDEF(Module__invoke), EXTDEF(class__newInstance), EXTDEF(class__dummyInstance), {NULL, NULL, 0} }; // this is called by R_init_Rcpp that is in Module.cpp void init_Rcpp_routines(DllInfo *info){ // Register routines, allocate resources. R_registerRoutines(info, NULL, // .C callEntries, // .Call NULL, // .Fortran extEntries // .External ); } void registerFunctions(){ using namespace Rcpp; using namespace Rcpp::internal; #define RCPP_REGISTER(__FUN__) R_RegisterCCallable( "Rcpp", #__FUN__ , (DL_FUNC)__FUN__ ); RCPP_REGISTER(rcpp_get_stack_trace) RCPP_REGISTER(rcpp_set_stack_trace) RCPP_REGISTER(type2name) RCPP_REGISTER(demangle) RCPP_REGISTER(enterRNGScope) RCPP_REGISTER(exitRNGScope) RCPP_REGISTER(beginSuspendRNGSynchronization); RCPP_REGISTER(endSuspendRNGSynchronization); RCPP_REGISTER(get_Rcpp_namespace) RCPP_REGISTER(get_cache) RCPP_REGISTER(stack_trace) RCPP_REGISTER(get_string_elt) RCPP_REGISTER(char_get_string_elt) RCPP_REGISTER(set_string_elt) RCPP_REGISTER(char_set_string_elt) RCPP_REGISTER(get_string_ptr) RCPP_REGISTER(get_vector_elt) RCPP_REGISTER(set_vector_elt) RCPP_REGISTER(get_vector_ptr) RCPP_REGISTER(char_nocheck) RCPP_REGISTER(dataptr) RCPP_REGISTER(getCurrentScope) RCPP_REGISTER(setCurrentScope) RCPP_REGISTER(get_string_buffer) RCPP_REGISTER(short_file_name) RCPP_REGISTER(mktime00) RCPP_REGISTER(gmtime_) RCPP_REGISTER(reset_current_error) RCPP_REGISTER(error_occured) RCPP_REGISTER(rcpp_get_current_error) // RCPP_REGISTER(print) RCPP_REGISTER(Rcpp_precious_init) RCPP_REGISTER(Rcpp_precious_teardown) RCPP_REGISTER(Rcpp_precious_preserve) RCPP_REGISTER(Rcpp_precious_remove) RCPP_REGISTER(Rcpp_cout_get) RCPP_REGISTER(Rcpp_cerr_get) #undef RCPP_REGISTER } extern "C" void R_unload_Rcpp(DllInfo *) { // #nocov start Rcpp::Rcpp_precious_teardown(); // release resource } // #nocov end extern "C" void R_init_Rcpp(DllInfo* dllinfo) { setCurrentScope(0); registerFunctions(); // call wrapper to register export symbols R_useDynamicSymbols(dllinfo, FALSE); // set up symbol symbol lookup (cf R 3.4.0) init_Rcpp_cache(); // init the cache Rcpp::Rcpp_precious_init(); init_Rcpp_routines(dllinfo); // init routines } Rcpp/ChangeLog0000644000176200001440000153233015127737414012752 0ustar liggesusers2026-01-08 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.1.1 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem 2026-01-07 Dirk Eddelbuettel * vignettes/pdf/*: Rebuilt * vignettes/rmd/Rcpp.bib: Update to several URLs * inst/bib/Rcpp.bib: Idem * vignettes/rmd/*: Idem * README.md: Idem 2026-01-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * vignettes/rmd/Rcpp.bib: Update package versions dates * inst/bib/Rcpp.bib: Idem 2026-01-04 Dirk Eddelbuettel * inst/include/RcppCommon.h: No longer require RCPP_USING_UNWIND_PROTECT * inst/include/Rcpp/r/headers.h: Idem * inst/include/Rcpp/api/meat/Rcpp_eval.h: Idem * inst/tinytest/cpp/stack.cpp: No longer test with RCPP_USING_UNWIND_PROTECT * inst/tinytest/test_interface.R: Idem 2026-01-01 Dirk Eddelbuettel * R/Attributes.R: Additional or adjusted #nocov tags * R/Rcpp.package.skeleton.R: Idem * R/RcppLdpath.R: Idem * R/asis.R: Idem * R/inline.R: Idem * inst/include/Rcpp/api/meat/Rcpp_eval.h: Idem * inst/include/Rcpp/internal/caster.h: Idem * inst/include/Rcpp/internal/export.h: Idem * inst/include/Rcpp/proxy/NamesProxy.h: Idem * inst/include/Rcpp/proxy/SlotProxy.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/include/Rcpp/vector/proxy.h: Idem * inst/include/Rcpp/vector/traits.h: Idem * inst/include/Rcpp/Environment.h: Idem * inst/include/Rcpp/Function.h: Idem * inst/include/Rcpp/Module.h: Idem * inst/include/Rcpp/S4.h: Idem * inst/include/Rcpp/as.h: Idem * inst/include/Rcpp/exceptions.h: Idem * inst/include/Rcpp/r_cast.h: Idem * src/attributes.cpp: Idem * src/barrier.cpp: Idem 2025-12-30 Dirk Eddelbuettel * tests/tinytest.R: Refine decision of when not to run all tests even when development version number is seen 2025-12-28 Dirk Eddelbuettel * README.md: Replace installation from drat section with r-universe 2025-12-22 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/DataFrame.h (nrow): Simplified per #1430 discussion relying on compact sequence representation removing use of ATTRIB * inst/include/Rcpp/proxy/AttributeProxy.h (hasAttribute): For R 4.6.0, rewritten using R_mapAttrib() avoiding to-be-removed ATTRIB() 2025-12-21 Dirk Eddelbuettel * .github/workflows/docker.yaml: Add workflow_dispatch, update checkout action 2025-12-19 Dirk Eddelbuettel * man/RcppUnitTests.Rd: Removed outdated help page 2025-12-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * DESCRIPTION (Depends): Add 'R (>= 3.5.0)' 2025-12-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * src/barrier.cpp (dataptr): Remove check for 'R (>= 3.5.0)' * inst/include/Rcpp/Rmath.h: Remove check for 'R (>= 3.1.2)' * inst/include/Rcpp/Symbol.h: Remove check for 'R (>= 3.2.0)' * inst/include/Rcpp/exceptions.h: Remove check for 'R (>= 3.5.0)' * inst/include/Rcpp/r/headers.h: Idem * R/Attributes.R: Remove multiple checks for R version < 3.5.0 * R/Rcpp.package.skeleton.R: Idem * inst/tinytest/testRcppInterfaceUser/tests/tests.R: Remove one check 2025-12-12 Dirk Eddelbuettel * inst/tinytest/test_system.R: Wrap suppressMessages() around three tests for long-obsolete linker and compiler flags * inst/include/Rcpp/Environment.h: Replace use of Rf_findVarInFrame with R_getVarEx (or R_getVar) if R 4.5.0 or later is used * inst/include/Rcpp/Function.h: Idem * src/barrier.cpp: Idem 2025-12-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/Rmath.h: Do not access Rf_rnbeta * inst/include/Rcpp/sugar/undoRmath.h: Remove #undef 2025-12-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Updated 2025-12-04 Iñaki Ucar * inst/include/Rcpp/r/headers.h: Include * inst/include/RcppCommon.h: Drop , not used anymore and dropped from the API; drop , included above * src/api.cpp: Drop , dropped from the API 2025-12-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-12-02 Dirk Eddelbuettel * R/loadRcppModules.R: Remove file with function deprecated years ago * man/loadRcppModules-deprecated.Rd: Idem * NAMESPACE: Remove reference to loadRcppModules() * man/loadModule.Rd: Idem * man/Rcpp-deprecated.Rd: Idem * vignettes/rmd/Rcpp-modules.Rmd: Idem 2025-12-01 Kevin Ushey * R/Attributes.R: Update OpenMP plugin for macOS 2025-11-29 Dirk Eddelbuettel * R/RcppLdpath.R: Revisit deprecation warnings via 'message()' to be turned into warning or deprecation in 12 or more months 'when suitable' 2025-11-24 Dirk Eddelbuettel * inst/include/Rcpp/r/check_r_headers.h: Add RCPP_NO_R_HEADERS_CHECK override to skip new check 2025-11-23 Dirk Eddelbuettel * inst/include/Rcpp/r/check_r_headers.h: New header to check if R.h or related R headers were installed first * inst/include/RcppCommon.h: Call new header as first thing 2025-11-12 Iñaki Ucar * inst/include/Rcpp/macros/mask.h: Lay the ground for Rf_error masking with a warning at compilation time unless RCPP_NO_MASK_RF_ERROR is defined * inst/include/RcppCommon.h: Include the previous file in the last place * src/attributes.cpp: Use parentheses to protect call to Rf_error * inst/tinytest/cpp/stack.cpp: Idem * inst/tinytest/testRcppInterfaceExporter/src/RcppExports.cpp: Idem 2025-11-04 Dirk Eddelbuettel * .github/workflows/macos.yaml (jobs): Roll macos-13 to macos-14 2025-11-01 Iñaki Ucar * inst/include/Rcpp/hash/IndexHash.h: Normalize values for all comparisons * inst/include/Rcpp/hash/SelfHash.h: Idem * inst/tinytest/test_sugar.R: Add test for signed zeroes 2025-10-21 Iñaki Ucar * inst/include/Rcpp/exceptions_impl.h: Use __has_include to simplify checks to enable demangling, making them robust for more platforms 2025-10-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/tinytest/test_sugar.R: Simplify and generalize the August fix as we no longer need to control for R-devel which has been corrected 2025-09-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/internal/wrap.h (make_charsexp__impl__cstring): Avoid a narrowing warning by casting explicitly 2025-08-26 Dirk Eddelbuettel * inst/tinytest/test_sugar.R: For r-devel, use apply(x, DIM, mean, na.rm=TRUE) instead of (row|col)Means for complex NA valued matrices 2025-08-24 Dirk Eddelbuettel * .github/workflows/ci.yaml (jobs): Re-enable coverage, roll checkout action to v5 * inst/tinytest/test_sugar.R: For now, park two tests of complex matrix row and col means under R-devel, this could be a R-devel issue 2025-07-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * R/compilerCheck.R: Remove unused function * man/compilerCheck.Rd: Remove its documentation 2025-07-19 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Use DOI for R citation * inst/bib/Rcpp.bib: Idem 2025-07-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * R/asis.R (asisWeave, asisTangle): Borrowed with thanks from R.rsp and shortened / simplified to provide 'asis' vignette processor * R/zzz.R (.onLoad): Register new vignette processor * vignettes/*.asis: New files with vignette info from .Rnw files * vignettes/pdf/*.pdf: Moved to directory vignettes/ * vignettes/*.Rnw: Removed * man/asisWeave.Rd: Documentation 2025-07-01 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.1.0 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2025-06-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-06-18 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Use doi references for CRAN packages, update versions, update some package titles * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Re-rendered 2025-06-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-06-02 Kevin Ushey * inst/include/Rcpp.h: Avoid copy when creating Language objects * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/lgrow.h: Idem * inst/tinytest/cpp/language.cpp: Idem * inst/tinytest/test_language.R: Idem 2025-05-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-05-23 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/newDateVector.h: Add default constructor * inst/include/Rcpp/date_datetime/newDatetimeVector.h: Idem * inst/tinytest/test_date.R: Add tests * inst/tinytest/cpp/dates.cpp: Idem 2025-05-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * R/Attributes.R: Support C++26 via plugin 2025-05-05 Dirk Eddelbuettel * inst/tinytest/test_sugar.R: Condition four NA-related tests away on arm64 on Linux too * .github/workflows/linuxarm.yaml (jobs): Add ubuntu-24.04-arm as optional workflow_dispatch run 2025-04-15 Dirk Eddelbuettel * docker/ci-4.4/Dockerfile: Added based on r-base:4.4.3 * .github/workflows/ci.yaml (jobs): Add rcpp/ci-4.4 to matrix 2025-03-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-03-29 Iñaki Ucar * inst/include/Rcpp/traits/result_of.h: Reimplement traits::result_of using std::result_of (up to C++14) or std::invoke_result (C++17 or later), which supports previous use cases and enables lambdas * inst/include/Rcpp/sugar/functions/sapply.h: Use new result_of interface * inst/include/Rcpp/sugar/functions/lapply.h: Idem * inst/include/Rcpp/sugar/functions/mapply/mapply_2.h: Idem * inst/include/Rcpp/sugar/functions/mapply/mapply_3.h: Idem * inst/include/Rcpp/sugar/matrix/outer.h: Idem * inst/tinytest/cpp/sugar.cpp: New tests for previous sugar functions * inst/tinytest/test_sugar.R: Idem 2025-03-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-03-26 Iñaki Ucar * inst/include/Rcpp/platform/compiler.h: Remove definitions of RCPP_USING_UNORDERED_MAP and RCPP_USING_UNORDERED_SET * inst/include/Rcpp/sugar/sets.h: Remove redefinition of macros * inst/include/Rcpp/sugar/functions/self_match.h: Replace macros with std::unordered_map and std::unordered_set respectively * inst/include/Rcpp/sugar/functions/setdiff.h: Idem * inst/include/Rcpp/sugar/functions/table.h: Idem * inst/tinytest/cpp/wrap.cpp: Idem 2025-03-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-03-24 Iñaki Ucar * inst/include/Rcpp/exceptions.h: Include C+11 variadic template definitions unconditionally * inst/include/Rcpp/exceptions/cpp11/exceptions.h: Removed * inst/include/Rcpp/exceptions/cpp98/exceptions.h: Idem * src/attributes.cpp: Remove obsolete pre-C+11 paths based on __cplusplus define checks * inst/tinytest/cpp/sugar.cpp: Idem * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/StringTransformer.h: Idem * inst/include/Rcpp/algorithm.h: Idem * inst/include/Rcpp/utils/tinyformat.h: Idem * inst/include/Rcpp/longlong.h: Idem, unconditional RCPP_HAS_LONG_LONG_TYPES * src/api.cpp: Remove explicit RCPP_HAS_LONG_LONG_TYPES as availability is both implicit and ensured * inst/include/Rcpp/algorithm.h: Idem * inst/include/Rcpp/traits/is_arithmetic.h: Idem * inst/include/Rcpp/traits/longlong.h: Idem 2025-03-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/String.h: Remove explicit RCPP_USING_CXX11 as use of C++11 (or newer) is both implicit and ensured * inst/include/Rcpp/macros/dispatch.h: Idem * inst/include/Rcpp/platform/compiler.h: Idem * inst/include/Rcpp/unwindProtect.h: Idem * inst/tinytest/cpp/wrap.cpp: Idem * src/api.cpp: Idem 2025-03-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/module/class.h: Use variadic templates unconditionally * inst/include/Rcpp/grow.h: Idem * inst/include/Rcpp/DottedPair.h: Idem * inst/include/Rcpp/Vector.h: Idem * inst/include/Rcpp/Function.h: Idem * inst/include/Rcpp/internal/call.h: Idem * inst/include/Rcpp/InternalFunctionWithStdFunction.h: Idem * inst/include/Rcpp/Module.h: Idem * inst/include/Rcpp/traits/index_sequence.h: Idem * inst/include/Rcpp/traits/named_object.h: Idem * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/DataFrame.h: Idem * inst/include/Rcpp/PairList.h: Idem * inst/include/Rcpp/InternalFunction.h: Idem * inst/include/Rcpp/module/Module_generated_class_constructor.h: Removed * inst/include/Rcpp/module/Module_generated_class_factory.h: Idem * inst/include/Rcpp/module/Module_generated_method.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_method.h: Idem * inst/include/Rcpp/generated/grow__pairlist.h: Idem * inst/include/Rcpp/generated/DottedPair__ctors.h: Idem * inst/include/Rcpp/generated/Vector__create.h: Idem * inst/include/Rcpp/generated/Function__operator.h: Idem * inst/include/Rcpp/generated/InternalFunctionWithStdFunction_call.h: Idem * inst/include/Rcpp/module/Module_generated_Constructor.h: Idem * inst/include/Rcpp/module/Module_generated_CppFunction.h: Idem * inst/include/Rcpp/module/Module_generated_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_Factory.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_class_signature.h: Idem * inst/include/Rcpp/module/Module_generated_ctor_signature.h: Idem * inst/include/Rcpp/module/Module_generated_function.h: Idem * inst/include/Rcpp/module/Module_generated_get_signature.h: Idem * inst/include/Rcpp/generated/Language__ctors.h: Idem * inst/include/Rcpp/generated/DataFrame_generated.h: Idem * inst/include/Rcpp/generated/Pairlist__ctors.h: Idem * inst/include/Rcpp/generated/InternalFunction__ctors.h: Idem * inst/include/Rcpp/platform/compiler.h: No longer define HAS_VARIADIC_TEMPLATES * src/api.cpp (rcpp_can_use_cxx0x): Return true unconditionally 2025-03-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/platform/compiler.h: Simplified and shortened establishing C++11 as baseline; further PRs to complete this * inst/include/Rcpp/String.h: Unconditionally use std::hash with C++11 * inst/include/Rcpp/wrap.h: Unconditionally use static_assert * inst/include/Rcpp/sugar/functions/sapply.h: Use std::result_of (with C++11 or C++14) or std::invoke_result (C++17 or later) * inst/include/Rcpp/sugar/functions/table.h: Use std::map * inst/include/Rcpp/sugar/sets.h: Use std::unordered_{set,map} * man/evalCpp.Rd: Update example * src/api.cpp: Simplify rcpp_capabilities assignment 2025-03-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/Environment.h: Switch from R_lsInternal to R_lsInternal3 as the former is now outlawed 2025-03-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-03-08 Dirk Eddelbuettel * inst/include/Rcpp/Function.h: Use R_ClosureEnv instead of deprecated CLOENV if under R >= 4.5.0 2025-03-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * src/barrier.cpp (dataptr): Replace remaining DATAPTR with DATAPTR_RO for suitable R greater than 3.5.0 2025-02-11 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Support optional argument 'github_user' to populate URL and BugReports if given * man/Rcpp.package.skeleton.Rd: Document new optional argument * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Default version is now '0.0.1' and not '1.0' * inst/tinytest/test_rcpp_package_skeleton.R: Adjust test accordingly * inst/tinytest/test_expose_class.R: Idem 2025-02-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-01-31 Lev Kandel * inst/include/Rcpp/internal/wrap.h: Add support for std::string_view * inst/include/Rcpp/traits/r_type_traits.h: Idem * inst/include/Rcpp/traits/wrap_type_traits.h: Idem * inst/include/RcppCommon.h: Include * inst/tinytest/cpp/wrap.cpp: Add unit test for wrap(std::string_view) * inst/tinytest/test_wrap.R: Idem 2025-01-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem 2025-01-25 Dirk Eddelbuettel * vignettes/rmd/Rcpp-libraries.Rdm: Add mention of PACKAGE_types.h * vignettes/rmd/Rcpp.bib: Add AsioHeaders * inst/bib/Rcpp.bib: Idem 2025-01-18 Ben Bolker * inst/NEWS.Rd: fix trivial typos in NEWS file 2025-01-11 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.14 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2025-01-01 Dirk Eddelbuettel * inst/include/Rcpp/Benchmark/Timer.h (R_NO_REMAP): Protect include with preceding #ifndef now that R 4.5.0 will set this too 2024-11-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version to 1.0.13.6 * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/tinytest/test_date.R: Minor adjustment to datetime format test following R Dev Day change for R bug 17350 (and issue #1347 here) 2024-11-25 Simon Guest * src/attributes.cpp: fix CPP source having to be writable 2024-11-03 Marco Colombo * vignettes/rmd/Rcpp-FAQ.Rmd: Fixed typos * vignettes/rmd/Rcpp-attributes.Rmd: Idem * vignettes/rmd/Rcpp-extending.Rmd: Idem * vignettes/rmd/Rcpp-introduction.Rmd: Idem * vignettes/rmd/Rcpp-libraries.Rmd: Idem * vignettes/rmd/Rcpp-modules.Rmd: Idem * vignettes/rmd/Rcpp-package.Rmd: Idem * vignettes/rmd/Rcpp-quickref.Rmd: Idem * vignettes/rmd/Rcpp-sugar.Rmd: Idem 2024-11-02 Dirk Eddelbuettel * tests/tinytest.R: Minor code edit, removal of two no longer required setters for tinytest 2024-11-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version to 1.0.13.5 * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-10-31 Kevin Ushey * inst/include/Rcpp/r/compat.h: Require R (>= 4.5.0) for new APIs 2024-10-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version to 1.0.13.4 * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * .github/workflows/ci.yaml (jobs): Roll checkout action to v4 2024-10-26 Gábor Csárdi * inst/include/Rcpp/exceptions_impl.h: check for DragonFlyBSD to fix compilation 2024-10-07 Iñaki Ucar * inst/include/Rcpp/platform/compiler.h: Uncomment HAS_VARIADIC_TEMPLATES macro definition * src/api.cpp: Simplify checks for variadic templates * inst/include/Rcpp/DataFrame.h: Idem * inst/include/Rcpp/DottedPair.h: Idem * inst/include/Rcpp/Function.h: Idem * inst/include/Rcpp/InternalFunctionWithStdFunction.h: Idem * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/Pairlist.h: Idem * inst/include/Rcpp/grow.h: Idem * inst/include/Rcpp/internal/call.h: Idem * inst/include/Rcpp/module/class.h: Idem * inst/include/Rcpp/traits/index_sequence.h: Idem * inst/include/Rcpp/traits/named_object.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/include/Rcpp/Module.h: Idem + add missing is_void method * inst/tinytest/test_module.R: Add test for void functions and methods 2024-10-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version to 1.0.13.3 * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-09-29 Dirk Eddelbuettel * inst/include/Rcpp/vector/Vector.h: Remove a cast as R_xlen_t is returned now 2024-09-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-09-12 Iñaki Ucar * vignettes/.gitignore: Refinement to ignore more files under rmd/ * vignettes/pdf/*: Rebuilt with Ghostscript 10.03.1 * vignettes/*.pdf: Idem 2024-08-31 Dirk Eddelbuettel * DESCRIPTION (Authors@R): Added 2024-08-28 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Create DESCRIPTION with Auhors@R file * inst/tinytest/test_rcpp_package_skeleton.R: Adjust tests 2024-08-20 Dirk Eddelbuettel * inst/tinytest/test_sugar.R: Skip one more NA related test on arm64 and macOS as failure is seen at r-universe on arm64 * .github/workflows/macos.yaml: Add basic r-ci setup but dialed-down to macOS only (as Linux is covered via multiple Docker setups) 2024-08-19 Dirk Eddelbuettel * Contributing.md: Refreshed content 2024-07-30 Dirk Eddelbuettel * vignettes/rmd/Rcpp-modules.Rmd (are): Add short two-sentence illustration following GitHub issue #1322 2024-07-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-07-11 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.13 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2024-07-07 Kevin Ushey * inst/include/Rcpp/internal/SEXP_Iterator.h: Avoid using VECTOR_PTR * inst/include/Rcpp/vector/Subsetter.h: Avoid using STRING_PTR * inst/include/RcppCommon.h: Include compatibility defines * src/barrier.cpp: Avoid using {STRING/VECTOR}_PTR * inst/include/Rcpp/r/compat.h: Include compatibility defines 2024-07-05 Kevin Ushey * inst/include/Rcpp/Environment.h: Drop support for UserDefinedDatabase [ merged 2024-07-22 after release of Rcpp 1.0.13 ] * inst/include/Rcpp/Language.h: Avoid using SET_TYPEOF * inst/include/Rcpp/Pairlist.h: Idem * inst/include/Rcpp/r_cast.h: Idem [ merged 2024-07-24 after release of Rcpp 1.0.13 ] 2024-06-22 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-06-11 Kevin Ushey * inst/include/Rcpp/internal/r_vector.h: Use template specializations to avoid DATAPTR usage * inst/include/Rcpp/vector/traits.h: Implement bounds checks in r_vector_cache access * inst/tinytest/cpp/Vector.cpp: Add unit tests * inst/tinytest/test_vector.R: Add unit tests * tests/tinytest.R: Test in serial by default 2024-06-02 Dirk Eddelbuettel * inst/include/Rcpp/internal/export.h: More R_xlen_t switching * inst/include/Rcpp/vector/SubMatrix.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem 2024-06-01 Dirk Eddelbuettel * inst/include/Rcpp/internal/Proxy_Iterator.h (Proxy_Iterator): Switch to R_xlen_t ('clang++-17 -Wconversion -Wno-sign-conversion') * inst/include/Rcpp/DataFrame.h: Idem * inst/include/Rcpp/Vector.h: Idem 2024-05-28 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-05-27 Dirk Eddelbuettel * README.md: Remove link references to StackOverflow * inst/NEWS.Rd: Idem * inst/include/Rcpp/Module.h (S4_CppOverloadedMethods): Add cast to int to avoid warnings under 'clang++-17 -Wconversion -Wno-sign-conversion' * inst/include/Rcpp/vector/Vector.h (Vector): Idem * inst/include/Rcpp/module/class.h: Switch variable to size_t to avoid to avoid warnings under 'clang++-17 -Wconversion -Wno-sign-conversion' * inst/tinytest/testRcppClass/src/init.c: Add void to signature 2024-05-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2024-05-23 Andrew Johnson * inst/include/Rcpp/: Added variadic templates to be used instead of the generated code in `Rcpp/generated` and `Rcpp/module` when compiling with C++11 or later. 2024-05-18 Dirk Eddelbuettel * docker/ci-4.3/Dockerfile: Add rcpp/ci-4.3 container for R 4.3.* * .github/workflows/ci.yaml (jobs): Add rcpp/ci-4.3 to matrix 2024-05-16 Dirk Eddelbuettel * README.md: Use tinyverse.netlify.app for dependency badge 2024-03-05 Dirk Eddelbuettel * docker/ci/Dockerfile: Switch the base container to r2u * docker/plus/Dockerfile: Given r2u, install more binaries * README.md: Add r-universe badge 2024-02-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/include/Rcpp/r/headers.h: Set R_NO_REMAP (and MAXELTSIZE) only if not already defined (as will be needed with R 4.4.0) 2024-01-09 Dirk Eddelbuettel * README.md: Update usage numbers * README.md: Remove StackOverflow badge which only works for logged-in users and is unsuitable for the README 2024-01-08 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.12 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2024-01-01 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Updated to current versions of cited packages * inst/bib/Rcpp.bib: Idem 2023-12-27 Dirk Eddelbuettel * src/api.cpp (type2name): Refine OBJSXP return 2023-12-21 Dirk Eddelbuettel * src/api.cpp (type2name): Recognise OBJSXP added in R 4.4.0 2023-11-28 Dirk Eddelbuettel * inst/tinytest/testRcppInterfaceExporter/R/RcppExports.R: Regenerated * inst/tinytest/testRcppInterfaceExporter/src/RcppExports.cpp: Idem 2023-11-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * src/attributes.cpp (generateCpp): Add a format string for Rf_error call to not run afoul of -Wformat-security 2023-11-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/include/Rcpp/iostream/Rstreambuf.h: Cast streamsize to int in two spots * inst/include/Rcpp/print.h (warningcall): Add missing '%s' format 2023-11-11 Dirk Eddelbuettel * vignettes/rmd/Rcpp-FAQ.Rmd: Updated and edited * vignettes/pdf/Rcpp-FAQ.pdf: Updated * vignettes/rmd/Rcpp.bib: Updated 2023-10-28 Dirk Eddelbuettel * vignettes/rmd/Rcpp-FAQ.Rmd: Updated and edited * vignettes/pdf/Rcpp-FAQ.pdf: Updated * vignettes/rmd/Rcpp.bib: Updated 2023-10-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * R/tools.R: Correct missing Rd macros (spotted by R-devel CMD check) 2023-10-22 Aaron Lun * inst/include/Rcpp/vector/MatrixColumn.h: Cast integer index to R_xlen_t to avoid integer overflow with large matrices. * inst/include/Rcpp/vector/MatrixRow.h: Ditto. * inst/include/Rcpp/vector/Vector.h: Remove stray cast to int that causes overflow when returning the end iterator. 2023-09-30 Dirk Eddelbuettel * vignettes/rmd/Rcpp-introduction.Rmd (Rcpp): Correct caption of third figure (cf GitHub issue #1276) * vignettes/pdf/Rcpp-introduction.pdf: Rebuilt 2023-08-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2023-08-29 Iñaki Ucar * R/Attributes.R: Ad-hoc fix for testthat's C entrypoint in RcppExports.cpp 2023-08-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2023-08-03 Michael Chirico * src/attributes.cpp: Directly `#include ` for `std::endl` * src/date.cpp: Directly `#include ` for `TRUE` and `FALSE` 2023-07-03 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.11 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2023-07-02 Dirk Eddelbuettel * README.md: Update usage numbers in Examples section 2023-07-01 Dirk Eddelbuettel * docker/ci-dev/Dockerfile: Make 'rm' more robust as 'rm -f' * docker/ci-4.2/Dockerfile: Add new container for R 4.2.3 * .github/workflows/ci.yaml (jobs): Add entry for R 4.2.3 2023-06-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * README.md: Two URL updates for appease R CMD check * DESCRIPTION (Encoding): Somewhat belated addition 2023-04-18 Dirk Eddelbuettel * README.md: Use app.codecov.io as base for codecov link 2023-04-12 Dirk Eddelbuettel * .github/workflows/ci.yaml: Simplified container use 2023-03-27 Dirk Eddelbuettel * .github/workflows/stale.yaml: Roll to v8 2023-03-27 Iñaki Ucar * R/Attributes.R: Remove command quoting, not needed anymore for system2() * inst/tinytest/test_xptr.R: Update copyright 2023-03-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/tinytest/test_stats.R: Revisit change from PR #1252; we now use a slightly smaller tolerance to accomodate old and new value * inst/tinytest/test_sugar.R: Protect a small number of tests on NA propagation from running on arm64/Darwin which requires special care 2023-03-25 Iñaki Ucar * R/Attributes.R: Switch to system2 to be able to capture stderr on error 2023-03-24 Dirk Eddelbuettel * docker/ci-dev/Dockerfile: During Debian freeze experimental repo is renamed which leads to a hickup here so temporarily remove list file 2023-03-24 Iñaki Ucar * inst/tinytest/test_xptr.R: Skip some tests on Windows 2023-03-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * src/attributes.cpp (RExportsGenerator::writeEnd): Replace a pair of apostrophes with backticks in generated .Call() statemente 2023-02-07 Dirk Eddelbuettel * inst/tinytest/test_stats.R: Use more accurate value in R 4.3.0 2023-02-06 Dirk Eddelbuettel * inst/CITATION: Update to new format preferred by r-devel 2023-02-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/include/Rcpp/sugar/functions/sapply.h: Enable compilation under C++20 (using clang++ and its C++ library) via invoke_result 2023-01-29 Iñaki Ucar * inst/tinytest/test_xptr.R: Fix a couple of tests writing to stdout 2023-01-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2023-01-24 Lukasz Laniewski-Wollk * R/RcppLdpath.R: CxxFlags() now quotes only non-standard paths on linux 2023-01-22 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.10 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem 2023-01-08 Dirk Eddelbuettel * inst/include/Rcpp/String.h: Address clang++-14 conversion warning * inst/include/Rcpp/sugar/functions/mean.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * src/attributes.cpp: Idem * src/date.cpp: Idem 2022-12-29 Dirk Eddelbuettel * .github/workflows/docker.yaml (jobs): Update several actions 2022-12-26 Dirk Eddelbuettel * .github/workflows/stale.yaml (jobs): Update actions/stale@v6 2022-11-14 Dirk Eddelbuettel * .github/workflows/ci.yaml (jobs): Update to actions/checkout@v3 2022-10-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2022-10-27 Kevin Ushey * inst/tinytest/cpp/coerce.cpp: add coerce unit tests * inst/tinytest/test_coerce.R: idem 2022-10-25 Dirk Eddelbuettel * inst/include/Rcpp/internal/r_coerce.h (coerce_to_string): Replace last remaining sprintf with snprintf 2022-10-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * R/Attributes.R (sourceCpp): Protect path to binary from spaces 2022-10-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/tinytest/test_dataframe.R (test.DataFrame.PushZeroLength): Add new test * inst/tinytest/cpp/DataFrame.cpp (DataFrame_PushOnEmpty): C++ support for new test 2022-10-04 Dirk Eddelbuettel * inst/include/Rcpp/DataFrame.h (set_type_after_push): Allow zero-row data.frame objects to be grown by push_{back,front}() 2022-09-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2022-09-23 Kevin Ushey * R/Module.R: Force 'finalize' method to be materialized 2022-09-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * R/Attributes.R: Support C++20, C++23 and C++2b (for experimental / incomplete support) via new plugins 2022-07-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2022-07-23 Iñaki Ucar * inst/include/Rcpp/r/headers.h: Unwind protection is enabled by default unless `RCPP_NO_UNWIND_PROTECT` is defined (`RCPP_USE_UNWIND_PROTECT` is not checked anymore and has no effect) * inst/include/Rcpp/vector/Vector.h: Switch evaluation to `Rcpp_eval` * R/Attributes.R: `[[Rcpp::plugins(unwindProtect)]]` is deprecated * inst/tinytest/cpp/stack.cpp: Adapted * inst/tinytest/test_exceptions.R: Adapted * inst/tinytest/test_interface.R: Adapted * inst/tinytest/testRcppInterfaceExporter/src/config.h: Removed 2022-07-10 Dirk Eddelbuettel * docker/ci-4.1/Dockerfile: Add Dockerfile for 4.1 series * .github/workflows/ci.yaml: Add 4.1 to CI matrix * .github/workflows/docker.yaml: Do not rebuild versioned ones 2022-07-02 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.9 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2022-07-01 Dirk Eddelbuettel * man/dependsAttribute.Rd: Use https in URL * man/exportAttribute.Rd: Idem * man/interfacesAttribute.Rd: Idem * DESCRIPTION (URL): Idem * README.md: Idem, use Amazon page for Rcpp book 2022-05-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2022-05-25 Dirk Eddelbuettel * inst/tinytest/test_string.R: Add C++11 conditioning for new unit tests 2022-05-23 Dean Scarff * inst/include/Rcpp/String.h: Make less copies of strings via move semantics and preserving the buffer/SEXP representation when copying * inst/include/RcppCommon.h: include for std::move * inst/tinytest/cpp/String.cpp: Add unit tests * inst/tinytest/test_string.R: Add unit tests 2022-05-12 Dirk Eddelbuettel * docker/ci/Dockerfile: Added xml2, also use more r-cran-* binaries 2022-05-12 Marco Colombo * vignettes/rmd/Rcpp-FAQ.Rmd: Fixed typo 2022-04-03 Dirk Eddelbuettel * vignettes/rmd/Rcpp-FAQ.Rmd: Add paragraph about Date(time) not being aimed at parsing large quantities at once * vignettes/pdf/Rcpp-FAQ.pdf: Idem * vignettes/rmd/Rcpp.bib: Add four entries * inst/bib/Rcpp.bib: Idem 2022-03-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2022-03-13 Iñaki Ucar * src/barrier.cpp: Untag tokens upon removal from the precious list, so that the internal reference counter can be safely decremented by R 2022-03-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * tests/tinytest.R: Disable full tests on four-digits release to not exceed CRAN test time preference 2022-03-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/tinytest/cpp/sugar.cpp: Also conditionally replace std::unary_function with std::function * vignettes/rmd/Rcpp-sugar.Rmd: Replace std::unary_function example with std::function (implicitly requiring C++ in vignette example) * vignettes/rmd/Rcpp-FAQ.Rmd: Idem 2022-03-09 Dirk Eddelbuettel * inst/include/Rcpp/Language.h: To quieten compilations, replace std::(unary|binary)_function with std::function for C++11 or later * inst/include/Rcpp/StringTransformer.he: Idem 2022-01-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2022-01-20 Dirk Eddelbuettel * src/attributes.cpp: Make three small changes to permit compilation under C++98 now (while we consider just turning to C++11 overall) 2022-01-14 Dirk Eddelbuettel * inst/tinytest/test_packageversion.R: Comparison to 'dev' revision version now tolerant of optional trailing zero (e.g. 1.0.8.0) 2022-01-11 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.8 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt * inst/include/Rcpp/r/headers.h: STRICT_R_HEADERS set by default unless override RCPP_NO_STRICT_HEADERS is set (cf issue #1158) 2022-01-10 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Updated CRAN and R references * inst/bib/Rcpp.bib: Idem * vignettes/rmd/getCurrentVersionsOfCitedPackages.R: Updated 2022-01-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/NEWS.Rd: Added entries for a few PRs since last release * vignettes/rmd/Rcpp.bib: Provide both url and doi entries * inst/bib/Rcpp.bib: Idem 2021-12-28 Dirk Eddelbuettel * README.md: Add section on performance 2021-12-24 Dirk Eddelbuettel * README.md: Update usage counts 2021-12-16 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Update JSS references to new doi scheme, update http URL links to https * inst/bib/Rcpp.bib: Idem 2021-12-10 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2021-12-08 Dirk Eddelbuettel * inst/include/Rcpp/Rcpp: Added as new entry point * inst/include/Rcpp/Light: Added as lighter-weight entry point * inst/include/Rcpp/Lighter: Idem * inst/include/Rcpp/Lightest: Idem 2021-11-30 Dirk Eddelbuettel * README.md: Remove Travis badge * .travis.yml: Removed 2021-11-15 Dirk Eddelbuettel * docker/ci/Dockerfile: Minor cleanup 2021-11-14 Dirk Eddelbuettel * R/RcppLdpath.R: Simplified as we no longer need to worry about CXX0X 2021-11-11 Kevin Ushey * R/RcppLdpath.R: CxxFlags() now quotes its include path 2021-10-15 Travers Ching * inst/tinytest/testRcppAttributePackage: Tests `signature` attribute * inst/tinytest/test_attribute_package.R: Tests `signature` attribute 2021-10-13 Dirk Eddelbuettel * README.md: Switch JSS url to doi form per JSS request * man/Rcpp-package.Rd: Idem * man/RcppLdFlags.Rd: Idem * inst/CITATION: Only use doi entries in three citEntry blocks 2021-10-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * .codecov.yml (comment): Disable codecov comments on PRs 2021-10-10 Travers Ching * src/attributes.cpp: Add `signature` attribute and syntax checks 2021-10-02 Dirk Eddelbuettel * .github/workflows/docker.yaml (jobs): Add container builder action 2021-10-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Updated 2021-09-29 Iñaki Ucar * inst/include/Rcpp/XPtr.h: Check for new define `RCPP_USE_FINALIZE_ON_EXIT` to flip the value of XPtr's `finalizeOnExit` parameter from false (default) to true. * inst/tinytest/test_xptr.R: Added test for this functionality. 2021-09-27 Dirk Eddelbuettel * README.md: Added total downloads badge 2021-09-06 Dirk Eddelbuettel * docker/ci-4.0/Dockerfile: Using R 4.0.5 to build ci-4.0 * .github/workflows/ci.yaml (jobs): Also run against R 4.0.* 2021-09-05 Dirk Eddelbuettel * inst/examples/Misc/piSugar.cpp (piSugar): Remove spurious call to RNGScope we do not need with Rcpp Attributes * inst/examples/RcppGibbs/RcppGibbs.R (Rgibbs): Comment on two uses of RNGScope as historical in pre-Attributes code * inst/examples/RcppGibbs/timeRNGs.R: Idem for one more 2021-08-05 Dirk Eddelbuettel * inst/bib/Rcpp.bib: Use https for CRAN URLs * vignettes/rmd/Rcpp.bib: Idem 2021-07-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2021-07-24 Dirk Eddelbuettel * vignettes/rmd/Rcpp-FAQ.Rmd: New entry on growing vectors 2021-07-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * cleanup: Check for optional vignettes/rmd before trying to access it 2021-07-06 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.7 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem * vignettes/pdf/*: Rebuilt 2021-07-05 Iñaki Ucar * src/barrier.cpp (Rcpp_precious_remove): Protect from call with wrong token when unloading modules compiled under earlier version 2021-07-02 Dirk Eddelbuettel * inst/include/Rcpp/r/headers.h: Update notice as January 2022 release will remove protection for STRICT_R_HEADERS making it default 2021-05-27 Dirk Eddelbuettel * inst/tinytest/cpp/rcppversion.cpp (checkVersion): Allow for more than four components of a development version number * inst/tinytest/test_packageversion.R: Idem * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Clarify in comment 2021-05-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2021-05-09 Dirk Eddelbuettel * inst/include/RcppCommon.h: Add cfloat header 2021-04-09 Dirk Eddelbuettel * inst/include/Rcpp/hash/IndexHash.h: Silence one comparison, update use of unsigned int to uint32_t throughout 2021-03-22 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2021-03-21 Dirk Eddelbuettel * inst/include/Rcpp/api/meat/message.h: Add wrapper for base::message * inst/include/Rcpp/api/meat/meat.h: Include new file * inst/tinytest/test_misc.R: Simple test * inst/tinytest/cpp/misc.cpp (messageWrapper): Test support 2021-02-23 Dirk Eddelbuettel * Contributing.md: Update unit test link to tinytest 2021-02-08 Dirk Eddelbuettel * DESCRIPTION (Author): Add Inaki to the team 2021-02-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * README.md: Mention the Rcpp drap repo and its release candidates in installation section 2021-01-30 Iñaki Ucar * inst/include/test_global_rostream.R: Added test new (optionally) global Rcout and Rcerr objects 2021-01-28 Iñaki Ucar * inst/include/Rcpp/iostream/Rstreambuf.h: Support for global Rcout/Rcerr by defining `-DRCPP_USE_GLOBAL_ROSTREAM`; this mimics std::cout/cerr; initialization code is automatically generated. * inst/include/Rcpp/routines.h: Ditto * src/api.cpp: Ditto * src/attributes.cpp: Ditto * src/rcpp_init.cpp: Ditto 2021-01-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/DataFrame.h: Remove unused variable * R/Attributes.R (sourceCpp): Support argument echo to be passed to source() to silence optional R evaluation 2021-01-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/include/RcppCommon.h: Preverse existing API and offer new token-based API alongside via Rcpp_Precious{Preserve,Release} * inst/include/Rcpp/String.h: Use Rcpp_Precious{Preserve,Release} * inst/include/Rcpp/storage/PreserveStorage.h: Ditto 2021-01-17 Iñaki Ucar * inst/include/Rcpp/String.h: Use Rcpp_{Preserve,Release}Object throughout which connects to Rcpp_precious_* routines * inst/include/Rcpp/exceptions.h: Use Rcpp_ReleaseObject * inst/include/Rcpp/routines.h: Several corrections and refinements * inst/include/Rcpp/storage/PreserveStorage.h: Ditto * inst/include/Rcpp/traits/named_object.h: Ditto * inst/include/Rcpp/unwuindProtect.h: Ditto * inst/include/RcppCommon.h: Ditto * src/barrier.cpp: Ditto 2021-01-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem [ these were originally committed 17 May 2020 and have been rebased ] * src/barrier.cpp: Implement Rcpp_precious_{init,teardown,preserve,remove} * src/rcpp_init.c: Register cpp_precious_{init,teardown,preserve,remove} and call from R_{init,unload}_Rcpp * inst/include/Rcpp/routines.h: Declare Rcpp_precious_{init,teardown, preserve,remove} * inst/include/Rcpp/exceptions.h: Use Rcpp_precious_remove * inst/include/Rcpp/traits/named_object.h: Use Rcpp_precious_{preserve,remove} * inst/include/Rcpp/unwuindProtect.h: Use Rcpp_precious_preserve * inst/include/RcppCommon.h: Use Rcpp_precious_{preserve,remove} 2021-01-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * tests/tinytest.R: Test for CODECOV when deciding to run extensive tests or just a subset, and set CI=true to enable run full set * .github/workflows/stale.yaml: Run weekly instead of daily * src/attributes.cpp: Additional #nocov tag(s) * R/Attributes.R: Idem * R/Module.R: Idem * R/Rcpp.package.skeleton.R: Idem * R/RcppClass.R: Idem * R/RcppLdpath.R: Idem * src/attributes.cpp: Support include files with dots in package name 2021-01-14 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.6 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem 2021-01-13 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Updated package versions * inst/bib/Rcpp.bib: Idem 2021-01-02 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Wrap any() around grepl() 2020-12-22 Dirk Eddelbuettel * .github/workflows/stale.yaml: Adding a staleness monitor labeling and ultimately closing issues and PRs after suitably long windows 2020-12-16 Dirk Eddelbuettel * inst/NEWS.Rd: Updated for recent activity * .github/workflows/ci.yaml: Add container-based CI runner * README.md: Add new badge 2020-11-06 Dirk Eddelbuettel * DESCRIPTION: More URL updates, e.g. http -> https * README.md: Ditto * inst/CITATION: Ditto * man/Rcpp-package.Rd: Ditto * inst/CITATION: Change from PeerJ Preprint to TAS 2020-10-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/generated/InternalFunction__ctors.h: Switch XPtr finalizer argument from false to true 2020-10-22 Dirk Eddelbuettel * inst/include/Rcpp/lang.h: Remove spurious whitespace * vignettes/.gitignore: Refined to no longer ignore pdf files * vignettes/pdf/*: Added * inst/NEWS.Rd: Updated for two PRs 2020-10-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-10-19 Benjamin Christoffersen * src/attributes.cpp: Initialize two private bool variable in default constructor to avoid santizer warning 2020-08-20 Mattias Ellert * inst/include/Rcpp/lang.h: Remove obsolete and confusing comment 2020-08-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-07-09 Walter Somerville * inst/include/Rcpp/DataFrame.h: Warn when data.frame has varying length * inst/tinyTest/cpp/DataFrame.cpp: Test added * inst/tinyTest/test_dataframe.R: Idem 2020-07-07 Walter Somerville * inst/include/Rcpp/DataFrame.h: Implement explict push_back and push_front for DataFrame, which takes care to set the class and row.names attributes. * inst/tinyTest/test_dataframe.R: Add in tests for push_back/push_front * inst/tinyTest/cpp/DataFrame.cpp: Idem 2020-07-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-07-06 Kevin Ushey * inst/include/Rcpp/module/class.h: EXTPTR_PTR -> R_ExternalPtrAddr * src/api.cpp: Idem * src/module.cpp: Idem 2020-07-01 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.5 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem 2020-06-27 Dirk Eddelbuettel * docker/ci/Dockerfile: Revert back to standard r-base container * docker/plus/Dockerfile: Also install bit64 2020-06-19 Dirk Eddelbuettel * .travis.yml: Determine package name and version from DESCRIPTION, switch to bionic 2020-06-14 Dirk Eddelbuettel * inst/bib/Rcpp.bib: Add John's new 'S, R, and Data Science' article * vignettes/rmd/Rcpp.bib: Idem 2020-06-07 Dirk Eddelbuettel * .travis.yml (jobs): Replace R 3.4.3 with R 3.6.3 in matrix 2020-06-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * R/Rcpp.package.skeleton.R: Remove a remaining NAMESPACE entry for a temporary function symbol; ensure an exportPattern is set 2020-05-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-05-17 Kevin Ushey * inst/include/Rcpp/String.h: Don't preserve returned SEXP in wrap * inst/include/RcppCommon.h: Simplify 2020-04-30 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * vignettes/rmd/Rcpp-libraries.Rmd: Add new vignette source * vignettes/rmd/Rcpp.bib: Complete references * inst/bib/Rcpp.bib: Idem 2020-04-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-04-25 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/sample.h: Replace R_alloc() with a standard vector allocation to reduce memory consumption in sample * docker/ci/Dockerfile: Update for R 4.0.0 (with a temporary diversion to rocker/r-base:4.0.0, and all-source installations) * vignettes/rmd/Makefile: Add bibtex call to JSS 2011 paper builds 2020-04-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-04-15 Kevin Ushey * inst/include/Rcpp/String.h: Avoid 'debug' namespace collisions * inst/include/Rcpp/macros/debug.h: Idem * inst/include/Rcpp/macros/macros.h: Idem 2020-04-15 Uwe Korn * inst/include/Rcpp/DataFrame.h: Explicit call to scalar std::abs 2020-04-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-04-10 Kevin Ushey * inst/include/Rcpp/macros/macros.h: Safer definition of short_file_name * inst/include/Rcpp/String.h: Idem * inst/include/Rcpp/macros/debug.h: Idem * src/api.cpp: Idem 2020-04-10 Dirk Eddelbuettel * inst/tinytest/test_exceptions.R: Skip parts of file if on Solaris 2020-04-02 Dirk Eddelbuettel * inst/NEWS.rd: Mark as patch release 1.0.4.6 * inst/tinytest/test_exceptions.R: If running skip remainder of file on Windows to not trigger failed test 2020-04-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2020-03-31 Dirk Eddelbuettel * docker/ci-dev/Dockerfile: Also install the 'codetools' package 2020-03-31 Kevin Ushey * R/Attributes.R: Fix for sourceCpp() on Windows w/R-devel 2020-03-28 Dirk Eddelbuettel * inst/examples/RcppGibbs/RcppGibbs_Updated.R: Updated example 2020-03-24 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/Environment.h: Added two Shield wrappers around Rf_langX calls 2020-03-23 Dirk Eddelbuettel * .travis.yml (script): Run coverage as parallel step 2020-03-22 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * docker/ci-3.4/Dockerfile: Added * docker/ci-3.5/Dockerfile: Idem * docker/ci-dev/Dockerfile: Idem * .travis.yml (jobs): Expand to matrix 2020-03-22 Mattias Ellert * inst/include/Rcpp/exceptions_impl.h: Add include guard, Make sure RCPP_DEMANGLER_ENABLED is always defined, Add missing inline qualifier 2020-03-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/lang.h: Define Rcpp_list{2,3,4,5} in the Rcpp namespace * DESCRIPTION: Remove versioned depends on R (>= 3.0.0) from 2013 2020-03-17 Davis Vaughan * inst/include/Rcpp/lang.h: Inline Rcpp_list6() to support R 3.3. 2020-03-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version (twice) * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Updated 2020-03-15 Kevin Ushey * inst/include/Rcpp/exceptions_impl.h: Ensure is included into global namespace; refactor detection of demangler support 2020-03-13 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.4 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * vignettes/rmd/Rcpp.bib: Idem * inst/bib/Rcpp.bib: Idem 2020-03-12 Dirk Eddelbuettel * vignettes/rmd/Rcpp.bib: Updated to current package versions * inst/bib/Rcpp.bib: Idem 2020-02-24 Dirk Eddelbuettel * inst/include/Rcpp/exceptions_impl.h: Remove spurious semicolon 2020-02-23 Dirk Eddelbuettel * inst/include/Rcpp/generated/Vector__create.h: Added #nocov tags * inst/include/Rcpp/exceptions_impl.h: Idem * src/api.cpp: Idem plus some whitespace realignment 2020-02-13 Dirk Eddelbuettel * README.md: Add a Debian badge 2020-02-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * README.md: Added indirect CRAN use badge 2020-02-09 Joshua Pritikin * inst/include/Rcpp.h: Include exceptions_impl.h * inst/include/Rcpp/exceptions.h: Make thread-safe * inst/include/Rcpp/exceptions_impl.h: New home for code moved from src/api.cpp 2020-01-05 Dirk Eddelbuettel * inst/include/Rcpp/exceptions.h: A few more #nocov tags * inst/include/Rcpp/generated/Vector__create.h: Idem, plus whitespace 2020-01-04 Dirk Eddelbuettel * R/Attributes.R: A few more #nocov tags 2020-01-01 Dirk Eddelbuettel * inst/include/Rcpp/module/Module.h: A few more #nocov tags * inst/include/Rcpp/XPtr.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem 2019-12-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2019-12-29 Qiang Kou * inst/include/Rcpp/vector/Matrix.h: Ensure scalar OP matrix do not change right-hand side in operation * inst/tinytest/test_matrix.R: New tests * inst/tinytest/cpp/Matrix.cpp: Idem 2019-12-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2019-12-18 Dirk Eddelbuettel * inst/include/Rcpp/XPtr.h: Additional null check, refactored 2019-12-17 Kirill Müller * inst/include/Rcpp/XPtr.h: Clear external pointer before finalizer 2019-12-17 Dirk Eddelbuettel * R/Attributes.R (sourceCpp): Very minor cosmetic changes 2019-12-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2019-12-14 Dirk Eddelbuettel * R/Attributes.R (sourceCpp): Support new argument windowsDebugDLL to create a debug DLL, supported on Windows only * man/sourceCpp.Rd: Document it * src/date.cpp: A few more #nocov tage 2019-12-13 Dirk Eddelbuettel * src/api.cpp: A few more #nocov tags * src/attributes.cpp: Idem * src/barrier.cpp: Idem 2019-12-08 Dirk Eddelbuettel * tests/tinytest.R: Turn verbose tests on in dev and on Travis * inst/tinytest/test_client_package.R: Finer-grained skip messages * inst/tinytest/test_module_client_package.R: Idem * inst/tinytest/test_expose_class.R: Idem * inst/tinytest/test_interface.R: Idem * inst/tinytest/test_rcpp_package_skeleton.R: Idem * inst/tinytest/test_reference.R: Idem * inst/tinytest/test_*.R: Streamlined initial test and sourceCpp call * src/attributes.cpp: Remove dangling '#nocov end' 2019-12-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * inst/tinytest/test_binary_package.R: Finer-grained skip messages * inst/tinytest/test_misc.R: Add commented-out test that fails * tests/tinytest.R: Minor edit * docker/ci/Dockerfile: Add curl and ssl -dev packages needed for covr 2019-12-05 Dirk Eddelbuettel * vignettes/rmd/Rcpp-FAQ.Rmd (Rcpp): Add entry about "'dataptr' (or 'enterRNGScope') not provided by Rcpp" recommending proper importFrom 2019-12-03 Dirk Eddelbuettel * docker/ci/Dockerfile: Lighter builds as fewer Suggests: * docker/plus/Dockerfile: Take packages moved from ci/Dockerfile 2019-12-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * DESCRIPTION (Suggests): Remove knitr, rmarkdown, pinp * DESCRIPTION (VignetteBuilder): Remove knitr 2019-11-26 Dirk Eddelbuettel * inst/tinytest/test_embedded_r.R: Use sink to suppress noisy output, reenable tests (still conditional on usual environment variable) 2019-11-25 Dirk Eddelbuettel * inst/tinytest/cpp/Vector.cpp (no_op): Suppress compiler warning 2019-11-24 Dirk Eddelbuettel * DESCRIPTION (Suggests): Add tinytest, remove RUnit * tests/doRUnit.R: Removed * tests/tinytest.R: Added * tests/tinytest.R: Converted from RUnit to tinytest * inst/tinytest/test_algorithm.R: Idem * inst/tinytest/test_as.R: Idem * inst/tinytest/test_binary_package.R: Idem (but inactive for now) * inst/tinytest/test_client_package.R: Idem (but inactive for now) * inst/tinytest/test_dataframe.R: Idem * inst/tinytest/test_date.R: Idem (but condition two test sets on TZ) * inst/tinytest/test_dispatch.R: Idem * inst/tinytest/test_embedded.R: Idem * inst/tinytest/test_environments.R: Idem * inst/tinytest/test_exceptions.R: Idem * inst/tinytest/test_exceptions_nocall.R: Idem * inst/tinytest/test_expose_class.R: Idem * inst/tinytest/test_function.R: Idem * inst/tinytest/test_interface.R: Idem (but inactive for now) * inst/tinytest/test_internal_function.R: Idem * inst/tinytest/test_internal_function_cpp11.R: Idem * inst/tinytest/test_language.R: Idem * inst/tinytest/test_listof.R: Idem * inst/tinytest/test_matrix.R: Idem * inst/tinytest/test_misc.R: Idem * inst/tinytest/test_modref.R: Idem * inst/tinytest/test_module.R: Idem * inst/tinytest/test_module_client_package.R: Idem * inst/tinytest/test_na.R: Idem * inst/tinytest/test_quickanddirty.R: Idem * inst/tinytest/test_rcpp_package_skeleton.R: Idem * inst/tinytest/test_reference.R: Idem * inst/tinytest/test_rmath.R: Idem * inst/tinytest/test_robject.R: Idem * inst/tinytest/test_s4.R: Idem * inst/tinytest/test_stack.R: Idem * inst/tinytest/test_stats.R: Idem * inst/tinytest/test_string.R: Idem * inst/tinytest/test_subset.R: Idem * inst/tinytest/test_sugar.R: Idem * inst/tinytest/test_sugar_var.R: Idem * inst/tinytest/test_support.R: Idem * inst/tinytest/test_system.R: Idem * inst/tinytest/test_table.R: Idem * inst/tinytest/test_vector.R: Idem * inst/tinytest/test_vector_old.R: Idem * inst/tinytest/test_wrap.R: Idem * inst/tinytest/test_wstring.R: Idem * inst/tinytest/test_xptr.R: Idem * inst/tinytest/cpp/*: C++ support files for tests * inst/tinytest/*: Other support files and directories from unitTests * R/unitTests.R: Removed as tied to RUnit setuo * inst/tinytest/test_attributes.R: Added test for error with non-existing package in cppFunction 2019-11-23 Dirk Eddelbuettel * docker/ci/Dockerfile: Add tinytest to ci Docker image 2019-11-20 Dirk Eddelbuettel * R/Attributes.R: Test for and report unavailable 'LinkingTo' package 2019-11-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2019-11-18 Kun Ren * src/attributes.cpp: Add invisible param to export attribute (#1024) * vignettes/rmd/Rcpp-attributes.Rmd: Add an section of Returning invisible object 2019-11-13 Dirk Eddelbuettel * .github/ISSUE_TEMPLATE.md: Another small edit * .github/PULL_REQUEST_TEMPLATE.md: Idem 2019-11-13 Stephen Wade * inst/include/Rcpp/XPtr.h: Delete delegating ctor (follow-up #1012) * inst/unitTests/runit.XPTr.R: Reinsert self-tag test on Windows 2019-11-11 Dirk Eddelbuettel * inst/unitTests/runit.packageversion.R: New test * inst/unitTests/cpp/rcppversion.cpp: Cpp portion of test 2019-11-10 Dirk Eddelbuettel * .github/: Add files CONTRIBUTING.md, FUNDING.yml, ISSUE_TEMPLATE.md and PULL_REQUEST_TEMPLATE.md * inst/include/Rcpp/config.h: Correct RCPP_VERSION and RCPP_DEV_VERSION to 1.0.3 2019-11-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2019-11-09 TJ McKinley * R/Attributes.R: Correct how cppFunction() deals with multiple depends arguments 2019-11-08 Romain Francois * inst/include/Rcpp/lang.h: Safer Rcpp_list* and Rcpp_lang* * inst/include/Rcpp/Function.h: Add Function.invoke() for operator() * inst/include/Rcpp/generated/Function__operator.h: Safer Function.operator() using Function.invoke() 2019-11-08 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Release 1.0.3 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem 2019-11-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/XPtr.h: Provided fallback for old constructor when C++11 is not available (follow-up to #1003) * inst/unitTests/runit.XPTr.R (test.XPtr): On Windows (as a proxy for old compilers) do not test new feature * tests/doRUnit.R: Protect printing to /tmp from Windows use * vignettes/rmd/Rcpp.bib: Updated * inst/bib/Rcpp.bib: Idem 2019-11-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/Reference.h: Shield Rf_mkstring inside Rf_lang2 * inst/include/Rcpp/Environment.h: Idem (inside Rf_lang4) * inst/include/Rcpp/proxy/FieldProxy.h: Idem (inside Rf_lang3 and 4) 2019-10-31 Romain Francois * inst/include/Rcpp/DataFrame.h: Protect temporaries from gc * inst/include/Rcpp/Environment.h: Idem * inst/include/Rcpp/r_cast.h: Idem 2019-10-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/unitTests/runit.exposeClass.R: Updated to pass with r-devel * vignettes/rmd/Rcpp-FAQ.Rmd: Two new short section on speedier compilation and lack of exceptions / stop() across shared libraries 2019-10-26 Dirk Eddelbuettel * vignettes/Rcpp-package.Rnw: Another wrapper * vignettes/Rcpp-jss-2011.Rnw: Idem * vignettes/Makefile: Refinements * vignettes/rmd/Makefile: Idem * cleanup: Removed bashism, added invocation of make clean 2019-10-23 Dirk Eddelbuettel * vignettes/Rcpp-*.Rnw: Wrappers around pdf/*pdf * vignettes/Makefile: Added 2019-10-21 Dirk Eddelbuettel * vignettes/rmd/*: Moved from parent directory * vignettes/pdf/*: New target directory 2019-10-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * vignettes/Rcpp-FAQ.Rmd: Turn off knitr cache * vignettes/Rcpp-introduction.Rmd: Idem * vignettes/Makefile: Add simple Makefile * .Rbuildignore: Exclude vignettes/Makefile 2019-10-19 Stephen Wade * inst/include/Rcpp/XPtr.h: XPtr constructor split up, a single argument does not modify tags and protected data of the external pointer * inst/unitTests/cpp/Xptr.cpp: Added test * inst/unitTests/runit.XPtr.R: Idem 2019-10-14 Dirk Eddelbuettel * README.md: Added CRAN + BioConductor badges for reverse depends, 2019-10-11 Dirk Eddelbuettel * inst/include/Rcpp/exceptions.h: Condition use of typeid() on absence of RCPP_NO_RTTI in two places * inst/include/Rcpp/r/headers.h: RCPP_NO_RTTI implies RCPP_NO_MODULES 2019-10-04 Dirk Eddelbuettel * vignettes/Rcpp-attributes.Rmd: Correct two unevaluated knitr C++ chunks to mode 'Rcpp' rather than the (unregistered) C++ mode * vignettes/Rcpp-extending.Rmd: Minor white-space tweak to avoid paragraph-spacing warnings from latex and its mdframed style * vignettes/Rcpp-modules.Rmd: Idem * vignettes/Rcpp-sugar.Rmd: Idem 2019-10-01 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2019-09-30 Kevin Ushey * inst/include/Rcpp.h: add RCPP_NO_MODULES * inst/include/Rcpp/api/meat/is.h: Idem * inst/include/Rcpp/api/meat/meat.h: Idem 2019-09-28 Dirk Eddelbuettel * README.md: Add a stackoverflow tag to indicate where to ask questions, also updated package counts on CRAN and BioC for Rcpp users 2019-08-06 Riccardo Porreca * vignettes/Rcpp-modules.Rmd: Extensive review and edit improving the Modules vignette 2019-08-04 Dirk Eddelbuettel * README.md: Add thre doi badges * inst/NEWS.Rd: Two minor edits 2019-07-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2019-07-21 Riccardo Porreca * R/Module.R: Use an explicit Rcpp:: in the initalize method for C++ classes wrapped inside modules to ensure proper initialization 2019-07-20 Dirk Eddelbuettel * DESCRIPTION: Release 1.0.2 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem 2019-07-18 Pierrick Roger * src/attributes.cpp: Correct parsing of default function values * inst/unitTests/cpp/attributes.cpp: Added tests * inst/unitTests/runit.attributes.R: Idem 2019-07-16 Dirk Eddelbuettel * debian/: Removed, see https://salsa.debian.org/edd/r-base/ instead 2019-07-04 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated * inst/bib/Rcpp.bib: Idem 2019-05-05 Dirk Eddelbuettel * .Rbuildignore: Small tweak 2019-04-27 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Use getRcppVersion() 2019-04-26 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * R/tools.R (getRcppVersion): More idiomatic code 2019-04-25 Dirk Eddelbuettel * R/tools.R (getRcppVersion): Export R (and dev) package version * man/getRcppVersion.Rd: Documentation for new function * inst/include/Rcpp/config.h (RCPP_VERSION_STRING): New version and development version string #define * src/api.cpp (getRcppVersionStrings): Expose new versions strings * src/internal.h: Register new version string exporter * src/rcpp_init.cpp (callEntries[]): Idem * inst/unitTests/runit.misc.R (test.getRcppVersion): test new function 2019-03-23 Ralf Stubner * vignettes/Rcpp-modules.Rmd: Describe RCPP_EXPOSED_* macros * vignettes/Rcpp-extending.Rmd: Reference Modules extensions 2019-03-23 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/NEWS.Rd: Updated 2019-03-20 James J Balamuta * inst/include/Rcpp/sugar/functions/unique.h: Added decreasing parameter to control sort. * inst/unitTests/runit.sugar.R: Added sort_unique() tests * inst/unitTests/cpp/sugar.cpp: Ditto 2019-03-20 Dirk Eddelbuettel * src/date.cpp: Renamed from Date.cpp * src/module.cpp: Renamed from Module.cpp * src/rcpp_init.cpp: Renamed from Rcpp_init.cpp 2019-03-19 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * tests/doRUnit.R: On Travis always set RunAllRcppTests * docker/ci/Dockerfile: Set environment variables container-wide 2019-03-18 Dirk Eddelbuettel * inst/include/Rcpp/macros/macros.h (END_RCPP_RETURN_ERROR): Add UNPROTECT to reference nprot, also check for stop_sym 2019-03-17 Dirk Eddelbuettel * DESCRIPTION: Release 1.0.1 * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem 2019-03-16 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/unitTests/runit.sugar.R: Set the sample() behaviour to R 3.5.0 as R 3.6.0 has a breaking change (for the better) 2019-03-13 Romain François * inst/include/Rcpp/macros/macros.h: Add UNPROTECT to please rchk 2019-03-12 Romain François * inst/include/Rcpp/api/meat/proxy.h: AttributeProxy::set() with Shield<> and a few related uses of Shield<> to please rchk * inst/include/Rcpp/clone.h: Idem * inst/include/Rcpp/proxy/AttributeProxy.h: Idem * inst/include/Rcpp/proxy/NamesProxy.h: Idem * inst/include/Rcpp/vector/Matrix.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem 2019-02-25 Dirk Eddelbuettel * .travis.yml (after_success): Setting CODECOV_TOKEN to reenable codecov.io coverage as detailed by Ralf in GitHub issue #941 2019-02-16 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/cbind.h: Converted CRLF to CR 2019-02-15 Dirk Eddelbuettel * inst/README: Moved stale file to local/ * inst/THANKS: Idem 2019-02-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version 2019-02-11 Kevin Ushey * R/Attributes.R: better handle pre-existing RcppExports.cpp, RcppExports.R when calling compileAttributes() 2019-02-09 Ralf Stubner * Rcpp-modules.Rmd: Added example for .factory 2019-01-31 Dirk Eddelbuettel * inst/include/Rcpp/protection/Shelter.h (Rcpp): Only increase nprotected count if object is not NULL (suggested by Stepan Sindelar) 2018-12-26 Zhuoer Dong * vignettes/Rcpp-quickref.Rmd: Fix three bugs: use `Named()`, define `glob`, `glob.ls(TRUE)`. 2018-12-01 Dirk Eddelbuettel * R/Attributes.R: Added new 'c++2a' plugin for '-std=c++2a' compilation standard supported by g++ 8 or later 2018-11-11 Dirk Eddelbuettel * inst/include/Rcpp/vector/Subsetter.h (check_indices): More informative error message as suggested by KK 2018-11-09 William Nolan * inst/include/Rcpp/vector/Subsetter.h: Fixed to use R_xlen_t instead of int for indexing and added warning when indexing by IntegerVector (only for large enough vectors) 2018-11-05 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Version 1.0, and happy 10th birthday! * inst/include/Rcpp/config.h: Idem * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem 2018-11-04 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * README.md: Updated stated package and test numbers 2018-10-25 Kevin Ushey * inst/include/Rcpp/String.h: Use Rf_mkCharLenCE() as appropriate * inst/unitTests/cpp/String.cpp: Add unit tests * inst/unitTests/runit.String.R: Add unit tests 2018-10-12 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * tests/doRUnit.R: Simplified to something similar to what RcppArmadillo (and other packages) had for a while now * vignettes/Rcpp-unitTests.Rnw: Removed as less useful now 2018-10-08 JJ Allaire * R/Attributes.R: Sort the files scanned for attributes in the C locale for stable output across systems. 2018-10-07 Ralf Stubner * vignettes/Rcpp-extending.Rmd: Correct EXPORT to EXPOSED in displays of the corresponding macro, and remove two spurious semicolons 2018-10-02 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem 2018-10-02 Romain Francois * inst/include/Rcpp/vector/Matrix.h: Init nrow in Matrix(no_init) ctor * inst/unitTests/runit.Matrix.R: New test * inst/unitTests/cpp/Matrix.cpp: Idem 2018-09-30 Dirk Eddelbuettel * man/RcppUnitTests.Rd: Remove \details{} with conditional code which R-devel (as of Sep 28) warns about as empty 2018-09-28 Dirk Eddelbuettel * .travis.yml (env): Set distinct build and check options to skip tests of vignettes 2018-09-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/date_datetime/Date.h: Remove the empty destructor to make g++-9 (prerelease) happy [CRAN request] * inst/unitTests/runit.Matrix.R: Correct typo 2018-09-27 Romain Francois * inst/include/Rcpp/vector/Matrix.h: Fix Matrix(no_init(int,int)) constructor * inst/unitTests/runit.Matrix.R: test for above * inst/unitTests/cpp/Matrix.cpp: same 2018-09-26 Dirk Eddelbuettel * docker/ci/Dockerfile: Set env var RunAllRcppTests=yes * .travis.yml: Do not set env var here as needed in Docker 2018-09-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.19 * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem * inst/include/Rcpp/config.h: Idem * R/RcppLdpath.R (RcppLdPath, RcppLdFlags, CxxFlags, RcppCxx0xFlags): After discussion with CRAN, do not mark as .Deprecated() as too many packages are involved. This will need to be phased in more slowly. 2018-09-20 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Set 'eval=FALSE' on another RcppArmadillo example to not create a build-time dependency 2018-09-18 JJ Allaire * src/attributes.cpp: Add support for [[Rcpp::init]] attribute * vignettes/Rcpp-attributes.Rmd: Documentation for [[Rcpp::init]] attribute 2018-09-17 Dirk Eddelbuettel * inst/include/Rcpp/r/headers.h: Define STRICT_R_HEADERS, but until September 2019 protect by defining RCPP_NO_STRICT_HEADERS * .travis.yml (env): Switch to rcpp/ci for ci use 2018-09-15 Dirk Eddelbuettel * docker/ci/Dockerfile: Move Dockerfile to docker/ci * docker/run/Dockerfile: Add deployment Dockerfile * docker/plus/Dockerfile: Add 'plus-sized' Dockerfile suitable for different add-on packages requiring Rcpp{Armadillo,Eigen,GSL} or BH 2018-09-02 Dirk Eddelbuettel * .travis.yml: Switch to rcpp/rcpp-testing container 2018-08-29 Dirk Eddelbuettel * .travis.yml: Use Dockerfile 2018-08-28 Dirk Eddelbuettel * docker/Dockerfile: Add Dockerfile for use by Travis CI 2018-08-27 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * man/Rcpp-deprecated.Rd: Fix two-char typo/thinko in \link{} 2018-07-29 Dirk Eddelbuettel * README.md: Refreshed via some edits and updates * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2018-07-28 Dirk Eddelbuettel * R/RcppLdpath.R (RcppLdPath, RcppLdFlags, CxxFlags, RcppLdFlags) (RcppCxx0xFlags): Marked as deprecated * man/Rcpp-deprecated.Rd: Add exported functions LdFlags() and RcppLdFlags() as deprecated * man/RcppLdFlags.Rd: Idem 2018-07-27 Dirk Eddelbuettel * man/loadRcppModules-deprecated.Rd: Fix typo; was deprecated in 0.12.5, not 0.16.5 which does not exist 2018-07-26 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Use collapse: true * vignettes/Rcpp-introduction.Rmd: Idem 2018-07-25 Dirk Eddelbuettel * vignettes/Rcpp-extending.Rmd: Use collapse: true 2018-07-24 Martin Lysy * R/loadRcppClass.R: Search in R module for 'Class' instead of 'CppClass'. * R/exposeClass.R: Fixed 'rename' argument to work as expected. * inst/unitTests/runit.exposeClass.R: Added unit tests for the above. 2018-07-23 Dirk Eddelbuettel * inst/bib/Rcpp.bib: More updates * vignettes/Rcpp.bib: Idem 2018-07-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.18 * inst/NEWS.Rd: Idem * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp.bib: Idem * inst/include/Rcpp/config.h: Idem * vignettes/Rcpp.bib: Updated other references * inst/bib/Rcpp.bib: Idem * inst/unitTests/runit.sugar.R: Additional min, max unit tests * inst/unitTests/cpp/sugar.cpp: Idem 2018-07-20 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/max.h: Also consider case of an empty vector * inst/include/Rcpp/sugar/functions/min.h: Idem 2018-07-19 Jack Wasey * inst/include/Rcpp/r_cast.h: Error and abort if debugging for STRSXP 2018-07-24 Martin Lysy * R/loadRcppClass.R: Search in R module for 'Class' instead of 'CppClass'. * R/exposeClass.R: Fixed 'rename' argument to work as expected. * inst/unitTests/runit.exposeClass.R: Added unit tests for the above. 2018-07-12 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2018-07-12 Jack Wasey * R/Attributes.R: Use case-insensitive sort of filenames to make RcppExports more deterministic 2018-07-10 Lionel Henry * inst/include/Rcpp/exceptions.h: Move LongjumpException from the Rcpp::internal namespace to the public Rcpp namespace. If you have a catch-all statement like `catch (...)`, be sure to catch and rethrow Rcpp::LongjumpException to prevent the R longjump from being ignored. * inst/include/Rcpp/macros/macros.h (VOID_END_RCPP): idem * src/attributes.cpp: idem 2018-07-09 Dirk Eddelbuettel * src/Date.cpp: Skip 'tm_gmtoff' on AIX as well (thanks to PR 876 by @ayappanec) 2018-07-05 Lionel Henry * inst/include/Rcpp/api/meat/Rcpp_eval.h: Rename `RCPP_PROTECTED_EVAL` to `RCPP_USE_UNWIND_PROTECT` because the new API is now more general than just evaluation of R code. * inst/NEWS.Rd: idem * inst/unitTests/runit.interface.R: idem * R/unit.tests.R (unitTestSetup): Pass extra arguments to sourceCpp() for easier debugging. * R/Attributes.R (.plugins[["unwindProtect"]]): You can now add `[[Rcpp::plugins(unwindProtect)]]` in one of your source file to enable the new unwind-protect mechanism easily. It appends `-DRCPP_USE_UNWIND_PROTECT` to `PKG_CPPFLAGS`. This is safer than using a `#define` because it ensures unwind-protect is enabled in all compilation units, including RcppExports.cpp. * inst/unitTests/cpp/stack.cpp: Use new plugin to enable unwind-protect. 2018-06-22 Kevin Ushey * inst/include/Rcpp/api/meat/Rcpp_eval.h: Ensure R_BaseEnv is used 2018-06-21 Lionel Henry * inst/include/Rcpp/api/meat/unwind.h: Extract unwind protection from Rcpp::Rcpp_fast_eval() into Rcpp::unwindProtect(). Use this function whenever you need to call a C function that might longjump, for instance a function from R's C API. Rcpp::unwindProtect() will protect your C++ stack and throw a Rcpp::internal::LongJump exception to ensure all destructors are called. The R longjump is then resumed once it is safe to do so. This function powers Rcpp_fast_eval(). You can use Rcpp::unwindProtect() in two ways. First with a C-like callback interface that takes a `SEXP (*)(void* data)` function pointer and a `void*` data argument that is passed to the function. Second, if you have C++11 enabled, Rcpp::unwindProtect() implements an `std::function` overload. You can pass any function object or lambda function with the right signature. * inst/include/Rcpp/api/meat/Rcpp_eval.h: Idem 2018-06-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem 2018-06-13 Filip Schouwenaars * inst/unitTests/runit.embeddedR.R: Evaluate in environment derived of baseenv 2018-06-11 Romain Francois * inst/include/Rcpp/exceptions.h: Control call and stack display after exception / stop * inst/unitTests/cpp/Exceptions_nocall.cpp: new test * inst/unitTests/runit.Exceptions_nocall.R: idem 2018-06-09 Qiang Kou * inst/include/Rcpp/DataFrame.h: Use Rcpp_fast_eval, not Rcpp_eval * inst/include/Rcpp/Environment.h: Idem * inst/include/Rcpp/Function.h: Idem * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/Module.h: Idem * inst/include/Rcpp/Reference.h: Idem * inst/include/Rcpp/exceptions.h: Idem * inst/include/Rcpp/generated/Function__operator.h: Idem * inst/include/Rcpp/proxy/FieldProxy.h: Idem * inst/include/Rcpp/proxy/NamesProxy.h: Idem * inst/include/Rcpp/r_cast.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/examples/SugarPerformance/sugarBenchmarks.R: Idem * inst/unitTests/cpp/language.c: Idem * inst/unitTests/cpp/misc.c: Idem * src/barrier.c: Idem 2018-06-09 Dirk Eddelbuettel * inst/unitTests/runit.embeddedR.R: Suspend test for now 2018-06-08 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h: Idem * Contributing.md: Minor update coding style 2018-06-07 Kevin Ushey * inst/include/Rcpp/config.h: bump dev version 2018-06-06 Kevin Ushey * inst/include/Rcpp/RNGScope.h: Allow suspension of RNG synchronization * inst/include/Rcpp/routines.h: Idem * src/Rcpp_init.cpp: Idem * src/api.cpp: Idem * inst/include/Rcpp/api/meat/Rcpp_eval.h: Evaluate in base env 2018-06-05 Jack Wasey * inst/include/Rcpp/r_cast.h: Error and abort if debugging 2018-06-02 Lionel Henry * inst/unitTests/runit.interface.R: New test for the case where the client package was compiled without protected evaluation enabled. On R 3.5, longjump exceptions thrown from imported functions are still caught and dealt with properly by the client package. * inst/unitTests/runit.interface.R: Test both Rcpp_eval() and Rcpp_fast_eval(). 2018-06-01 Lionel Henry * inst/unitTests/runit.interface.R: New tests for interfaces and unwind. These tests build two packages, and that exports a function via Rcpp::interfaces(cpp) and the other that calls it. The attributes are regenerated and the packages rebuilt each time the tests are run. The tests check in particular that the C++ stack is properly unwound when a long jump occurs. 2018-06-01 Romain Francois * inst/include/Rcpp/Environment.h: Make Environment::new_child() const 2018-05-31 Lionel Henry * inst/include/Rcpp/api/meat/Rcpp_eval.h: Fix protected evaluation. Setting `RCPP_PROTECTED_EVAL` before including Rcpp.h enables a new R 3.5 API for safe evaluation of R code. R longjumps are now correctly intercepted and rethrown. Thanks to this the C++ stack is now safely unwound when a longjump is detected while calling into R code. This includes the following cases: thrown errors, caught condition of any class, long return, restart invokation, debugger exit. Note that this is still experimental! When `RCPP_PROTECTED_EVAL` is enabled, Rcpp_eval() uses the protect-unwind API under the hood in order to gain safety. It is fully backward-compatibile and still catches errors and interrupts to rethrow them as typed C++ exceptions. If you don't need to catch those, consider using Rcpp_fast_eval() instead to avoid the catching overhead. Rcpp_fast_eval() is a wrapper around Rf_eval(). Unlike Rcpp_eval(), it does not evaluate R code within tryCatch() and thus avoids the overhead of wrapping and evaluating the expression in a tryCatch() call. When Rcpp is compiled with a lower version than R 3.5, Rcpp_fast_eval() falls back to Rf_eval() without any protection from long jumps, even when `RCPP_PROTECTED_EVAL` is set. Either add R 3.5 to your `Depends` or make sure the legacy Rcpp_eval() function is called instead of Rcpp_fast_eval() when your package is compiled with an older version of R. Note that Rcpp_fast_eval() behaves a bit differently to Rcpp_eval(). The former has the semantics of the C function Rf_eval() whereas the latter behaves like the R function base::eval(). This has subtle implications for control flow. For instance evaluating a return() expression within a frame environment returns from that frame rather than from the Rcpp_eval() call. * inst/include/Rcpp/macros/macros.h: Leave the try/catch scope before resuming jump to ensure proper destruction of the exception reference. * inst/include/Rcpp/exceptions.h: Functions to create and check a longjump sentinel. This sentinel is used as return value in contexts where it is not safe to resume a jump (i.e. in the glue code of cpp interfaces). * inst/include/Rcpp/macros/macros.h: Return a longjump sentinel in END_RCPP_RETURN_ERROR. * src/attributes.cpp: Detect longjump sentinels and resume jump. 2018-05-27 Romain Francois * inst/include/Rcpp/vector/string_proxy.h: Make StringProxy::operator== const * inst/unitTests/cpp/Vector.cpp: New test * inst/unitTests/runit.Vector.R: Idem 2018-05-09 Filip Schouwenaars * R/Attributes.R: Set local environment in source() * inst/unitTests/cpp/embeddedR.cpp: New test * inst/unitTests/runit.embeddedR.R: Idem 2018-05-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.17 * inst/NEWS.Rd: Release 0.12.17 * inst/bib/Rcpp.bib: Release 0.12.17 * vignettes/Rcpp.bib: Release 0.12.17 * inst/include/Rcpp/config.h: Release 0.12.17 * debian/*: Changes for Debian release of 0.12.16 2018-05-05 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Also mention TAS paper * vignettes/Rcpp-introduction.Rmd: Idem * vignettes/Rcpp-jss-2011.Rnw: Idem 2018-05-04 Romain Francois * inst/include/Rcpp/String.h: Extend StoragePolicy support * inst/include/Rcpp/vector/00_forward_proxy.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/include/Rcpp/vector/const_generic_proxy.h: Idem * inst/include/Rcpp/vector/const_string_proxy.h: Idem * inst/include/Rcpp/vector/generic_proxy.h: Idem * inst/include/Rcpp/vector/proxy.h: Idem * inst/include/Rcpp/vector/string_proxy.h: Idem * inst/include/Rcpp/vector/traits.h: Idem * inst/unitTests/cpp/Vector.cpp: New test * inst/unitTests/runit.Vector.R: Idem 2018-04-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2018-04-25 Romain Francois * inst/include/Rcpp/Benchmark/Timer.h: If defined, undefine FALSE 2018-04-17 Ralf Stubner * vignettes/Rcpp-attributes.Rmd: Replace back-quote with straight quote * vignettes/Rcpp-modules.Rmd: Idem 2018-04-02 Dirk Eddelbuettel * .editorconfig: Added support for editorconfig.org * .clang_format: Removed * .dir-locals.el: Removed 2018-03-31 Dirk Eddelbuettel * inst/include/Rcpp/sprintf.h (Rcpp): Remove parens [gcc8 warning] * vignettes/Rcpp-attributes.Rmd: Update link to JSS intro vignette * vignettes/Rcpp-modules.Rmd: Idem 2018-03-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2018-03-18 Kevin Ushey * inst/include/Rcpp/stats/random/random.h: No inheritance from RNGScope 2018-03-14 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Correct a double-quote (thanks, Joris Meys) 2018-03-08 Peter Hickey * vignettes/Rcpp-attributes.Rmd: Correct stray backslash 2018-03-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.16 * inst/NEWS.Rd: Release 0.12.16 * inst/bib/Rcpp.bib: Release 0.12.16 * vignettes/Rcpp.bib: Release 0.12.16 * inst/include/Rcpp/config.h: Release 0.12.16 * debian/*: Changes for Debian release of 0.12.16 2018-02-07 Kevin Ushey * inst/include/Rcpp/longlong.h: Revised and more general logic for long long on 64bit Windows etc via C++11 and as int64_t alias where possible 2018-03-01 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/complex.h (Rcpp): Remove RCPP_HYPOT macro and use ::hypot() throught as it is provided with C99 * inst/include/Rcpp/sugar/undoRmath.h: Also uncomment pythag here 2018-02-28 Dirk Eddelbuettel * inst/include/Rcpp/Rmath.h (R): Rf_pythag has been remove in R 2.14.0 so comment-out the R::pythag wrapper (per request of Brian Ripley) 2018-02-26 Kevin Ushey * src/api.cpp: Always set / put RNG state when calling Rcpp function 2018-02-25 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated * inst/bib/Rcpp.bib: Idem * vignettes/Rcpp-FAQ.Rmd (Note): Expand conda answer by adding link 2018-02-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version 2018-02-14 Kirill Müller * R/Attributes.R: Code compiled with cppFunction() uses .Call instead of .Primitive(".Call"), #795 2018-02-07 Kevin Ushey * inst/include/Rcpp/longlong.h: Allow long long on 64bit Windows 2018-01-21 Dirk Eddelbuettel * README.md: Added new section 'Support' * vignettes/Rcpp-FAQ.Rmd (vignette): Uppercase index to 'Rcpp-FAQ'; removed reference to Gmane which sadly is no more 2018-01-19 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd (Note): Document the conda package `gxx_linux-64` as helpful in that environment 2018-01-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.15 * inst/NEWS.Rd: Release 0.12.15 * inst/bib/Rcpp.bib: Release 0.12.15 * vignettes/Rcpp.bib: Release 0.12.15 * inst/include/Rcpp/config.h: Release 0.12.15 * debian/*: Changes for Debian release of 0.12.15 2018-01-15 Dirk Eddelbuettel * inst/include/RcppCommon.h: Check for new #define RCPP_USE_UNWIND_PROTECT and unset if defined, this is being be used to "park" code from #789 * inst/include/Rcpp/Environment.h: Ifdef #789 via RCPP_USE_UNWIND_PROTECT * inst/include/Rcpp/Language.h: Idem * inst/include/Rcpp/api/meat/Rcpp_eval.h: Idem * inst/include/Rcpp/exceptions.h: Idem * inst/include/Rcpp/macros/macros.h: Idem * inst/unitTests/runit.stack.R: Ensure test is not running 2018-01-14 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version 0.12.14.8 * inst/include/Rcpp/traits/is_na.h (Rcpp): Also speed up Rcpp::is_na 2018-01-14 Lionel Henry * inst/unitTests/cpp/stack.cpp: Move stack unwinding tests from misc.cpp * inst/unitTests/runit.stack.R: Move stack unwinding tests from misc.R; disaggregate stack unwinding tests; also disable for now 2018-01-11 Kirill Müller * inst/include/Rcpp/traits/is_na.h: Speed up Rcpp::is_na() 2018-01-09 Iñaki Ucar * inst/include/Rcpp/vector/proxy.h: Improve support for NVCC, the CUDA compiler, by making three more methods const 2018-01-06 Kendon Bell * src/api.cpp: Allow for compilation on ANDROID 2017-12-21 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Updated minor version and date 2017-12-21 Kirill Müller * inst/include/Rcpp/internal/wrap.h: Appease gcc-7 with fall-through * inst/include/Rcpp/macros/unroll.h: Idem 2017-12-20 Kirill Müller * inst/include/Rcpp/utils/tinyformat.h: Update to new upstream c42f/tinyformat@8f60162, simplify future updates by separating Rcpp-specific changes (issue #786). 2017-12-19 Kevin Ushey * inst/include/Rcpp/internal/na.h: Remove 'clever' NA / NaN checks 2017-12-16 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Updated minor version and date 2017-12-13 Lionel Henry * inst/include/Rcpp/api/meat/Rcpp_eval.h: Add Rcpp_fast_eval() for safe and fast evaluation of R code using the new protect-unwind API in R 3.5. [ This is however disabled for release 0.12.15. ] * inst/include/Rcpp/exceptions.h: Add LongjumpException and resumeJump() to support Rcpp_fast_eval(). * inst/include/Rcpp/macros/macros.h: Catch LongjumpException and call resumeJump(). If resumeJump() doesn't jump (on old R versions), throw an R error (this normally should not happen). * inst/include/RcppCommon.h: Add Rcpp_fast_eval() to the public API and internal::Rcpp_eval_impl() to the private API. * inst/include/Rcpp/Environment.h: Use safe evaluation * inst/include/Rcpp/Language.h: idem 2017-12-05 Kevin Ushey * inst/include/Rcpp/Environment.h: Use public R APIs * inst/include/Rcpp/api/meat/Environment.h: Idem 2017-12-04 Kevin Ushey * inst/include/Rcpp/RObject.h: Protect temporary wrapped SEXPs * inst/include/Rcpp/api/meat/DataFrame.h: Idem * inst/include/Rcpp/api/meat/Environment.h: Idem * inst/include/Rcpp/api/meat/proxy.h: Idem * inst/include/Rcpp/proxy/ProtectedProxy.h: Idem * inst/include/Rcpp/vector/generic_proxy.h: Idem 2017-12-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version * inst/include/Rcpp/sugar/functions/is_na.h: Correct test for NA to work with new as well as old Date(time)Vectors * inst/unitTests/cpp/dates.cpp (has_na): Added tests * inst/unitTests/runit.Date.R (test.NA): Idem 2017-11-30 James J Balamuta * src/attributes.cpp: Fixed missing Rcpp namespace in export interface generation 2017-11-25 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/exceptions/cpp11/exceptions.h: Ensure Rf_format gets a format string * inst/include/Rcpp/exceptions/cpp98/exceptions.h (Rcpp): Ditto 2017-11-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * vignettes/Rcpp-FAQ.Rmd: Use Rcpp::Rcpp.plugin.maker(), not ':::' 2017-11-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.14 * inst/NEWS.Rd: Release 0.12.14 * inst/bib/Rcpp.bib: Release 0.12.14 * vignettes/Rcpp.bib: Release 0.12.14 * inst/include/Rcpp/config.h: Release 0.12.14 2017-11-04 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Add 'skip_final_break: true' toggle * vignettes/Rcpp-attributes.Rmd: Idem * vignettes/Rcpp-extending.Rmd: Idem * vignettes/Rcpp-modules.Rmd: Idem * vignettes/Rcpp-sugar.Rmd: Idem 2017-10-30 Dirk Eddelbuettel * inst/include/Rcpp.h: Unless RCPP_FORCE_OLD_DATE_DATETIME_VECTORS is defined, define RCPP_NEW_DATE_DATETIME_VECTORS to switch to new date and datetime vector as announced in release 0.12.8 one year ago 2017-10-03 Dirk Eddelbuettel * inst/include/Rcpp/iostream/Rstreambuf.h: White-space edits 2017-10-02 Kirill Müller * inst/include/Rcpp/iostream/Rstreambuf.h: Embed buffer class instance in Rostream to not require run-time allocation, and please Coverity 2017-09-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * DESCRIPTION (Description): Add per suggestion by CRAN * inst/CITATION: Add PeerJ article, add doi info, reindent 2017-09-26 Daniel C. Dillon * inst/include/Rcpp/vector/MatrixRow.h: Added cbegin() / cend() to MatrixRow, and fixing return types * inst/include/Rcpp/vector/VectorBase.h: Ditto 2017-09-24 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.13 * inst/NEWS.Rd: Release 0.12.13 * inst/bib/Rcpp.bib: Release 0.12.13 * inst/include/Rcpp/config.h: Release 0.12.13 2017-09-23 Dirk Eddelbuettel * inst/bib/Rcpp.bib: Updated references * viignettes/Rcpp.bib: Idem 2017-09-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * vignettes/Rcpp-FAQ.Rmd (Rcpp): Add entry for 'symbols not found' error requiring two runs of compileAttributes 2017-09-20 James J Balamuta * vignettes/rcpp-docs.cls: Removed 2017-09-20 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rmd: Modified formatting and cleaned a bit more. * vignettes/Rcpp-sugar.Rmd: Idem * vignettes/Rcpp-introduction.Rmd: Added new PeerJ preprint 2017-09-19 James J Balamuta * vignettes/Rcpp-FAQ.Rmd: Formatted and cleaned up vignette. * vignettes/Rcpp-sugar.Rmd: Idem 2017-09-19 Dirk Eddelbuettel * vignettes/Rcpp-attributes.Rmd: Formatted and cleaned up vignette. * vignettes/Rcpp-extending.Rmd: Idem * vignettes/Rcpp-modules.Rmd: Idem * vignettes/Rcpp-package.Rmd: Idem * vignettes/Rcpp-quickref.Rmd: Idem 2017-09-18 James J Balamuta * DESCRIPTION (Suggests): Added rmarkdown, knitr, and pinp dependencies * .travis.yml: idem * vignettes/Rcpp-quickref.Rmd: Translated vignette from highlight/sweave to RMarkdown for use with the pinp template. * vignettes/Rcpp-sugar.Rmd: Idem * vignettes/Rcpp-package.Rmd: Idem * vignettes/Rcpp-modules.Rmd: Idem * vignettes/Rcpp-FAQ.Rmd: Idem * vignettes/Rcpp-extending.Rmd: Idem * vignettes/Rcpp-attributes.Rmd: Idem 2017-09-18 Daniel C. Dillon * inst/include/Rcpp/vector/MatrixRow.h: Added cbegin() and cend() to the class along with a framework for proper const-correctness in the future. 2017-09-03 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2017-09-02 James J Balamuta * inst/include/Rcpp/vector/VectorBase.h: Defined both iterator AND const_iterator for future considerations. Currently, as before, only const_iterator is available (though it used to be called iterator). Added cbegin() and cend() functions. We should revisit whether there should be a non-const iterator on VectorBase in the future. * inst/include/Rcpp/vector/Matrix.h: Added cbegin() and cend() functions. Iterator defintions inherited from Vector are appropriate. * inst/include/Rcpp/vector/MatrixColumn.h: Added cbegin() and cend() functions. Iterator definitions inherited from Vector are appropriate because Matrix is column-major. * inst/include/Rcpp/vector/Vector.h: Added cbegin() and cend() functions. Iterators are appropriate minus the problem with the const proxy class of objects (which may or may not actually be const depending on which one). * inst/include/Rcpp/vector/traits.h: Removed (accidentally) some some trailing whitespace on lines. 2017-09-02 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor version * vignettes/Rcpp-jss-2011.Rnw: Renamed again from Rcpp-introduction-2011, added reference to new Rcpp-introduction * inst/bib/Rcpp.bib: Merged bibliography from new vignette; also added PeerJ Preprint with new Rcpp Introduction 2017-09-01 Dirk Eddelbuettel * vignettes/Rcpp-introduction.Rnw: New introductory vignette from PeerJ preprints but typeset 'more nicely' * vignettes/rcpp-docs.cls: New LaTeX style file derived from pnas-new and its supporting files * vignettes/figures/: Three support figures for new vignette * vignettes/intro2Rcpp.bib: New bibliography * vignettes/Rcpp-introduction-2011.Rnw: Renamed from from Rcpp-introduction 2017-08-26 Dirk Eddelbuettel * .travis.yml (before_install): Use https for curl fetch 2017-08-14 James J Balamuta * vignettes/Rcpp-FAQ.Rnw: Sunset macOS documentation dealing with toolchains by redirecting to the R Installation and Administration manual * vignettes/.gitignore: Added various LaTeX build artifacts to ignore. 2017-08-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version and date * inst/include/Rcpp/XPtr.h: Whitespace only-changes 2017-08-04 Lei Yu * inst/include/Rcpp/Module.h: Correct one closing parenthesis 2017-07-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.12 * inst/NEWS.Rd: Release 0.12.12 * inst/bib/Rcpp.bib: Release 0.12.12 * inst/include/Rcpp/config.h: Release 0.12.12 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.12 2017-07-10 Jeff Pollock * inst/include/Rcpp/Module.h: Avoid unused variable warning * inst/include/Rcpp/Module_generated_Constructor.h: Ditto 2017-07-09 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Ditto * inst/NEWS.Rd: Added missing entries 2017-07-08 Kirill Müller * inst/include/Rcpp/vector/no_init.h: Accept R_xlen_t instead of int * inst/include/Rcpp/internal/wrap.h: Use R_xlen_t not int in loop unroll * inst/include/Rcpp/macros/unroll.h: Ditto * inst/include/Rcpp/vector/Vector.h: Ditto 2017-07-05 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Ditto 2017-07-02 JJ Allaire * src/attributes.cpp: Generate C++ native routines with underscore prefix to avoid export when standard exportPattern is used in NAMESPACE 2017-06-29 JJ Allaire * src/attributes.cpp: Replace dot (".") with underscore ("_") in package names when generating native routine registrations. 2017-06-27 Jeroen Ooms * inst/include/RcppCommon.h: Support attribute_visible macro 2017-06-17 Kirill Müller * inst/include/Rcpp/Dimension.h: Explicit cast to int * inst/include/Rcpp/exceptions.h: Don't declare unused arguments * src/attributes.cpp: Ditto 2017-06-14 JJ Allaire * src/attributes.cpp: Add Shield around parameters in Rcpp::interfaces 2017-06-07 Dirk Eddelbuettel * README.md: Use alternates for img.shields.io GPL-2+ badges 2017-06-06 Yu Gong * src/api.cpp: Also permit compilation under Haiku-OS 2017-06-04 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * man/Rcpp.plugin.maker.Rd: Update manual page to additional Imports argument 2017-06-02 JJ Allaire * src/attributes.cpp: Automatically register init functions for RcppModules * R/Rcpp.package.skeleton.R: compileAttributes only after all code is generated 2017-06-01 JJ Allaire * src/attributes.cpp: Fix registration for exports with name attribute. 2017-05-30 Dirk Eddelbuettel * inst/include/Rcpp/utils/tinyformat.h: Added missing newline 2017-05-23 JJ Allaire * R/Attributes.R: Execute tools::package_native_routine_registration_skeleton within package rather than current working directory. * src/attributes.cpp: Execute tools::package_native_routine_registration_skeleton within package rather than current working directory. 2017-05-22 Dirk Eddelbuettel * R/inline.R (Rcpp.plugin.maker): Whitespace changes 2017-05-20 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.11 * inst/NEWS.Rd: Release 0.12.11 * inst/bib/Rcpp.bib: Release 0.12.11 * inst/include/Rcpp/config.h: Release 0.12.11 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.10 2017-05-19 Dirk Eddelbuettel * inst/NEWS.Rd: Removed one duplicate entry * inst/include/Rcpp/api/meat/Rcpp_eval.h (Rcpp): Minor whitespace changes 2017-05-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll Date and Version once more * inst/NEWS.Rd: Updated * R/Attributes.R (.plugins[["openmp"]]): Fix typo in comment * src/attributes.cpp (Rcpp): Use size_t (twice) to suppress nags from g++ 2017-05-16 JJ Allaire * R/Attributes.R: Automatically generate native routine registrations. * src/attributes.cpp: Automatically generate native routine registrations. * R/Rcpp.package.skeleton.R: Don't generate native routines when creating a package using attributes. 2017-05-09 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Under R 3.4.0, run tools::package_native_routine_registration_skeleton to create src/init.c 2017-05-07 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version again * inst/include/Rcpp/module/Module_Property.h: Remove two typed exception specifications which upset g++ 7.1 or higher 2017-05-05 Kirill Müller * inst/include/Rcpp/date_datetime/Date.h: Suppress -Wconversion warnings * inst/include/Rcpp/date_datetime/Datetime.h: Idem * inst/include/Rcpp/date_datetime/newDateVector.h: Idem * inst/include/Rcpp/date_datetime/newDatetimeVector.h: Idem * inst/include/Rcpp/sugar/functions/rowSums.h: Idem * inst/include/Rcpp/sugar/functions/sample.h: Idem * inst/include/Rcpp/sugar/functions/strings/trimws.h: Idem 2017-04-26 Dirk Eddelbuettel * inst/include/Rcpp/exceptions.h (string_to_try_error): Protect result from Rf_mkString 2017-04-25 Dirk Eddelbuettel * R/Attributes.R (.plugins[["cpp11"]]): If R 3.4.0 or newer is used, set USE_CXX11 (instead of the older USE_CXX1X); (.plugins[["cpp14"]]): similarly updated for C++14 (.plugins[["cpp17"]]): similarly updated for C++17 (.plugins[["cpp98"]]): added 2017-04-22 Nathan Russell * inst/include/Rcpp/sugar/functions/strings/trimws.h: Added sugar function trimws with unit tests * inst/include/Rcpp/sugar/functions/strings/strings.h: Idem * inst/unitTests/cpp/sugar.cpp: Idem * inst/unitTests/runit.sugar.R: Idem 2017-04-20 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem * inst/include/Rcpp/exceptions/cpp98/exceptions.h (RCPP_ADVANCED_EXCEPTION_CLASS): Suppressing some warnings 2017-04-20 James J Balamuta * inst/include/Rcpp/api/meat/DottedPairImpl.h: Corrected format specifier from '%s' to '%i'. 2017-04-18 James J Balamuta * inst/include/Rcpp/vector/Matrix.h: Corrected exception throws from not_compatible to not_a_matrix. * inst/include/Rcpp/S4.h: Fixed documentation detailing exception class throw. * inst/include/Rcpp/Environment.h: Improved error handling messages * inst/include/Rcpp/Function.h: idem * inst/include/Rcpp/Promise.h: idem * inst/include/Rcpp/String.h: idem * inst/include/Rcpp/Symbol.h: idem * inst/include/Rcpp/XPtr.h: idem * inst/include/Rcpp/as.h: idem * inst/include/Rcpp/r_cast.h: idem * inst/include/Rcpp/api/meat/DottedPairImpl.h: idem * inst/include/Rcpp/internal/export.h: idem * inst/include/Rcpp/proxy/DottedPairProxy.h: idem * inst/include/Rcpp/proxy/SlotProxy.h: idem * inst/include/Rcpp/vector/MatrixColumn.h: idem * inst/include/Rcpp/vector/MatrixRow.h: idem * inst/include/Rcpp/vector/Vector.h: idem 2017-04-17 James J Balamuta * inst/include/Rcpp/Rcpp/exceptions/cpp11/exceptions.h: Removed semicolons from RCPP_ADVANCED_EXCEPTION_CLASS to quiet 'extra ;' -Wpedantic * inst/include/Rcpp/exceptions.h: Modified exceptions macros to support a default string and removed generated stop, warning from file. * inst/include/Rcpp/Rcpp/exceptions/cpp98/exceptions.h: Contains generated RCPP_ADVANCED_EXCEPTION_CLASS macro, stop & warning. * inst/include/Rcpp/Rcpp/exceptions/cpp11/exceptions.h: idem but for variadic versions. * inst/include/Rcpp/utils/tinyformat.h: Enabled ability to use variadic tinyformat function if c++11 is detected. 2017-04-14 James J Balamuta * inst/include/Rcpp/utils/tinyformat.h: Refreshed tinyformat.h against May 13, 2016 upstream, retained local mods. 2017-04-14 Kirill Müller * inst/include/Rcpp/macros/macros.h: Remove unused variable warning in BEGIN_RCPP macro * inst/include/Rcpp/DataFrame.h: Explicitly call parent constructor * inst/include/Rcpp/sugar/functions/rep.h: Remove variable name in function declaration to suppress unused argument warning * src/Rcpp_init.cpp: Ditto * src/attributes.cpp: Ditto 2017-04-11 Dirk Eddelbuettel * inst/inst/unitTests/testRcppClass/src/init.c (R_init_testRcppClass): Call R_registerRoutines() and R_useDynamicSymbols(); also ensure _rcpp_module_boot_* is registered for each module * inst/unitTests/testRcppClass/NAMESPACE: Added registration * inst/unitTests/testRcppClass/DESCRIPTION (Title): Title case * inst/unitTests/testRcppClass/R/rcpp_hello_world.R (rcpp_hello_world): Call the renamed C++ function * inst/unitTests/testRcppClass/src/rcpp_hello_world.cpp (rcpp_hello_world_cpp): Renamed C++ function to be distinct from R function calling it * inst/unitTests/testRcppClass/src/rcpp_hello_world.h: Ditto * inst/unitTests/testRcppClass/man/rcpp_hello_world.Rd: Alias renamed C++ function 2017-04-09 Dirk Eddelbuettel * inst/unitTests/testRcppModule/src/init.c (R_init_testRcppModule): Call R_registerRoutines() and R_useDynamicSymbols(); also ensure _rcpp_module_boot_* is registered for each module * inst/unitTests/testRcppModule/NAMESPACE: Added registration * inst/unitTests/testRcppModule/DESCRIPTION (Title): Title case * inst/unitTests/testRcppModule/R/rcpp_hello_world.R (rcpp_hello_world): Call the renamed C++ function * inst/unitTests/testRcppModule/src/rcpp_hello_world.cpp (rcpp_hello_world_cpp): Renamed C++ function to be distinct from R function calling it * inst/unitTests/testRcppModule/src/rcpp_hello_world.h: Ditto * inst/unitTests/testRcppModule/man/rcpp_hello_world.Rd: Alias renamed C++ function * inst/unitTests/testRcppModule/man/Rcpp_modules_examples.Rd: Alias renamed modules * inst/unitTests/testRcppModule/tests/modules.R: Call renamed module 2017-04-03 Jim Hester * inst/include/Rcpp/exceptions.h: Added support for throwing exceptions without call stacks. * inst/include/Rcpp/macros/macros.h: Idem * inst/unitTests/cpp/exceptions.cpp: Idem * inst/unitTests/runit.exceptions.R: Idem 2017-03-28 James J Balamuta * inst/vignettes/Rcpp-FAQ.Rnw: Added "Known Issues" section to FAQ 2017-03-25 Dirk Eddelbuettel * LICENSE: Added * .Rbuildignore: Do not include LICENSE in package 2017-03-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.10 * inst/NEWS.Rd: Release 0.12.10 * inst/bib/Rcpp.bib: Release 0.12.10 * inst/include/Rcpp/config.h: Release 0.12.10 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.10 2017-03-15 Jeroen Ooms * inst/include/Rcpp/XPtr.h: added finalizeOnExit parameter 2017-02-28 Dirk Eddelbuettel * src/Rcpp_init.cpp (R_init_Rcpp): Call R_useDynamicSymbols() * DESCRIPTION (Version, Date): New minor version 2017-02-25 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: New subsection on C++11, C++14, C++17 2017-02-17 Dirk Eddelbuettel * R/tools.R: More #nocov * inst/include/Rcpp/internal/r_vector.h: Idem 2017-02-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New minor version 2017-02-14 Iñaki Ucar * inst/include/Rcpp/iostream/Rstreambuf.h: Fixed single-character handling (pull request #649, fixes issue #647) 2017-02-13 Dirk Eddelbuettel * R/Attributes.R (.plugins[["cpp17"]]): New plugin (.plugins[["cpp1z"]]): Idem 2017-02-04 Daniel C. Dillon * inst/include/Rcpp/algorithm.h: Improved setup for Intel's icc 2017-01-31 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * inst/include/Rcpp/algorithm.h: Allow algorithm.h to be compiler under Intel's compiler, add copyright header and include guard 2017-01-31 Nathan Russell * inst/include/Rcpp/sugar/matrix/upper_tri.h: Inherit from MatrixBase and use correct comparators in get() to fix segfault * inst/include/Rcpp/sugar/matrix/lower_tri.h: Idem * inst/unitTests/cpp/sugar.cpp: Added unit tests for upper_tri and lower_tri * inst/unitTests/runit.sugar.R: Idem 2017-01-23 James J Balamuta * inst/include/Rcpp/DataFrame.h: Corrected return type for column size. 2017-01-22 Dirk Eddelbuettel * inst/include/Rcpp/DataFrame.h: Simplified and removed deprecation language. 2017-01-21 James J Balamuta * inst/include/Rcpp/DataFrame.h: Added alias for column and row size * inst/unitTests/runit.DataFrame.R: Added unit tests for aliases * inst/unitTests/cpp/DataFrame.cpp: Idem 2017-01-17 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version and Date * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Roll minor * src/Date.cpp (Rcpp): Do not access tm_gmtoff on Solaris 2017-01-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.9 * inst/NEWS.Rd: Release 0.12.9 * inst/bib/Rcpp.bib: Release 0.12.9 * inst/include/Rcpp/config.h: Release 0.12.9 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.9 2017-01-13 Dirk Eddelbuettel * inst/include/Rcpp/exceptions.h: Added more #nocov tags * inst/include/Rcpp/api/bones/wrap_extra_steps.h: Idem * inst/include/Rcpp/iostream/Rstreambuf.h: Idem * inst/include/Rcpp/traits/named_object.h: Idem * inst/include/Rcpp/r_cast.h: Idem * src/Module.cpp: Idem 2017-01-12 Dirk Eddelbuettel * inst/bib/Rcpp.bib: Moved from vignettes/ directory * R/bib.R (bib): Idem * vignettes/Rcpp-FAQ.Rnw: Evaluate \Sexpr{Rcpp:::bib()} * vignettes/Rcpp-attributes.Rnw: Idem * vignettes/Rcpp-extending.Rnw: Idem * vignettes/Rcpp-introduction.Rnw: Idem * vignettes/Rcpp-modules.Rnw: Idem * vignettes/Rcpp-packages.Rnw: Idem * vignettes/Rcpp-sugar.Rnw: Idem * inst/unitTests/runit.misc.R (test.bib): New test * R/exceptions.R: Added #nocov 2017-01-11 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated references * src/attributes.cpp (Rcpp): Correct typos in #nocov tags, added tags 2017-01-07 James J Balamuta * inst/include/Rcpp/sugar/functions/complex.h: Added Arg() function * inst/unitTests/runit.sugar.R: Added Arg() unit test to complex list * inst/unitTests/cpp/sugar.cpp: Idem 2017-01-06 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Mark new minor version * src/attributes.cpp: Additional nocov tags 2017-01-04 Dirk Eddelbuettel * src/Date.cpp (Rcpp): Protect assignment to tm_gmtoff to not being under MinGW; could potentially bite other too-limited systems * inst/unitTests/runit.Date.R (test.Datetime.formating): Do not set TZ when running test, only set digits option 2017-01-01 Dirk Eddelbuettel * inst/unitTests/runit.Date.R (test.mktime, test.gmtime): New tests * inst/unitTests/cpp/dates.cpp (test_mktime, test_gmtime): Idem 2016-12-31 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Minor simplification 2016-12-31 James J Balamuta * inst/include/Rcpp/vector/Matrix.h: Fixed non-symmetric case of matrix fills by switching to a loop based solution from iterator. * inst/unitTests/runit.Matrix.R: Added unit tests for diagonally filling matrices. * inst/unitTests/cpp/Matrix.cpp: Idem 2016-12-30 Dirk Eddelbuettel * src/Date.cpp: Synchronized internal code with R * inst/unitTests/cpp/dates.cpp (gmtime_mktime): New test * inst/unitTests/runit.Date.R (test.mktime_gmtime): Idem 2016-12-26 Dirk Eddelbuettel * R/Attributes.R: Added #nocov markers * R/Module.R: Idem * R/exposeClass.R: Idem, added copyright header 2016-12-25 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * src/api.cpp: Added #nocov markers * src/Rcpp_init.cpp: Idem * src/Date.cpp: Date 2016-12-14 Nathan Russell * inst/include/Rcpp/sugar/functions/sample.h: Use vector instead of manual memory management. 2016-12-13 Nathan Russell * inst/include/Rcpp/sugar/functions/sample.h: Use malloc.h instead of alloca.h when building on Windows * inst/include/Rcpp/date_datetime/Date.h: Include time.h when building on Windows * inst/include/Rcpp/date_datetime/Datetime.h: Idem 2016-12-12 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/sample.h: In case sample.h from the RcppArmadillo extensions was included, skip this file 2016-12-10 Nathan Russell * inst/include/Rcpp/sugar/functions/sample.h: New function sample() * inst/include/Rcpp/sugar/functions/functions.h: Idem * inst/unitTests/cpp/sugar.cpp: Unit tests for sample() * inst/unitTests/runit.sugar.R: Idem 2016-12-10 Dirk Eddelbuettel * R/loadRcppModules.R: Added #nocov tags * R/loadModule.R: Ditto * R/unit.tests.R (test): Adjusted one #nocov tag 2016-12-09 Dirk Eddelbuettel * R/00_classes.R: Added #nocov tags * R/01_show.R: Ditto * R/02_completion.R: Ditto * R/03_prompt.R: Ditto 2016-12-07 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Add 'using ...' to disambiguate size() 2016-12-04 Dirk Eddelbuettel * .codecov.yml (comment): Enable more verbose codecov.io reports 2016-12-03 Dirk Eddelbuettel * inst/unitTests/cpp/dates.cpp (Datetime_format): Additional ostream tests * inst/unitTests/runit.Date.R (test.Date.formating): Ditto * inst/unitTests/runit.system.R (test.RcppCxx): New tests * R/RcppLdpath.R (canUseCXX0X): Simplified as we can now rely on more modern compilers; underlying C++ code has not been present for a while * R/compilerCheck.R (compilerCheck): Added some #nocov tags * R/unit.tests.R (test, gctortureRUnitTest): Ditto * R/zzz.R (.onLoad): Ditto 2016-11-29 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version to 0.12.8.2 2016-11-28 Dirk Eddelbuettel * inst/unitTests/cpp/dates.cpp (Date_format, Datetime_format): New tests * inst/unitTests/runit.Date.R (test.Date.formating): Ditto (test.Datetime.formating): Ditto * inst/unitTests/runit.sugar.R (test.intersect): Added sort() around call to Sugar's intersect to ensure sorted output with g++-6.* 2016-11-27 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/Date.h (format, operator<<): Added * inst/include/Rcpp/date_datetime/Datetime.h (format, operator<<): Ditto * inst/include/Rcpp/date_datetime/newDateVector.h (operator<<): Ditto * inst/include/Rcpp/date_datetime/newDatetimeVector.h (operator<<): Ditto 2016-11-23 Dirk Eddelbuettel * inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Set minor version 2016-11-22 Dirk Eddelbuettel * DESCRIPTION (Date, Version): Roll minor version * inst/include/Rcpp/date_datetime/newDatetimeVector.h (Rcpp): Small correction concerning timezone attribute to ctor from RTYPE 2016-11-22 Jim Hester * inst/src/api.cpp: Cleanup to stack message parseing * inst/unitTests/cpp/exceptions.cpp: Unit tests for cleanup * inst/unitTests/runit.exceptions.R: Ditto 2016-11-19 James J Balamuta * inst/unitTests/runit.environments.R: Added environment find unit tests as well as a symbol access test for environment get. * inst/unitTests/cpp/Environment.cpp: Idem 2016-11-18 James J Balamuta * vignettes/Rcpp-extending: Switched to attributes and added external class pointer macro notes by MathurinD 2016-11-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.8 * inst/NEWS.Rd: Release 0.12.8 * vignettes/Rcpp.bib: Release 0.12.8 * inst/include/Rcpp/config.h: Release 0.12.8 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.8 2016-11-15 Dirk Eddelbuettel * DESCRIPTION: Nathan Russell added to Authors 2016-11-14 Jim Hester * inst/include/Rcpp/exceptions.h: Improved exception call stack * inst/include/Rcpp/routines.h: Ditto * inst/src/api.cpp: Ditto * R/exections.R: Print and format method for stack straces * inst/unitTests/runit.exceptions.R: Unit tests * inst/unitTests/cpp/exceptions.cpp: Ditto 2016-11-13 Dirk Eddelbuettel * R/Attributes.R (mergeIntoBuildEnv): Correct 'empty' return 2016-11-10 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/newDateVector.h: Added constructor using VectorBase<> 2016-11-05 Daniel C. Dillon * inst/include/Rcpp/date_datetime/newDatetimeVector.h: Added constructor to instantiate newDatetimeVector from VectorBase. 2016-11-04 Nathan Russell * inst/include/Rcpp/macros/dispatch.h: Modify variadic macros to not use GNU extensions * DESCRIPTION: roll minor version 2016-11-03 Nathan Russell * inst/include/Rcpp/hash/IndexHash.h: Add casts to eliminate signed / unsigned comparison warning * inst/include/Rcpp/hash/SelfHash.h: Idem * inst/unitTests/cpp/sugar.cpp: Added unit tests for sugar function unique() * inst/unitTests/runit.sugar.R: Idem 2016-10-30 Dirk Eddelbuettel * src/api.cpp: New capabilities field for new date(time) vectors * inst/unitTests/runit.Date.R (test.DatetimeVector.ctor): Differentiate in test as case of 'Inf' is handling differently by new and old datetime classes (and passed through as is by new ones which is better) * inst/unitTests/runit.InternalFunctionCPP11.R: Small cosmetic edit 2016-10-24 Qiang Kou * inst/include/Rcpp/sugar/Range.h : fix range sugar ambiguity * inst/unitTests/cpp/sugar.cpp: range sugar unit test * inst/unitTests/runit.sugar.R: range sugar unit test 2016-10-24 Nathan Russell * inst/include/Rcpp/vector/MatrixBase.h: Change sugar functions eye(), ones(), and zeros() into static methods in MatrixBase * inst/include/Rcpp/traits/one_type.h: Idem * inst/include/Rcpp/traits/traits.h: Idem * inst/unitTests/cpp/Matrix.cpp: Idem * inst/unitTests/runit.Matrix.R: Idem 2016-10-24 Qiang Kou * inst/include/Rcpp/sugar/Range.h: Range sugar uses R_xlen_t as start/end type 2016-10-23 Nathan Russell * inst/include/Rcpp/sugar/matrix/eye.h: New functions eye(), ones(), and zeros() * inst/include/Rcpp/sugar/matrix/matrix_functions.h: Idem * inst/unitTests/cpp/sugar.cpp: Unit tests for new functions * inst/unitTests/runit.sugar.R: Idem * inst/unitTests/runit.dispatch.R (test.ExpressionVector): Use expression rather than parse, correct typo 2016-10-22 Qiang Kou * inst/include/Rcpp/hash/IndexHash.h: change hashing function to return unsigned int * inst/include/Rcpp/hash/SelfHash.h: Ditto 2016-10-21 Qiang Kou * inst/include/Rcpp/barrier.h: Change string_elt/vector_elt to accept R_xlen_t * inst/include/Rcpp/routines.h: Ditto * src/barrier.cpp: Ditto 2016-10-19 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/Datetime.h (Rcpp): Additional operator+ for int argument 2016-10-18 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/Date.h (Rcpp): Add operator double() * inst/include/Rcpp/date_datetime/Datetime.h (Rcpp): Ditto 2016-10-17 Dirk Eddelbuettel * inst/include/Rcpp/date_datetime/newDatetimeVector.h (Rcpp): Allow setting of timezone attribute; default not-set leads to local as in R 2016-10-16 Dirk Eddelbuettel * inst/include/Rcpp.h (RCPP_NEW_DATE_DATETIME_VECTORS): Add a new compile-time #define to switch between 'old' (existing) and 'new' DateVector and DatimeVector classes. Currently uses 'new' for testing plan to switch to proper deprecation schedule. * inst/include/Rcpp/date_datetime/date_datetime.h: New header file (and directory) regrouping all Date and Datetime headers, scalar and vector * inst/include/Rcpp/date_datetime/Date.h: Moved one directory down * inst/include/Rcpp/date_datetime/Datetime.h: Ditto * inst/include/Rcpp/date_datetime/oldDateVector.h: Moved and renamed * inst/include/Rcpp/date_datetime/oldDatetimeVector.h: Ditto * inst/include/Rcpp/date_datetime/newDateVector.h: New implementation inheriting from NumericVector, still optional * inst/include/Rcpp/date_datetime/newDatetimeVector.h: Ditto 2016-09-05 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor version * cleanup: Clean two more file type from vignettes/ 2016-09-04 Nathan Russell * inst/include/Rcpp/sugar/functions/rowSums.h: New functions rowSums(), colSums(), rowMeans(), and colMeans() * inst/include/Rcpp/sugar/functions/functions.h: Idem * inst/unitTests/cpp/sugar.cpp: Unit tests for new functions * inst/unitTests/runit.sugar.R: Idem 2016-09-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.7 * inst/NEWS.Rd: Release 0.12.7 * vignettes/Rcpp.bib: Release 0.12.7 * inst/include/Rcpp/config.h: Release 0.12.7 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.7 2016-09-02 Simon Dirmeier * src/attributes.cpp: Remove leading underscore in header guard 2016-08-14 James J Balamuta * inst/examples/FastLM/lmGSL.R: Updated example to use new GSL templates 2016-08-11 Dirk Eddelbuettel * .travis.yml: Switch to using run.sh for Travis CI 2016-08-09 Artem Klevtsov * inst/include/Rcpp/macros/dispatch.h: Add variadic conditional macro when C++11 compiler used * ints/include/unitTests/cpp/dispatch.cpp: Add unit tests for RCPP_RETURN_VECTOR and RCPP_RETURN_MATRIX macro * ints/include/unitTests/runit.dispatch.R: Idem 2016-08-05 James J Balamuta * inst/examples/FastLM/fastLMviaArmadillo.r: format fix * inst/examples/FastLM/lmGSL.R: Updated example to use Rcpp attributes instead of cxxfunction * inst/examples/FastLM/lmArmadillo.R: Idem * inst/examples/functionCallback/newApiExample.r: Idem * inst/examples/RcppInline/RcppInlineExample.r: Idem * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: Idem * inst/examples/RcppInline/UncaughtExceptions.r: Idem * inst/examples/RcppInline/external_pointer.r: Idem 2016-08-04 James J Balamuta * src/attributes.cpp: Correct variable re-declaration * inst/examples/RcppGibbs/RcppGibbs.R: Updated example to use Rcpp attributes instead of cxxfunction * inst/examples/RcppGibbs/timeRNGs.R: Idem 2016-08-03 Dirk Eddelbuettel * .gitattributes: Added to have ChangeLog and NEWS.Rd merge via union 2016-08-02 James J Balamuta * R/Rcpp.package.skeleton.R: Added autogeneration warning * src/attributes.cpp: Fixed invalid C++ Identifiers and modified export header to warn against hand edits * vignettes/Rcpp-package.Rnw: Updated code generation snippets * man/Rcpp.package.skeleton.Rd: Add warning on hand edits to the autogenerated RcppExports files. * man/compileAttributes.Rd: Idem 2016-08-02 Qiang Kou * inst/include/Rcpp/String.h: CE_UTF8 as default encoding * inst/unitTests/cpp/String.cpp: Update unit test * inst/unitTests/runit.String.R: Idem 2016-08-01 Nathan Russell * inst/include/Rcpp/vector/Vector.h: Added decreasing option for Vector sort * inst/include/Rcpp/internal/NAComparator.h: Idem * inst/unitTests/cpp/Vector.cpp: Idem * inst/unitTests/runit.Vector.R: Idem 2016-07-31 Qiang Kou * inst/examples/SugarPerformance/sugarBenchmarks.R: Remove usage of Rf_eval * inst/include/Rcpp/Environment.h: Idem * inst/include/Rcpp/Module.h: Idem * inst/include/Rcpp/exceptions.h: Idem * inst/include/Rcpp/proxy/FieldProxy.h: Idem * inst/include/Rcpp/r_cast.h: Idem * inst/unitTests/cpp/language.cpp: Idem * src/barrier.cpp: Idem 2016-07-24 Dirk Eddelbuettel * inst/unitTests/cpp/rmath.cpp: Added RNG unit tests for sugar variants * inst/unitTests/runit.rmath.R: Idem 2016-07-22 James J Balamuta * inst/unitTests/cpp/rmath.cpp: Added unit tests for Rmath RNGs * inst/unitTests/runit.rmath.R: idem * inst/include/Rcpp/Environment.h: Added get() & find() that accept a symbol * inst/include/Rcpp.h: Modified header load order so that Symbol.h is now placed before Environment.h 2016-07-21 Dirk Eddelbuettel * DESCRIPTION (Version): Roll minor release 2016-07-18 Kevin Ushey * inst/include/Rcpp/r/headers.h: Ensure NORET macro is set appropriately 2016-07-18 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.6 * inst/NEWS.Rd: Release 0.12.6 * vignettes/Rcpp.bib: Release 0.12.6, RProtoBuf updates * inst/include/Rcpp/config.h: Release 0.12.6 * README.md: Updated counts for dependents and tests * debian/*: Changes for Debian release of 0.12.5 2016-07-17 James J Balamuta * vignettes/Rcpp-quickref.Rnw: Added sections on Rcpp attributes and plugins. Facelifts on important notes, inline, environments, and calling R functions. 2016-07-16 Daniel C. Dillon * Added a const_interator typedef to VectorBase 2016-07-15 James J Balamuta * vignettes/Rcpp-FAQ.Rnw: Added section on default function parameters 2016-07-15 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Also point to Rcpp-attributes in Question 1 2016-07-13 Dirk Eddelbuettel * NAMESPACE: Add import for glob2rx to please R CMD check * man/cppFunction.Rd: line break below 90 columns to please R CMD check 2016-07-11 J.J. Allaire * R/Attributes.R Add cacheDir argument to sourceCpp to enable caching of shared libraries across R sessions * src/attributes.cpp Add cacheDir argument to sourceCpp to enable caching of shared libraries across R sessions * man/sourceCpp.Rd: Document new cacheDir option * man/cppFunction.Rd: Idem * man/evalFunction.Rd: Idem 2016-07-10 Nathan Russell * inst/include/Rcpp/algorithm.h: Accomodate clang compiler 2016-07-03 Dirk Eddelbuettel * DESCRIPTION (Version): Rolling minor version 2016-07-02 Qiang Kou * src/attributes.cpp: Replace '.' in package names 2016-06-23 Dirk Eddelbuettel * DESCRIPTION (Version): Rolling minor version * inst/include/Rcpp/exceptions.h (Rcpp): Also expose Rf_warningcall() within Rcpp namespace (without leading Rf_) 2016-06-20 Qin Wenfeng * inst/include/Rcpp/exceptions.h: add RCPP_USING_UTF8_ERROR_STRING macro to use UTF-8 encoding exception string in R 2016-06-14 Artem Klevtsov * inst/include/Rcpp/sugar/functions/na_omit.h: Improve na_omit for vectors without NA * inst/unitTests/cpp/sugar.cpp: Add unit test for the na_omit * inst/unitTests/runit.sugar.R: Ditto 2016-06-02 Kirill Müller * inst/include/Rcpp/algorithm.h: Use "long long" only if available * inst/include/Rcpp/exceptions.h: Annotate stop() with NORET 2016-05-18 Daniel C. Dillon * inst/include/Rcpp/algorithm.h: New approach for sugar * inst/unitTests/cpp/algorithm.cpp: Unit test support * inst/unitTests/runit.algorithm.R: Ditto 2016-05-17 Dirk Eddelbuettel * DESCRIPTION (Version): Rolling minor version 2016-05-16 Qiang Kou * inst/include/Rcpp/String.h: Correct string replacement * inst/unitTests/runit.String.R: Unit test 2016-05-16 Daniel C. Dillon * inst/include/Rcpp/sugar/functions/max.h: Fixing constness * inst/include/Rcpp/sugar/functions/min.h: Ditto 2016-05-15 Daniel C. Dillon * inst/include/Rcpp/vector/Matrix.h: Correcting ambiguities in Vector/Matrix and scalar operations * inst/include/Rcpp/sugar/operators/divides.h: Ditto * inst/include/Rcpp/sugar/operators/minus.h: Ditto * inst/include/Rcpp/sugar/operators/plus.h: Ditto * inst/include/Rcpp/sugar/operators/times.h: Ditto 2016-05-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.5 * inst/NEWS.Rd: Release 0.12.5 * vignettes/Rcpp.bib: Release 0.12.5 * inst/include/Rcpp/config.h: Release 0.12.5 * debian/*: Changes for Debian release of 0.12.5 * vignettes/Rcpp.bib: Updated references 2016-05-13 Dirk Eddelbuettel * DESCRIPTION: Rolled minor version * R/compilerCheck.R: Minimal R function to check g++ version sufficiency * man/compilerCheck.Rd: Documentation 2016-05-11 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Modified to create a package without notes, warnings, or error even pkgKitten is not available * R/Rcpp.package.skeleton.R (.playWithPerPackageHelpPage): Added new helper function to be used when pkgKitten is not available * inst/skeleton/manual-page-stub.Rd: Stub for per-package help page used when pkgKitten is not available 2016-05-10 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Also correct Title: and Description: to satisfy R CMD check in R-release and (current) R-devel 2016-05-08 Dirk Eddelbuettel * inst/unitTests/cpp/Matrix.cpp: Made four scalar/matrix tests less ambiguous for overloads by using double as scalar 2016-05-06 Dirk Eddelbuettel * R/loadRcppModules.R (loadRcppModules): Add call to .Deprecated pointing out that loadModule is preferred * man/Rcpp-deprecated.Rd: Added to list deprecated functions * man/loadRcppModules-deprecated.Rd: Renamed to -deprecated, added link to loadModule which is the preferred method * vignettes/Rcpp-modules.Rnw: Updated with respect to loadRcppModules deprecation and loadModule being preferred 2016-04-15 Kevin Ushey * src/attributes.cpp: Add a missing 'winslash = "/"' 2016-04-14 J.J. Allaire * src/attributes.cpp: Correct handling of dependent file paths on Windows (use winslash = "/") 2016-04-13 Dirk Eddelbuettel * DESCRIPTION (Version): Rolling minor version and Date 2016-04-11 Ben Goodrich * R/Module.R: Avoid calling as.character() on C++Object to prevent race 2016-04-02 Dirk Eddelbuettel * DESCRIPTION: Rolled to minor version 0.12.4.3 * inst/include/Rcpp/config.h: Ditto * ChangeLog: Added entries for PRs 453 and 454 * inst/NEWS.Rd: Add two missing \item uses * R/Module.R: Rename copy to copyObject to avoid function name collisions * inst/unitTests/runit.Module.R: Ditto * man/copyObject.Rd: Ditto * inst/NEWS.Rd: Ditto * NAMESPACE: Ditto * inst/unitTests/runit.environments.R: Skip test.environment.child test 2016-03-31 Romain Francois * R/Modules.R: New top-level functions copy, destruct and is_destructed * NAMESPACE: New functions copy, destruct and is_destructed exported * man/copy.Rd: New manual page * man/destruct.Rd: Ditto * inst/include/Rcpp/module/class.h: Add copy constructortor + destructor * inst/include/Rcpp/module/class_Base.h: Ditto * src/Module.cpp: Ditto * src/Rcpp_init.cpp: Ditto * src/internal.h: Ditto * inst/include/Rcpp/traits/traits.h: New trait detecting copy contructor * inst/include/Rcpp/traits/has_copy_constructor.h: Ditto * inst/unitTests/runit.Module.R: Test new copy constructor and destructor * inst/unitTests/cpp/Module.cpp: Ditto 2016-03-29 Daniel C. Dillon * inst/include/Rcpp/String.h: Correct Rcpp::String for Rcpp::Nullable 2016-03-27 Qin Wenfeng * R/Attributes.R: Support new R 3.3.0 Windows toolchain 2016-03-26 Dirk Eddelbuettel * DESCRIPTION: Rolled Date and minor Version 2016-03-23 Sergio Marques * src/api.cpp: Also check a flag __MUSL__ to accomodate Alpine 2016-03-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.4 * inst/NEWS.Rd: Release 0.12.4 * vignettes/Rcpp.bib: Release 0.12.4 * inst/include/Rcpp/config.h: Release 0.12.4 * debian/*: Changes for Debian release of 0.12.4 2016-03-19 Dirk Eddelbuettel * README.md: Use canonical CRAN URL to please R-devel CMD check 2016-03-12 Nathan Russell * inst/include/Rcpp/sugar/functions/cbind.h: Undefine MakeBindable macro after use 2016-03-12 Nathan Russell * inst/include/Rcpp/sugar/functions/cbind.h: New cbind() function * inst/include/Rcpp/sugar/functions/functions.h: Idem * inst/unitTests/cpp/sugar.cpp: Unit tests for cbind() * inst/unitTests/runit.sugar.R: Idem 2016-03-09 Colin Gillespie * vignettes/Rcpp-sugar.Rnw: Correct typos and indentation 2016-03-09 Dirk Eddelbuettel * inst/include/Rcpp/stats/random/rlogis.h: Updated Emacs header and copyright, aligned indentation * inst/include/Rcpp/stats/random/rnbinom.h: Idem * inst/include/Rcpp/stats/random/rnbinom_mu.h: Idem * inst/include/Rcpp/stats/random/rnchisq.h: Idem * inst/include/Rcpp/stats/random/rnorm.h: Idem * inst/include/Rcpp/stats/random/rt.h: Idem * inst/include/Rcpp/stats/random/runif.h: Idem * inst/include/Rcpp/stats/random/rweibull.h: Idem * inst/include/Rcpp/stats/random/random.h: Idem * inst/include/Rcpp/stats/random/rcauchy.h: Idem * inst/include/Rcpp/stats/random/rchisq.h: Idem * inst/include/Rcpp/stats/random/rexp.h: Idem * inst/include/Rcpp/stats/random/rf.h: Idem * inst/include/Rcpp/stats/random/rgeom.h: Idem * inst/include/Rcpp/stats/random/rlnorm.h: Idem * inst/include/Rcpp/stats/random/rbeta.h: Idem * inst/include/Rcpp/stats/random/rbinom.h: Idem * inst/include/Rcpp/stats/random/rgamma.h: Idem * inst/include/Rcpp/stats/random/rhyper.h: Idem * inst/include/Rcpp/stats/random/rpois.h: Idem * inst/include/Rcpp/stats/random/rsignrank.h: Idem * inst/include/Rcpp/stats/random/rwilcox.h: Idem 2016-03-07 Dirk Eddelbuettel * inst/include/Rcpp/stats/beta.h: Updated Emacs header and copyright * inst/include/Rcpp/stats/binom.h: Idem * inst/include/Rcpp/stats/cauchy.h: Idem * inst/include/Rcpp/stats/chisq.h: Idem * inst/include/Rcpp/stats/f.h: Idem * inst/include/Rcpp/stats/gamma.h: Idem * inst/include/Rcpp/stats/geom.h: Idem * inst/include/Rcpp/stats/hyper.h: Idem * inst/include/Rcpp/stats/nbeta.h: Idem * inst/include/Rcpp/stats/nbinom.h: Idem * inst/include/Rcpp/stats/nbinom_mu.h: Idem * inst/include/Rcpp/stats/nchisq.h: Idem * inst/include/Rcpp/stats/nf.h: Idem * inst/include/Rcpp/stats/nt.h: Idem * inst/include/Rcpp/stats/pois.h: Idem * inst/include/Rcpp/stats/stats.h: Idem * inst/include/Rcpp/stats/t.h: Idem * inst/include/Rcpp/stats/unif.h: Idem * inst/include/Rcpp/stats/dpq/dpq.h: Idem 2016-03-05 Dirk Eddelbuettel * inst/include/Rcpp/stats/exp.h: Replaced initial Emacs header line with current one, ran M-x untabify, streamlined indentation, update copyright * inst/include/Rcpp/stats/lnorm.h: Idem * inst/include/Rcpp/stats/logis.h: Idem * inst/include/Rcpp/stats/norm.h: Idem * inst/include/Rcpp/stats/weibull.h: Idem 2016-03-04 Dirk Eddelbuettel * inst/unitTests/runit.Function.R: Switched to '/usr/bin/env r' * inst/unitTests/runit.table.R: Idem * inst/unitTests/runit.as.R: Idem * inst/unitTests/runit.Date.R: Idem * inst/unitTests/runit.misc.R: Idem * inst/unitTests/runit.Language.R: Idem * inst/unitTests/runit.subset.R: Idem * inst/unitTests/runit.wrap.R: Idem * inst/unitTests/runit.sugar.R: Idem * inst/unitTests/runit.na.R: Idem * inst/unitTests/runit.String.R: Idem * inst/unitTests/runit.Vector.R: Idem * inst/unitTests/runit.environments.R: Idem * inst/unitTests/runit.Reference.R: Idem * inst/unitTests/runit.Matrix.R: Idem * inst/unitTests/runit.client.package.R: Idem * inst/unitTests/runit.binary.package.R: Idem * inst/unitTests/runit.support.R: Idem * inst/unitTests/runit.S4.R: Idem * inst/unitTests/runit.RObject.R: Idem * inst/unitTests/runit.modref.R: Idem * inst/unitTests/runit.InternalFunctionCPP11.R: Idem * inst/unitTests/runit.attributes.R: Idem * inst/unitTests/runit.sugar.var.R: Idem * inst/unitTests/runit.Module.R: Idem * inst/unitTests/runit.XPTr.R: Idem * inst/unitTests/runit.Module.client.package.R: Idem * inst/unitTests/runit.stats.R: Idem * inst/unitTests/runit.rmath.R: Idem * inst/unitTests/runit.DataFrame.R: Idem * inst/unitTests/runit.wstring.R: Idem * inst/unitTests/runit.InternalFunction.R: Idem 2016-03-03 Dirk Eddelbuettel * inst/examples/FastLM/benchmarkLongley.r: Switched to '/usr/bin/env r' * inst/examples/FastLM/fastLMviaArmadillo.r: Idem * inst/examples/FastLM/fastLMviaGSL.r: Idem * inst/examples/FastLM/lmArmadillo.R: Idem * inst/examples/FastLM/lmGSL.R: Idem * inst/examples/FastLM/benchmark.r: Idem * inst/examples/ConvolveBenchmarks/exampleRCode.r: Idem 2016-02-27 Dirk Eddelbuettel * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: Switched to using '/usr/bin/env r', switch to using 'cxxfunction' and RcppGSL plugin * inst/examples/RcppInline/external_pointer.r: Switched to '/usr/bin/env r' * inst/examples/RcppInline/RcppInlineExample.r: Idem * inst/examples/ConvolveBenchmarks/overhead.r: Idem * inst/include/Rcpp/Fast.h (Rcpp): Undo two const declarations 2016-02-23 Dirk Eddelbuettel * inst/examples/OpenMP/OpenMPandInline.r: Switched to '/usr/bin/env r' * inst/examples/RcppInline/RcppSimpleExample.r: Idem * inst/examples/RcppInline/RObject.r: Idem * inst/examples/RcppInline/UncaughtExceptions.r: Idem 2016-02-21 Dirk Eddelbuettel * inst/examples/functionCallback/newApiExample.r (vecfunc): Switched to using '/usr/bin/env r', switch to using 'cxxfunction' * inst/examples/Misc/fibonacci.r: Switched to using '/usr/bin/env r', added explicit load of Rcpp package * inst/examples/Misc/newFib.r: Switched to using '/usr/bin/env r' * inst/examples/Misc/ifelseLooped.r: Idem * inst/examples/Misc/piBySimulation.r: Idem * inst/examples/SugarPerformance/sugarBenchmarks.r: Idem 2016-02-16 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Added answer on fixed-size limit of arguments 2016-02-07 Dirk Eddelbuettel * R/Attributes.R (sourceCppFunction): Use fully matched seq(along.with=...) * vignettes/Rcpp-FAQ.Rnw: Added a table of contents 2016-02-06 James J Balamuta * vignettes/Rcpp-FAQ.Rnw (Rcpp): Additional material, and corrections, for use on OS X 2016-01-30 Qiang Kou * inst/include/Rcpp/vector/Subsetter.h: Fix the error under gc * inst/unitTests/cpp/Vector.cpp : Add tests * inst/unitTests/runit.Vector.R : Idem 2016-01-29 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw (Rcpp): Add new entry about required TeXlive installation to build vignettes (issue #422) 2016-01-22 Dirk Eddelbuettel * DESCRIPTION (Version): Mark as 0.12.3.1 2016-01-22 Daniel C. Dillon * R/Attributes.R: Add plugin for cpp14 2016-01-18 Daniel C. Dillon * inst/include/Rcpp/Nullable.h: Add isUsable() * inst/unitTests/cpp/misc.cpp: Add tests * inst/unitTests/runit.misc.R: Idem 2016-01-17 Nathan Russell * inst/include/Rcpp/sugar/functions/median.h: New function * inst/unitTests/cpp/sugar.cpp: Add tests * inst/unitTests/runit.sugar.R: Idem 2016-01-17 Daniel C. Dillon * inst/include/Rcpp/Nullable.h: Add as() and clone() * inst/unitTests/cpp/misc.cpp: Add tests * inst/unitTests/runit.misc.R: Idem 2016-01-13 Kirill Mueller * inst/include/Rcpp/Nullable.h: Added const support * inst/unitTests/cpp/misc.cpp: Added tests for const support 2016-01-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.3 * inst/NEWS.Rd: Release 0.12.3 * vignettes/Rcpp.bib: Release 0.12.3 * inst/include/Rcpp/config.h: Release 0.12.3 * debian/*: Changes for Debian release of 0.12.3 * vignettes/Rcpp.bib: Updated all CRAN reference to current versions 2016-01-09 Dirk Eddelbuettel * Contributing.md: Added to GitHub repo * .Rbuildignore: Ensure Contributing.md is not in R package, also removed two old entries 2015-12-29 Joshua Pritikin * inst/include/Rcpp/Module.h: Initialize base class in copy ctor * inst/include/Rcpp/macros/interface.h: Idem 2015-12-12 Qiang Kou * inst/include/Rcpp/String.h: std::hash * inst/unitTests/cpp/wrap.cpp: Unit tests * inst/unitTests/runit.wrap.R: Unit tests 2015-12-04 Qiang Kou * inst/include/Rcpp/vector/Matrix.h: Add math operators between matrix and scalar * inst/unitTests/runit.Matrix.R: Unit tests * inst/unitTests/cpp/Matrix.cpp: Unit tests 2015-11-27 Daniel C. Dillon * inst/include/Rcpp/vector/proxy.h: const_iterators for CharacterVector now work analogously to iterators * inst/include/Rcpp/vector/const_generic_proxy.h: Idem * inst/include/Rcpp/vector/const_string_proxy.h: Idem * inst/include/Rcpp/vector/traits.h: Idem * inst/unitTests/cpp/Vector.cpp: Tests for above * inst/unitTests/runit.Vector.R: Idem [ All this was commited on Sep 5 but only merged Nov 27 ] 2015-11-25 JJ Allaire * src/attributes.cpp: Avoid invalid function names when generating C++ interfaces. 2015-11-15 Kazuki Fukui > * src/attributes.cpp: Insert extra space around & in interface 2015-11-14 Dirk Eddelbuettel * .travis.yml: Add token for secure Slack & Travis integration 2015-11-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.2 * inst/NEWS.Rd: Release 0.12.2 * vignettes/Rcpp.bib: Release 0.12.2 * inst/include/Rcpp/config.h: Release 0.12.2 * debian/*: Changes for Debian release of 0.12.2 * vignettes/Rcpp.bib: Updated all CRAN reference to current versions 2015-11-13 Dirk Eddelbuettel * inst/include/Rcpp/complex.h: Define a header guard for dplyr to prevent errorneous redefinition of operator<<() via dplyr 2015-11-11 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Further simplification 2015-11-11 Qiang Kou * include/Rcpp/complex.h: operator<< for Rcomplex 2015-11-10 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Added transpose for character matrices as well * inst/unitTests/runit.Matrix.R: New unit tests * inst/unitTests/cpp/Matrix.cpp: Ditto 2015-11-08 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Matrix transpose is now a free function for both INTSXP and REALSXP * inst/unitTests/runit.Matrix.R: New unit tests * inst/unitTests/cpp/Matrix.cpp: Ditto 2015-11-08 Daniel C. Dillon * inst/include/Rcpp/Nullable.h: No longer prevent assignment of R_NilValue to Nullable<> in function signatures * inst/include/Rcpp/vector/Matrix.h: Use showpoint in operator<<() 2015-11-07 Dirk Eddelbuettel * inst/include/Rcpp/vector/Matrix.h: Beginnings of a Matrix transpose 2015-11-06 Kevin Ushey * inst/include/Rcpp/vector/Subsetter.h: Add sugar math operators * inst/unitTests/runit.subset.R: Unit tests * inst/unitTests/cpp/Subset.cpp: Unit tests * inst/NEWS.Rd: NEWS entry 2015-11-01 Qiang Kou * inst/include/Rcpp/vector/MatrixColumn.h: Fix overflow 2015-11-01 Dirk Eddelbuettel * DESCRIPTION: Roll Version: to 0.12.1.4 2015-10-30 Nathan Russell * inst/include/Rcpp/sugar/functions/cummax.h: New sugar function * inst/include/Rcpp/sugar/functions/cummin.h: New sugar function * inst/include/Rcpp/sugar/functions/cumprod.h: New sugar function * inst/unitTests/cpp/sugar.cpp: Unit test support for new functions * inst/unitTests/runit.sugar.R: Ditto 2015-10-08 Tianqi Chen * inst/include/Rcpp/api/meat/is.h: Enhance the check for Rcpp Module objects (PR #381 fixing #380) 2015-10-01 JJ Allaire * src/attributes.cpp: Enable export of C++ interface for functions that return void 2015-09-28 Dirk Eddelbuettel * inst/NEWS.Rd: GitHub pull requests and issues are now linked * src/barrier.cpp: Use SET_STRING_ELT() on LHS (with thanks to Luke) 2015-09-21 Dirk Eddelbuettel * inst/include/Rcpp/String.h: Before assigning ensure we received exactly one string argument 2015-09-10 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.1 * inst/NEWS.Rd: Release 0.12.1 * vignettes/Rcpp.bib: Release 0.12.1 * inst/include/Rcpp/config.h: Release 0.12.1 * debian/*: Changes for Debian release of 0.12.1 2015-09-09 Dirk Eddelbuettel * vignettes/Rcpp-attributes.Rnw: Less harsh grey border around code * vignettes/Rcpp-*.Rnw: Ditto * inst/include/Rcpp/String.h: More comparison operators 2015-09-08 Daniel C. Dillon * inst/include/Rcpp/vector/string_proxy.h: More comparison operators * inst/include/Rcpp/vector/const_string_proxy.h: More comparison operators 2015-09-08 Florian Plaza Onate * inst/include/Rcpp/Dimension.h: Correct creation and access of large matrices * inst/include/Rcpp/vector/Matrix.h: Ditto 2015-09-07 Dirk Eddelbuettel * inst/include/Rcpp/Nullable.h: New class for objects which may be NULL * inst/unitTests/cpp/Vector.cpp: Unit tests for Nullable * inst/unitTests/runit.Vector.R: Ditto 2015-09-06 Daniel C. Dillon * inst/include/Rcpp/String.h: Make strings and string_proxies comparable * inst/unitTests/cpp/String.cpp: Unit tests for above * inst/unitTests/runit.String.R: Ditto 2015-09-05 Daniel C. Dillon * inst/include/Rcpp/vector/Matrix.h: Matrix now has appropriate operator<< * inst/include/Rcpp/vector/Vector.h: Vector now has appropriate operator<< * inst/unitTests/cpp/Vector.cpp: Unit tests for above 2015-09-01 Florian Plaza Onate * inst/include/Rcpp/vector/Subsetter.h: Allow logical subsets to be assigned to a vector of size 1 (pull request #349, discussed in issue #345) * inst/unitTests/cpp/Subset.cpp: Add unit test for above * inst/unitTests/runit.subset.R: Ditto 2015-08-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll Version and Date 2015-08-30 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated RcppGSL entry 2015-08-29 Dirk Eddelbuettel * vignettes/Rcpp.bib: Add RcppZiggurat entry * inst/include/Rcpp/utils/tinyformat.h: Updated to current upstream version keeping our local modifications / adaptations (PR #357) 2015-08-29 Qiang Kou * inst/include/Rcpp/vector/Subsetter.h: Enable logical subsetting on both LHS and RHS, eg 'a[b > 3] = b[b > 3]' (pull request #352 addressing issue #345) * inst/unitTests/cpp/Subset.cpp: Ditto * inst/unitTests/runit.subset.R: Unit tests for above 2015-08-26 Dirk Eddelbuettel * inst/unitTests/testRcppClass/src/rcpp_module.cpp: Renamed Module 'World' to 'RcppClassWorld' to avoid multiple modules with same name (pull request #351, fixed issue #350) * inst/unitTests/testRcppClass/man/Rcpp_class_examples.Rd: Ditto * inst/unitTests/testRcppClass/R/load.R: Ditto * inst/unitTests/testRcppClass/NAMESPACE: Ditto * inst/unitTests/runit.Module.client.package.R: Re-enable test * inst/unitTests/testRcppModule/src/rcpp_module.cpp: Renamed Module 'World' to 'RcppModuleWorld' to avoid multiple modules with same name * inst/unitTests/cpp/modref.cpp: Rename 'World' to 'ModRefWorld' * inst/unitTests/runit.modref.R (test.modRef): Ditto * inst/unitTests/cpp/Module.cpp: Rename 'World' to 'ModuleWorld' * inst/unitTests/runit.Module.R (test.Module): Ditto 2015-08-25 Kurt Hornik * R/loadModule.R: For now=TRUE, always set .botched to FALSE which corresponds to the case of the methods package being in the search path * inst/include/Rcpp/Reference.h: Call call with the internal Namespace 2015-08-24 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated R / R Core references 2015-08-23 Romain Francois * inst/include/Rcpp/Benchmark/Timer.h: Silence 'g++ -pedantic' by replaceing one R_xlen_t by size_t (pull request #348) 2015-08-19 Florian Plaza Onate * inst/include/Rcpp/vector/Vector.h: Add 'at' methods which implement accessors with bounds cheking (pull request #342, fixes issue #341) * inst/include/Rcpp/vector/Matrix.h: Ditto * inst/unitTests/cpp/Vector.cpp: Add unit tests for at acessors * inst/unitTests/cpp/Matrix.cpp: Ditto * inst/unitTests/runit.Vector.R: Ditto * inst/unitTests/runit.Matrix.R: Ditto 2015-08-18 Dirk Eddelbuettel * inst/unitTests/runit.Module.client.package.R: Disabled for bad interaction of Rcpp Modules and R 3.2.2 2015-08-15 Florian Plaza Onate * inst/include/Rcpp/vector/converter.h: Correct conversion from const char argument (pull request #344, fixes issue #343) 2015-08-14 Florian Plaza Onate * inst/include/Rcpp/vector/DimNameProxy.h: Add assignment operator, refactor code, update error message formatting (pull request #339) 2015-08-05 Kevin Ushey * src/api.cpp: use `_WIN32` instead of `WIN32` 2015-08-02 Dirk Eddelbuettel * R/Attributes.R (sourceCpp): In no-rebuild-needed case, also set a default directory restoration via on.exit() (pull request #335, addressing issue #309) 2015-07-24 Dirk Eddelbuettel * DESCRIPTION: Release 0.12.0 * inst/NEWS.Rd: Release 0.12.0 * vignettes/Rcpp.bib: Release 0.12.0 * inst/include/Rcpp/config.h: Release 0.12.0 * debian/*: Changes for Debian release of 0.12.0 2015-07-23 Dirk Eddelbuettel * inst/include/Rcpp/Symbol.h: Use Rf_installChar(x) instead of Rf_install(CHAR(X)) if R 3.2.0 or later is used 2015-07-07 Qiang Kou * src/include/Rcpp/String.h: Ensure proper initialization of String objects from two constructors * inst/unitTests/cpp/String.cpp: New unit test * inst/unitTests/runit.String.R: Ditto 2015-07-21 Kevin Ushey * inst/include/Rcpp/api/meat/Rcpp_eval.h: don't use 'CDDDR' 2015-07-20 Dirk Eddelbuettel * DESCRIPTION: Rolled minor Date and Version * R/Attributes.R: Use explicit 'utils::assignInMyNamespace' * R/Rcpp.package.skeleton.R: Use explicit 'utils::package.skeleton' 2015-07-17 JJ Allaire * Rcpp.Rproj: don't use devtools mode in RStudio (enables the Test Package command to invoke the RUnit based test-suite) * src/attributes.cpp: Correctly handle signature termination characters ('{' or ';') contained in quotes 2015-07-16 Kevin Ushey * inst/include/Rcpp/api/meat/Rcpp_eval.h: Don't use 'R_ToplevelExec'; ensure Rcpp_eval respects previously established handlers. Capture errors + interrupts with R-level 'tryCatch'. * inst/NEWS.Rd: Add news entry 2015-07-14 JJ Allaire * src/attributes.cpp: fix crash on second call to sourceCpp 2015-07-07 Qiang Kou * src/include/Rcpp/String.h: Use Rcpp_PreserveObject and Rcpp_ReplaceObject to protect underlying SEXP inside String objects 2015-07-07 Matt P. Dziubinski * inst/include/Rcpp/sugar/functions/var.h: Variance -- changed from the unstable formula back to the stable (two-pass) formula, fixed support for complex numbers (formula correction). * inst/unitTests/runit.sugar.var.R: Added tests for complex variance computation, applied simple code refactoring. 2015-07-04 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated reference to several CRAN packages 2015-07-02 Kevin Ushey * .clang_format: Added 2015-06-25 Kevin Ushey * inst/include/Rcpp/api/meat/Rcpp_eval.h: reset error after Rcpp_eval * inst/unitTests/cpp/Function.cpp: unit tests * inst/unitTests/runit.Function.R: unit tests * inst/include/Rcpp/Function.h: catch empty error messages * inst/include/Rcpp/api/meat/Rcpp_eval.h: protect call 2015-06-24 Qiang Kou * inst/include/Rcpp/String.h: Support encodings * src/String.cpp: Ditto * inst/unitTests/runit.String.R: Add unit tests 2015-06-18 Dirk Eddelbuettel * R/Attributes.R (evalCpp): Add support for plugings argument * man/evalCpp.Rd: Document argument 2015-06-07 JJ Allaire * src/attributes.cpp: Don't load sourceCpp dynamic library if it's already been loaded 2015-06-05 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Remove `character.only=TRUE` from `requireNamespace()` as it happens to flip the boolean value too 2015-06-03 Qiang Kou * inst/include/Rcpp/*: Finish changing R_len_t to R_xlen_t * src/*: Ditto 2014-05-27 Romain Francois * inst/include/Rcpp/DataFrame.h: Safe DataFram constructor 2015-05-16 Qiang Kou * inst/include/Rcpp/*: Begin changing R_len_t to R_xlen_t * src/*: Ditto 2015-05-17 Matt P. Dziubinski * inst/include/Rcpp/platform/compiler.h: Added RCPP_USING_CXX0X_OR_LATER * inst/include/Rcpp/sugar/functions/sapply.h: Updated to support lambda functions 2015-05-01 Kevin Ushey * vignettes/Rcpp-FAQ.Rnw: Notes on installing gfortran 2015-05-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.6 * inst/NEWS.Rd: Release 0.11.6 * inst/include/Rcpp/config.h: Release 0.11.6 * debian/*: Changes for Debian release of 0.11.6 2015-04-27 JJ Allaire * src/Module.cpp: Revert parts of PR291 pertaining to Modules and {BEGIN/END}_RCPP * inst/include/Rcpp/api/meat/module/Module.h: Ditto * inst/include/Rcpp/InternalFunctionWithStdFunction.h: Ditto * inst/include/Rcpp/module/Module_generated_CppFunction.h: Ditto * inst/include/Rcpp/module/class.h: Ditto 2014-04-25 Romain Francois * inst/include/Rcpp/vector/Vector.h: update the parameterization of Vector cache * inst/include/Rcpp/vector/traits.h: ... * inst/include/Rcpp/vector/00_forward_proxy.h: ... * inst/unitTests/runit.Vector.R: test for above changes * inst/unitTests/cpp/Vector.cpp: ... 2015-04-22 Kevin Ushey * inst/include/Rcpp/utils/tinyformat.h: don't use C++11 features 2015-04-14 Dirk Eddelbuettel * .travis.yml (sudo): Adding 'sudo: required' to force older Travis backend 2014-04-14 Romain Francois * inst/include/Rcpp/api/meat/is.h: added is__simple * inst/include/Rcpp/config.h: not using floating point arithmetic in preprocessor 2015-04-12 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Also load Rcpp to make cppFunction visible 2014-04-11 Romain Francois * inst/include/Rcpp/macros/macros.h: Reworked BEGIN_RCPP and END_RCPP * inst/include/Rcpp/*: Removed BEGIN_RCPP and END_RCPP from a few files * src/Module.cpp: But added here 2015-04-19 Jonathan Marshall * inst/include/Rcpp/vector/string_proxy.h: Adds empty() constructor * inst/include/Rcpp/vector/const_string_proxy.h: Ditto 2015-03-18 Dmitrii Meleshko * inst/include/Rcpp/vector/Matrix.h: Added default ctor for 0x0 matrix 2015-03-18 JJ Allaire * R/Attributes.R: Revert to use of gcc 4.6.3 with Rtools 3.3 2015-03-16 JJ Allaire * src/attributes.cpp: Fix failing local include test (normalize path of base source file so comparisons work on Windows). 2015-03-15 Dirk Eddelbuettel * R/Attributes.R (.rtoolsPath): Replace trimws() use with a local variant 2015-03-11 JJ Allaire * R/Attributes.R: Rtools 3.3 is now located and used for compilation under R 3.2. 2015-03-11 Kevin Ushey * inst/include/RcppCommon.h: Move headers into major/minor protection * inst/include/Rcpp/r/headers.h: New file 2015-03-04 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.5 * inst/NEWS.Rd: Release 0.11.5 * inst/include/Rcpp/config.h: Release 0.11.5 * debian/*: Changes for Debian release of 0.11.5 2015-03-03 Dirk Eddelbuettel * inst/include/Rcpp/routines.h: Additional application of the 'attribute_hidden' macro for a number of routines in Rcpp::internal 2015-03-02 Dirk Eddelbuettel * inst/include/Rcpp/print.h (Rcpp): New inline function Rcpp::print() * inst/include/RcppCommon.h: Include new header * src/api.cpp: Commented-out print() in global namespace * src/Rcpp_init.cpp: Commented-out registration of print() * inst/include/Rcpp/routines.h: Commented-out initialization 2015-03-01 Dirk Eddelbuettel * src/api.cpp: New function print() as a wrapper around Rf_PrintValue() * src/Rcpp_init.cpp: Corresponding registration for print() * inst/include/Rcpp/routines.h: Corresponding initialization 2015-02-25 Dirk Eddelbuettel * inst/include/Rcpp/routines.h: Use the 'attribute_hidden' define from the R header R_ext/Visibility.h to protect symbols (cf #264) * inst/include/RcppCommon.h: Also include R_ext/Visibility.h 2015-02-24 JJ Allaire * src/attributes.cpp: Guard against includes referencing themselves (and thus creating an endless loop of include processing); Process attributes in included files; Automatically build implementation files (*.cc; *.cpp) corresponding to local header files if they exist. 2015-02-20 Lionel Henry * inst/include/Rcpp/Function.h New Function constructors that will perform function-lookup in an environment or in a namespace. 2015-02-19 Dirk Eddelbuettel * DESCRIPTION: Bump Version: and Date: 2015-02-19 Lionel Henry * inst/include/Rcpp/Environment.h Allow new_env() to create an environment with a specified parent 2015-02-19 JJ Allaire * vignettes/Rcpp-attributes.Rnw: Add note on using inline keyword from shared header files. 2015-02-17 JJ Allaire * vignettes/Rcpp-attributes.Rnw: Update attributes vignette with docs on new features. 2015-02-14 JJ Allaire * src/attributes.cpp: Allow includes of local files (e.g. #include "foo.hpp") in sourceCpp * Rcpp.Rproj: Specify Sweave as Rnw handler for RStudio * vignettes/*.Rnw: Add driver magic comment and turn off Sweave concordance. * vignettes/.gitignore: Ignore artifacts of PDF preview 2015-02-13 Dirk Eddelbuettel * .travis.yml (install): Switch to using ppa:edd/misc to install all the R packages needed for the Travis CI run as r-cran-* binary packages 2015-02-13 JJ Allaire * src/attributes.cpp: Allow 'R' to come immediately after '***' for defining embedded R code chunks in sourceCpp 2015-02-12 JJ Allaire * DESCRIPTION: bump version * src/attributes.cpp: Add rng parameter to Rcpp::export to prevent inclusion of RNGScope in generated code; recognize Rtools 3.2 2015-02-06 Kevin Ushey * inst/include/Rcpp/vector/Subsetter.h: compare CHARSXP pointers rather than string contents in subsetter 2015-02-03 JJ Allaire * src/attributes.cpp: Simplify generated attributes code for RNGScope (use RObject and it's destructor rather than SEXP protect/unprotect). * vignettes/Rcpp-package.Rnw: Update docs on generated code. 2015-02-03 JJ Allaire * inst/include/Rcpp/exceptions.h: Add Rcpp::warning function as wrapper for Rf_warning 2014-02-03 JJ Allaire * inst/include/Rcpp/XPtr.h: Improvements to XPtr including new checked_get and release functions and improved behavior (throw an exception rather than crash) when a NULL external pointer is dereferenced. * inst/unitTests/runit.XPTr.R: tests for XPtr improvements. * inst/unitTests/cpp/XPtr.cpp: tests for XPtr improvements. 2014-02-03 JJ Allaire * R/Attributes.R: Include pkg_types.h file in RcppExports.cpp if it's present in inst/include or src * src/attributes.cpp: Include pkg_types.h file in generated C++ interface file if it's present in inst/include or src 2015-02-02 JJ Allaire * R/exceptions.R: Evaluate R code within an R_toplevelExec block * include/Rcpp/api/meat/Rcpp_eval.h: Evaluate R code within an R_toplevelExec block 2015-01-25 Kevin Ushey * inst/include/Rcpp/utils/tinyformat.h: define an error handler for tinyformat (using ::Rcpp::stop) to not spill assert 2015-01-20 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.4 * inst/NEWS.Rd: Release 0.11.4 * inst/include/Rcpp/config.h: Release 0.11.4 * debian/*: Changes for Debian release of 0.11.4 2015-01-19 Kevin Ushey * inst/include/Rcpp/r/headers.h: move R headers inclusion to own file; move sysmacros.h workarounds to here * inst/include/RcppCommon.h: idem * inst/include/Rcpp/platform/sysmacros.h: idem 2015-01-19 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated to current package versions * vignettes/getCurrentVersionsOfCitedPackages.R: New helper function * .Rbuildignore: Added vignettes/getCurrentVersionsOfCitedPackages.R * R/unit.tests.R (test): Use requireNamespace() instead of require() * R/unit.tests.R (test): Ditto 2015-01-19 Wush Wu * inst/include/Rcpp/sugar/functions/var.h: Support four vector types * inst/unitTests/runit.sugar.var.R: Added corresponding tests 2015-01-16 Kevin Ushey * inst/include/Rcpp/String.h: fix push_front() * inst/unitTests/runit.String.R: test * inst/unitTests/cpp/String.cpp: test 2015-01-15 Kevin Ushey * inst/include/Rcpp/platform/sysmacros.h: remove leaked macros 'major', 'minor', 'makedev' from * inst/include/RcppCommon.h: ditto * inst/unitTests/cpp/Vector.cpp: simple test 2015-01-08 Dirk Eddelbuettel * inst/examples/OpenMP/GNUmakefile: Renamed from Makefile because it contains GNU make extentions (which we happen to like) * inst/examples/ConvolveBenchmarks: Ditto 2015-01-02 Kevin Ushey * inst/include/Rcpp/sugar/functions/setdiff.h: fix for setequals * inst/unitTests/cpp/sugar.cpp: unit tests * inst/unitTests/runit.sugar.R: unit tests 2015-01-01 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/mean.h: Return type is double, not storage type; also added logical vector case; also added integer case to correctly deal with NA values * inst/unitTests/runit.sugar.R: Added unit tests for new sugar mean() * inst/unitTests/cpp/sugar.cpp: C++ side of new unit tests 2014-12-31 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/mean.h: Support int and complex 2014-12-30 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/mean.h: Use two-pass method 2014-12-29 Kevin Ushey * inst/include/Rcpp/macros/macros.h: reformat for legibility 2014-12-11 Yixuan Qiu * inst/include/Rcpp/internal/r_vector.h: Internal functions to help detect unqualified vector types for sorting, with the help of Romain Francois * inst/include/Rcpp/vector/Vector.h: Disallow sorting on List, RawVector and ExpressionVector, from the discussion with Dirk Eddelbuettel and Kevin Ushey 2014-11-30 Romain Francois * inst/include/Rcpp/vector/proxy.h: Const iteration correction * inst/include/Rcpp/sugar: Ditto in three files 2014-11-25 Dirk Eddelbuettel * inst/include/Rcpp/grow.h: Apply additional Shield<> use around tail object as suggested by Martin Morgan on the rcpp-devel list 2014-11-24 Dirk Eddelbuettel * inst/include/Rcpp/config.h: Release version is still 0.11.3 2014-11-23 Dirk Eddelbuettel * inst/include/Rcpp/config.h: New macro RcppDevVersion to account for four-part development versions such as the current 0.11.3.2 * DESCRIPTION: Version incremented to 0.11.3.2 2014-11-23 Romain Francois * inst/include/Rcpp/exceptions.h: Richer formatting for Rcpp::stop * inst/include/Rcpp/utils/tinyformat.h: Backend for formattinh * inst/unitTests/runit.misc.R: Added new unit test * inst/unitTests/cpp/misc.cpp: C++ backend for test 2014-11-19 Dirk Eddelbuettel * .travis.yml: Temporary stop-gap measure of setting CRAN to something other than the RStudio CDN which currently has DNS issue * inst/include/Rcpp/internal/NAComparator.h: Support sorting of complex numbers, thanks to patch by Yixuan Qiu (in PR #202) 2014-11-08 Kevin Ushey * R/Attributes.R: Fix regular expression used to find source files for compileAttributes 2014-11-02 Dirk Eddelbuettel * inst/unitTests/RcppTestA: Rename to inst/unitTests/testRcppPackage * inst/unitTests/testRcppPackage: Updated throughout * inst/include/Rcpp/Rmath.h: As suggested by Kevin, test for R_VERSION via #define to conditon on R >= 3.1.2 -- this does not require a hard constraint in DESCRIPTION yet on newer R will get R::[dpq]nbinom_mu() 2014-11-01 Dirk Eddelbuettel * src/api.cpp: Do not include execinfo.h on AIX, per r-devel discussion with Mike Beddo, and http://sf.net/p/predef/wiki/OperatingSystems/ 2014-10-29 Dirk Eddelbuettel * inst/include/Rcpp/Rmath.h: Comment out R::[dpqr]nbinom_mu functions as not declared by R with Rf_* name-mapping prefixes 2014-10-17 Chenliang Xu * R/Attributes: Enable scanning of header files 2014-10-03 JJ Allaire * R/Attributes.R: Only look for plugins in the package's namespace (rather than entire search path) 2014-10-01 Kevin Ushey * inst/include/Rcpp/vector/ListOf.h ListOf inherits relevant proxies * inst/unitTests/cpp/ListOf.cpp: Idem * inst/unitTests/runit.ListOf.R: Idem 2014-09-29 Dirk Eddelbuettel * debian/*: Changes for Debian release of 0.11.3 * inst/NEWS.Rd: Removed a double entry 2014-09-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.3 * inst/NEWS.Rd: Release 0.11.3 * inst/include/Rcpp/config.h: Release 0.11.3 * ChangeLog: Added a few more entries based on commit log * inst/NEWS.Rd: Idem 2014-09-26 JJ Allaire * DESCRIPTION: Bump version to enable checking for dryRun. 2014-09-23 JJ Allaire * R/Attributes.R: Add dryRun parameter to sourceCpp. 2014-09-21 Dirk Eddelbuettel * DESCRIPTION: Shorten Description: to single paragraph 2014-09-21 Kevin Ushey * inst/unitTests/runit.environments.R: Use 'checkIdentical' as it's a more appropriate expression of intent 2014-09-15 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Use more neutral default name, email settings * man/Rcpp.package.skeleton.Rd: Document these 2014-09-14 Dirk Eddelbuettel * inst/unitTests/testRcppClass/man/Rcpp_class_examples.Rd: Similar update to yesterday's update for testRcppModule 2014-09-14 Kevin Ushey * inst/include/Rcpp/vector/Vector.h: Alternate strategy using SFINAE * inst/include/Rcpp/traits/traits.h: Idem * inst/include/Rcpp/traits/enable_if.h: Idem 2014-09-13 Kevin Ushey * inst/include/Rcpp/vector/Vector.h: Allow logical vectors to be created from bools * inst/unitTests/runit.Vector.R: Idem * inst/unitTests/cpp/Vector.cpp: Idem 2014-09-13 Dirk Eddelbuettel * inst/skeleton/Rcpp_modules_examples.Rd: Added to document modules examples * inst/unitTests/testRcppModule/NAMESPACE: Updated for current Modules use * inst/unitTests/testRcppModule/R/zzz.R: Updated for current Modules use * inst/unitTests/testRcppModule/man/Rcpp_modules_examples.Rd: Also added here 2014-09-10 Dirk Eddelbuettel * R/R/Rcpp.package.skeleton.R: If available, pkgKitten used for skeleton pkg 2014-09-09 Dirk Eddelbuettel * R/unit.tests.R: Fully qualify three functions from RUnit via :: 2014-09-03 Kevin Ushey * inst/include/Rcpp/Environment.h: make new_env a free function 2014-09-02 Kevin Ushey * inst/include/Rcpp/api/meat/proxy.h: Finish meat reintroduction + tests * inst/unitTests/runit.wrap.R: Idem * inst/unitTests/cpp/wrap.cpp: Idem * inst/include/Rcpp/proxy/FieldProxy.h: Idem 2014-09-02 Dirk Eddelbuettel * inst/include/Rcpp/vector/Vector.h: Reversing change from Aug 30: the Vector ctor from char* and string are used for CharacterVector() 2014-09-02 JJ Allaire * R/Attributes.R: Include LinkingTo in DESCRIPTION fields scanned to confirm that C++ dependencies are referenced by package. 2014-09-01 Yixuan Qiu * inst/include/Rcpp/vector/Vector.h: fix return value of range eraser 2014-09-01 Kevin Ushey * inst/include/Rcpp/vector/ListOf.h: `size()` member function should return `R_len_t` rather than `int` 2014-08-30 Kevin Ushey * inst/include/Rcpp/Environment.h: Add 'new_env' function 2014-08-30 Dirk Eddelbuettel * inst/include/Rcpp/vector/Vector.h: Mark two 'from string' ctors as deprecated following a suggestion by Yixuan Qiu [reversed on 2014-09-02] 2014-08-18 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Added a new entry regarding licensing of packages stressing that any combined work linking to the GPL-ed R will also be under the terms of the GNU General Public License. 2014-08-13 Kevin Ushey * inst/include/Rcpp/api/meat/meat.h: Reintroduce meat * inst/include/Rcpp/api/meat/proxy.h: Idem * inst/include/Rcpp/proxy/AttributeProxy.h: Idem * inst/include/Rcpp/proxy/Binding.h: Idem * inst/include/Rcpp/proxy/NamesProxy.h: Idem * inst/include/Rcpp/proxy/SlotProxy.h: Idem * inst/include/Rcpp/proxy/TagProxy.h: Idem * inst/include/Rcpp/proxy/proxy.h: Idem 2014-08-08 Christian Authmann * inst/unitTests/cpp/InternalFunction.cpp: New unit test support * inst/unitTests/cpp/InternalFunctionCPP11.cpp: Idem * inst/unitTests/runit.InternalFunction.R: Idem * inst/unitTests/runit.InternalFunctionCPP11.R: Idem 2014-08-06 Christian Authmann * inst/include/Rcpp/InternalFunctionWithStdFunction.h: Extend the existing Rcpp::InternalFunction interface to work with std::function, conditional on a sufficient C++11 support by the compiler 2014-08-05 Dirk Eddelbuettel * inst/include/Rcpp/Date.h: Remove a const qualifier which triggers a warnings as 'type qualifiers ignored on function return type' 2014-08-03 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Updated with respect to OS X installations requiring Fortran (to e.g. build against RcppArmadillo) 2014-07-29 Kevin Ushey * inst/include/Rcpp/vector/no_init.h: Add no_init for matrices * inst/include/Rcpp/vector/Matrix.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/unitTests/runit.Matrix.R: Idem * inst/unitTests/cpp/Matrix.cpp: Idem 2014-07-29 Dirk Eddelbuettel * inst/include/Rcpp/vector/proxy.h: Removed operator bool() cast as discussed by Christian Authmann on rcpp-devel 2014-07-28 Dirk Eddelbuettel * inst/include/Rcpp/generated/InternalFunction__ctors.h: Updated from corrected creator script 2014-07-25 Romain Francois * inst/include/Rcpp/Benchmark/Timer.h: Added new static method get_timers() to return a vector of timers useful for multithreaded contexts; also removed two unused old member functions (cf #157) 2014-07-14 Kevin Ushey * inst/unitTests/runit.Matrix.R: DimNames Proxy * inst/unitTests/cpp/Matrix.cpp: Idem * inst/include/Rcpp/vector/Matrix.h: Idem * inst/include/Rcpp/vector/DimNameProxy.h: Idem 2014-07-12 Kevin Ushey * R/Attributes.R: Strip version in .parseLinkingTo 2014-07-12 Dirk Eddelbuettel * inst/include/Rcpp/generated/InternalFunction__ctors.h: Regenerated with tighter whitespace and updated header information from updated generator script in corresponding rcpp-scripts repo * inst/include/Rcpp/module/Module_generated_CppFunction.h: Idem * inst/include/Rcpp/module/Module_generated_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_method.h: Idem * inst/include/Rcpp/module/Module_generated_function.h: Idem * inst/include/Rcpp/module/Module_generated_get_signature.h: Idem * inst/include/Rcpp/module/Module_generated_method.h: Idem 2014-07-09 Kevin Ushey * inst/include/Rcpp/Language.h: OUT -> RESULT_TYPE * inst/include/Rcpp/generated/InternalFunction__ctors.h: Idem * inst/include/Rcpp/module/Module_generated_CppFunction.h: Idem * inst/include/Rcpp/module/Module_generated_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h: Idem * inst/include/Rcpp/module/Module_generated_Pointer_method.h: Idem * inst/include/Rcpp/module/Module_generated_function.h: Idem * inst/include/Rcpp/module/Module_generated_get_signature.h: Idem * inst/include/Rcpp/module/Module_generated_method.h: Idem * inst/include/Rcpp/module/get_return_type.h: Idem * inst/include/Rcpp/sugar/block/SugarBlock_1.h: Idem * inst/include/Rcpp/sugar/block/SugarBlock_2.h: Idem * inst/include/Rcpp/sugar/block/SugarBlock_3.h: Idem * inst/include/Rcpp/sugar/block/SugarMath.h: Idem * inst/include/Rcpp/sugar/functions/complex.h: Idem 2014-07-08 Dirk Eddelbuettel * inst/include/Rcpp/InternalFunction.h: Add missing update(SEXP) method per GitHub Pull Request #152, with thanks to Omar Andres Zapata Mesa * inst/THANKS: Updated 2014-07-04 Dirk Eddelbuettel * vignettes/Rcpp-unitTests.Rnw: Commented-out copy of results to /tmp 2014-06-29 JJ Allaire * R/Attributes.R: fix setwd problem when sourceCpp used a relative path and included an R code chunk 2014-06-20 Dirk Eddelbuettel * include/Rcpp/sugar/functions/ifelse.h: Applied pull request #150 by Romain to have operator{} return the correct NA type 2014-06-11 Dirk Eddelbuettel * inst/include/Rcpp/macros/macros.h: No longer include macros/preprocessor_generated.h which was deprecated as of Rcpp 0.10.5 * inst/include/Rcpp/macros/preprocessor_generated.h: Removed 2014-06-08 Dirk Eddelbuettel * cleanup: Do not remove 'build/Rcpp.pdf', thanks to hint by Kurt / CRAN 2014-06-06 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.2 * inst/NEWS.Rd: Release 0.11.2 * inst/include/Rcpp/config.h: Release 0.11.2 * debian/*: Similarly updated for new release to Debian * tests/doRUnit.R: Additional check added for release version case 2014-06-05 JJ Allaire * R/Attributes.R: Use -std=c++0x for cpp11 plugin on Windows if R <= 3.0 2014-05-28 Kevin Ushey * inst/include/Rcpp/vector/vector_from_string.h: Protect result of Rf_mkString 2014-05-24 Dirk Eddelbuettel * .Rbuildignore: Add .dir-locals.el 2014-05-23 Dirk Eddelbuettel * R/Module.R (new_dummyObject): Remove erraneous quotes * .dir-locals.el: Setting tab-width to 8 2014-05-18 Kevin Ushey * inst/include/Rcpp/vector/Vector.h: Safer casting to fix #146 * inst/include/Rcpp/Environment.h: Idem * inst/include/Rcpp/api/meat/Environment.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * .dir-locals.el: Added for project-local Emacs settings 2014-05-10 Dirk Eddelbuettel * R/Attributes.R (compileAttributes): Read Imports: as well 2014-05-07 Kevin Ushey * R/Attributes.R (.plugins[["cpp11"]]): Set USE_CXX1X to more reasonable non-empty value 2014-05-06 Kevin Ushey * R/Attributes.R (.plugins[["cpp11"]]): Set USE_CXX1X to non-empty value 2014-04-30 Dirk Eddelbuettel * R/Attributes.R: Add plugins for C++0x and C++1y 2014-04-30 JJ Allaire * R/Attributes.R: Use USE_CXX1X for cpp11 plugin when R >= 3.1 2014-04-02 Dirk Eddelbuettel * tests/doRUnit.R: Better RUnit error report with thanks to Murray 2014-03-18 JJ Allaire * man/cppFunction.Rd: Correct package header file example to use .h 2014-03-14 Dirk Eddelbuettel * inst/include/Rcpp/DataFrame.h: Add missing return in Impl method 2014-03-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.1 * inst/NEWS.Rd: Release 0.11.1 * inst/include/Rcpp/config.h: Release 0.11.1 * debian/*: Similarly updated for new release to Debian 2014-03-09 Kevin Ushey * inst/include/Rcpp/vector/const_string_proxy.h: Workaround for issue with constructing proxies from CHARSXPs 2014-03-08 Kevin Ushey * inst/include/Rcpp/proxy/proxy.h: Make sure proxies know about the const char* wrap shortcut 2014-03-08 Dirk Eddelbuettel * inst/include/Rcpp/proxy/Binding.h: Remove spurious ';' [g++ -pedantic] * inst/include/Rcpp/proxy/ProtectedProxy.h: Idem * inst/include/Rcpp/proxy/TagProxy.h: Idem * inst/include/Rcpp/proxy/AttributeProxy.h: Idem 2014-03-05 Kevin Ushey * inst/include/Rcpp/proxy/FieldProxy.h: bandaid for protection issue in operator= of FieldProxy * R/unit.tests.R: modify Rcpp:::test so we can run tests with gctorture(TRUE) 2014-03-03 Kevin Ushey * inst/include/Rcpp/proxy/SlotProxy.h: Add missing const_SlotProxy ctor definition 2014-02-24 Kevin Ushey * R/Rcpp.package.skeleton.R: make sure we add loadModule to NAMESPACE when module is TRUE 2014-02-23 Kevin Ushey * inst/include/Rcpp/DataFrame.h: better nrows behavior 2014-02-17 Romain Francois * inst/include/Rcpp/traits/un_pointer.h: fix bug in un_pointer for object 2014-02-17 Kevin Ushey * src/attributes.cpp: Fix attributes behavior with ::create, and also add an option for a default constructor (e.g. NumericVector v = NumericVector(10)) gives a default value of 'numeric(10)' at the R level). Also make NAs keep their type when exposed to R. 2014-02-16 JJ Allaire * src/attributes.cpp Replace (incorrect) call to Rcpp::internal::jumpToTop with Rf_onintr 2014-02-07 Kevin Ushey * inst/include/Rcpp/Reference.h: Add default ctor 2014-02-03 Kevin Ushey * inst/include/Rcpp/vector/Vector.h: Enable conversion from Rcpp vectors to RObject 2014-02-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.11.0 * inst/NEWS.Rd: Release 0.11.0 * inst/include/Rcpp/config.h: Release 0.11.0 * debian/*: Similarly updated for new release to Debian 2014-02-02 JJ Allaire * R/Attributes.R: Use placeholder for .Call to avoid warning 2014-02-01 Dirk Eddelbuettel * tests/doRUnit.R: Simplified following pattern in RProtoBuf * vignettes/Rcpp-unitTests.Rnw: Remove a now superfluous global var * vignettes/Rcpp.bib: Updated references to current packages 2014-02-01 JJ Allaire * R/Attributes.R: Embedded R code chunks in sourceCpp can now be disabled 2014-01-31 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Render code with background boxen * vignettes/Rcpp-package.Rnw: Idem * vignettes/Rcpp-modules.Rnw: Idem * vignettes/Rcpp-extending.Rnw: Idem * vignettes/Rcpp-sugar.Rnw: Idem * vignettes/Rcpp-attributes.Rnw: Switched to highlight driver * inst/include/Rcpp/Benchmark/Timer.h: Reverted back to using iterators via use of anonymous namespace for accessors * inst/announce/ANNOUNCE-0.11.0.txt: Updated 2014-01-31 Dirk Eddelbuettel * man/Rcpp.package.skeleton.Rd: Also updated 2014-01-31 JJ Allaire * R/Attributes.R: Embedded R code chunks in sourceCpp are now executed within the working directory of the C++ source file. 2014-01-30 Dirk Eddelbuettel * vignettes/Rcpp-package.Rnw: Updates for upcoming release 2014-01-28 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Some updates for upcoming release 2014-01-25 Dirk Eddelbuettel * inst/include/Rcpp/Benchmark/Timer.h: Simplified -- Rcpp Gallery example using it was not building any longer under g++ 2014-01-23 Dirk Eddelbuettel * inst/announce/ANNOUNCE-0.11.0.txt: Added for next release 2014-01-21 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R: Update skeleton package to add proper Imports: to DESCRIPTION, and importFrom() to NAMESPACE 2014-01-19 Kevin Ushey * inst/include/Rcpp/api/meat/Vector.h: Add missing UNPROTECT in push_back_name__impl 2014-01-18 Kevin Ushey * inst/unitTests/runit.S4.R: Add a test for ctor from slot proxy * inst/unitTests/cpp/S4.cpp: Add a test for ctor from slot proxy * inst/include/Rcpp/vector/Vector.h: Add missing r_cast to vector ctor from proxy 2014-01-18 JJ Allaire * R/Attributes.R: More restrictive matching of C++ file extensions for compileAttributes. 2014-01-18 Kevin Ushey * inst/unitTests/cpp/Matrix.cpp: Add unit test * inst/unitTests/runit.Matrix.R: Add unit test * inst/include/Rcpp/api/meat/Matrix.h: Bug fix in operator= 2014-01-17 Dirk Eddelbuettel * R/RcppLdpath.R (RcppCxxFlags): Restore function to supply values for include files for packages not yet converted to LinkingTo: 2014-01-16 JJ Allaire * inst/include/Rcpp/macros/macros.h: Use Rf_onintr rather than non-public Rf_jump_to_toplevel * inst/include/Rcpp/DateVector.h: Fix GreedyVector compilation error * inst/include/Rcpp/DatetimeVector.h: Fix GreedyVector compilation error 2014-01-15 Dirk Eddelbuettel * inst/include/Rcpp/exceptions.h: Move stop() into Rcpp namespace 2014-01-03 JJ Allaire * .gitignore: Added src/, *.Rproj, and .Rproj.user * inst/include/Rcpp/Interrupt.h: New checkUserInterrupt function that provides a C++ friendly implementation of R_CheckUserInterrupt * inst/include/RcppCommon.h: Include Rcpp/Interrupts.h * inst/include/macros/macros.h: Check for interrupts in END_RCPP * src/attributes.cpp: Handle interrupted-error in attribute function envelope. 2013-12-31 Dirk Eddelbuettel * vignettes/Rcpp.bib: Updated CRAN package references 2013-12-20 Kevin Ushey * inst/include/Rcpp/sugar/tools/mapcompare.h: Use a union for type punning, to avoid compiler warning on aliasing. Also switch to uint64_t to enforce 64bit comparison. * inst/include/Rcpp/RObject.h: Add missing *this return for RObject_impl::operator= 2013-12-20 Dirk Eddelbuettel * inst/include/Rcpp/RObject.h: Applied fix by Kevin Ushey (#88) * inst/include/Rcpp/vector/Vector.h: Ditto (#89) 2013-12-01 Kevin Ushey * R/Rcpp.package.skeleton.R: Fixed bug relating to user-supplied functions in 'list' argument * inst/unitTests/runit.Rcpp.package.skeleton.R: Added unit tests 2013-11-30 Dirk Eddelbuettel * vignettes/Rcpp-FAQ.Rnw: Updated and corrected in several spots 2013-11-22 Dirk Eddelbuettel * inst/include/Rcpp/stats/nt.h: Correct expansion of (d|q|p)nt() * inst/unitTests/runit.stats.R: Added unit tests for t dist with ncp * inst/unitTests/cpp/stats.cpp: C++ side of expamded unit tests 2013-11-05 Dirk Eddelbuettel * .travis.yml: Added to support continuous integration on github 2013-10-28 Romain Francois * include/Rcpp/protection/Armor.h : Armor::operator SEXP has to be const for it to work properly with wrap. 2013-10-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.6 * inst/NEWS.Rd: Release 0.10.6 * inst/include/Rcpp/config.h: Release 0.10.5 * debian/*: Similarly updated for new release to Debian 2013-10-17 JJ Allaire * R/Attributes.R: sourceCpp now correctly binds to Rtools 3.0 and 3.1 2013-10-16 Dirk Eddelbuettel * R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Deprecate namespace argument which package.skeleton() no longer uses * man/Rcpp.package.skeleton.Rd: Updated documentation accordingly 2013-10-16 Romain Francois * include/Rcpp/api/meat/is.h : added missing implementation for is and is 2013-10-14 Romain Francois * inst/include/Rcpp/protection/protection.h: added Shield/Shelter/Armor * DESCRIPTION: bump to version 0.10.5.3 2013-10-12 Dirk Eddelbuettel * DESCRIPTION (Depends): Rolled Depends: on R to "R (>= 3.0.0)" as required by the vignette building code (with thanks to Uwe Ligges) 2013-10-08 Dirk Eddelbuettel * NAMESPACE: Export LdFlags as well as RcppLdFlags * man/RcppLdFlags.Rd: Updated 2013-10-06 John M Chambers * R/exposeClass.R: avoid warning from unclosed file() 2013-10-06 John M Chambers * NAMESPACE: change classModule to exposeClass * R/classModule.R: delete * man/classModule.Rd: delete * R/exposeClass.R: add * man/exposeClass.Rd: add * man/setRcppClass.Rd: update, clarify, recommend exposeClass() 2013-10-03 John M Chambers * R/classModule.R: new function to write module file for class * man/classModule.Rd: documentation for new function classModule() * NAMESPACE: export classModule * R/loadModule.R: clean up an error message * R/RcppClass.R: defaults for module consistent w. classModule() * man/setRcppClass.Rd: add defaults, explain need for saveAs 2013-10-02 Dirk Eddelbuettel * inst/include/Rcpp/traits/is_na.h: More fixes thanks to Thomas Tse 2013-10-01 Dirk Eddelbuettel * inst/include/Rcpp/api/meat/is.h: Applied patch by Thomas Tse to provide missing Character(Vector|Matrix) * DESCRIPTION: Bump to development release 0.10.5.1 2013-09-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.5 * inst/NEWS.Rd: Release 0.10.5 * inst/include/Rcpp/config.h: Release 0.10.5 * debian/*: Similarly updated for new release to Debian * vignettes/Rcpp-unitTests.Rnw: Switched to Charter font just like the other eight vignettes 2013-09-28 Romain Francois * include/Rcpp/module/Module_generated_CppMethod.h : more code bloat to handle flexible semantics for passing parameters in methods * include/Rcpp/module/Module_generated_Pointer_CppMethod.h : same * inst/unitTests/cpp/Module.cpp: testing the above * unitTests/runit.Module.R: testing 2013-09-27 Dirk Eddelbuettel * vignettes/Rcpp-unitTests.Rnw: Re-activated vignette * DESCRIPTION: Version number bumped to 0.10.4.6 2013-09-27 Romain Francois * include/Rcpp/module/Module_generated_CppFunction.h : regenerated to use input_parameter traits for more flexible parameter passing strategy * unitTests/cpp/Module.cpp : more testing * unitTests/runit.Module.R : more testing 2013-09-22 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/diff.h: Declare set_previous const and add a missing traits:: prefix before is_na * inst/unitTests/cpp/sugar.cpp: Unit test for diff() of int. vector * inst/unitTests/runit.sugar.R: Invoke new test 2013-09-21 Dirk Eddelbuettel * vignettes/Rcpp-modules.Rnw: Remove vignette-local compilations which again caused problems for the Windows builds at R-Forge and win-builder. Unit tests comprise the same functionality and pass. * vignettes/Rcpp-attributes.Rnw: Refresh look by using Bitstream Charter, and microtype package (cf http://www.khirevich.com/latex) * vignettes/Rcpp-extending.Rnw: Idem * vignettes/Rcpp-FAQ.Rnw: Idem * vignettes/Rcpp-modules.Rnw: Idem * vignettes/Rcpp-package.Rnw: Idem * vignettes/Rcpp-quickref.Rnw: Idem * vignettes/Rcpp-sugar.Rnw: Idem 2013-09-20 Dirk Eddelbuettel * R/Module.R: More ':::' cleanups to make R CMD check happy * R/RcppClass.R: Ditto * NAMESPACE: Some new exports related to this * man/setRcppClass.Rd: Document loadRcppClass() * man/Rcpp-internal.Rd: Added in order to document cpp_object_initializer() and cpp_object_dummy() 2013-09-19 Dirk Eddelbuettel * inst/include/Rcpp/longlong.h: Unbreak long long by making it (as before) conditional on g++ (or clang) as well as C++11. The condition can be OR'ed with another suitably-defined variable, but the default has to be off as CRAN compliance has to remain the standard 2013-09-19 Romain Francois * include/Rcpp/longlong.h: isolate all handling of long long in a separate file which we might choose not to include by default * include/Rcpp/traits/r_sexptype_traits.h : unsigned int wrapped as REALSXP long standing feature request from Murray. * R/Attributes.R : Added the helper demangle and sizeof functions * man/demangle.Rd : Documentation for demangle and sizeof * include/Rcpp/platform/compiler.h : less restritive support of long long types. But still behind a test for gcc and a test for the availability of the type, and the __extension__. -pedantic does not warn about it 2013-09-18 JJ Allaire * R/Attributes.R: Don't search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute 2013-09-18 Romain Francois * vignettes/Rcpp-package.Rnw: Updating the vignette. Setting attributes to TRUE by default. * R/Rcpp.package.skeleton.R: Setting attributes to TRUE by default. This is what we should encourage people to use. * include/Rcpp/as.h: add as specialization * include/Rcpp/sugar/functions/diff.h : rework the implementation of diff so that it works even when we don't know the previous value * unitTests/runit.sugar.R : * unitTests/cpp/sugar.cpp : * include/Rcpp/sugar/functions/range.h : factored out of minmax.h * include/Rcpp/sugar/functions/min.h : factored out of minmax.h * include/Rcpp/sugar/functions/max.h : factored out of minmax.h * TODO : 3 less items 2013-09-17 JJ Allaire * R/Attributes.R: Call inlineCxxPlugin and Rcpp.plugin.maker without qualification rather than with ':::' 2013-09-17 Dirk Eddelbuettel * NAMESPACE: Export RcppLdFlags which is often used to build Rcpp * man/RcppLdFlags.Rd: Added required manual page * R/Attributes.R: Call RcppLdFlags() via '::' instead of ':::' * R/SHLIB.R: Ditto * R/inline.R: Ditto * vignettes/Rcpp-FAQ.Rnw: Add %\VignetteEngine{highlight::highlight} * vignettes/Rcpp-attributes.Rnw: Idem * vignettes/Rcpp-extending.Rnw: Idem * vignettes/Rcpp-modules.Rnw: Idem * vignettes/Rcpp-package.Rnw: Idem * vignettes/Rcpp-quickref.Rnw: Idem * vignettes/Rcpp-sugar.Rnw: Idem * vignettes/Rcpp-package.Rnw: Altered to make use of highlight package; also no longer build embedded demo package (which upsets R CMD check under R-devel) 2013-09-16 JJ Allaire * R/Attributes.R : Remove calls to non-exported functions from the tools package 2013-09-16 Romain Francois * include/Rcpp/internal/Exporter.h : Specific handling of containers (std::vector, std::deque, and std::list so that we use their faster range constructor when we can, and so let the STL optimize how data is copied * include/Rcpp/api/meat/export.h : Implementation of the above * include/Rcpp/vector/Vector.h : added Vector( const char* ) ctor * DESCRIPTION : bump to 0.10.4.5 (for RcppExtras) 2013-09-15 Dirk Eddelbuettel * inst/include/Rcpp/InputParameter.h (Rcpp): Add 'const' case * inst/unitTests/cpp/Vector.cpp: New unit tests for std::vector conversions, using both int and double arguments * inst/unitTests/runit.Vector.R: R complement of these tests 2013-09-15 Romain Francois * include/Rcpp/InputParameter.h : added the traits::input_parameter trait to add another layer of abstration. * include/Rcpp/macros/module.h : taking advantage of input_parameter to specialize how to work with module objects * src/attributes.cpp : using traits::input_parameter instead of InputParameter 2013-09-14 Dirk Eddelbuettel * src/attributes.cpp : Precede closing '>' by space to avoid '>>' * inst/include/Rcpp/platform/compiler.h: Further refine #if test for 'long long' by conditioning __LP64__ on also using clang/llvm * src/attributes.cpp : Precede closing '>' by space to avoid '>>' 2013-09-13 Romain Francois * src/api.cpp : added "long long" to the capabilities function. * include/Rcpp/platform/compiler.h : demangling is definitely available on all mac versions using gcc. No point is testing for OSX version. * include/Rcpp/InputParameter.h : extra layer of abstraction to allow for custom handling of references etc ... used in RcppArmadillo * src/attributes.cpp : using InputParameter * DESCRIPTION: bump to 0.10.4.4 2013-09-12 Romain Francois * include/Rcpp/platform/compiler.h : patch submitted by Murray for better support of long long type. * include/Rcpp/platform/compiler.h : gcc 4.2.1 has tr1/unordered_map and tr1/unordered_set. Previous test was for gcc 4.4.0 for some reason 2013-08-31 Dirk Eddelbuettel * inst/doc/*: Moved all vignettes to vignettes/* * vignettes/*: Minor updates to some vignettes 2013-08-22 Romain Francois * include/Rcpp/traits/is_primitive.h : new trait to identify if a type is primitive, this is a shortcut of using r_type_traits and compare it to r_type_primitive_tag * include/Rcpp/traits/r_type_traits.h : new tag r_type_pair_tag to handle wrapping map where KEY can be converted to String and VALUE can wrap itself * include/Rcpp/internal/wrap.h : handling map and vector where T is a class handled by modules * include/Rcpp/api/meat/wrap.h : implementations to handle map * unitTests/cpp/wrap.cpp : more tests for map with KEY not a string * unitTests/runit.wrap.R : more tests for map with KEY not a string * include/Rcpp/internal/export.h : added export_range__dispatch for the r_type_generic_tag tag. Meaning we can now use as< vector > where T is not a primitive * include/Rcpp/api/meat/export.h : implementation in meat because it needs as 2013-08-01 Romain Francois * unitTests/cpp/wstring.cpp: fix to re-enable wstring test suite. * unitTests/runit.wstring.R: re-enable the wstring test suite. 2013-07-31 Dirk Eddelbuettel * DESCRIPTION: Bump development version to 0.10.4.3 * inst/doc/Makefile: Rejigged pdf builds in another attempt at pleasing whatever runs the builds on r-forge. L'espoir fait vivre. 2013-07-25 Romain Francois * include/Rcpp/sugar/functions/is_na.h : added is_na for DateVector and DatetimeVector * include/Rcpp/Date.h : added is_na method * include/Rcpp/Datetime.h : added is_na method * unitTests/cpp/dates.cpp : removed the ignoreme useless parameters * unitTests/runit.Date.R : idem * src/attributes.cpp: collecting functions in a FunctionMap. Will use this for dispatching 2013-07-24 Romain Francois * include/Rcpp/traits/is_module_object.h: trait class that identifies at compile time if a given type is a type exposed by a module, i.e. if we used the RCPP_EXPOSED_AS macro * include/Rcpp/is.h: able to identify if an object is of a given type exposed by a module (supports references and pointers too). * src/Module.cpp: implementation of is_module_object_internal that checks if an object is of a given typeid, used by is where T is module exposed 2013-07-23 Romain Francois * include/Rcpp/as.h: support as and as where T is a class exposed by modules * include/Rcpp/macros/module.h: idem * include/Rcpp/traits/un_pointer.h: handle the object case * include/Rcpp/traits/r_type_traits.h: adding traits to help the with as and as * unitTests/runit.Module.R: testing as and as * unitTests/cpp/Module.cpp: idem * src/attributes.cpp: take advantage of a more flexible as<>. The Type class gains a full_name() method that shows const-ness and reference-ness 2013-07-17 Romain Francois * include/Rcpp/vector/instantiation.h: added the DoubleVector alias to NumericVector * include/Rcpp/is.h: added is template function 2013-07-11 Dirk Eddelbuettel * R/Attributes.R: Add an OpenMP plugin 2013-07-03 Romain Francois * unitTests/runit.modref.R: using sourceCpp * unitTests/runit.Module.R: using sourceCpp * unitTests/runit.Vector.R: no more uses of inline * unitTests/runTests.R: we don't need inline no more for testing * doc/unitTests/Rcpp-unitTests.R: idem 2013-07-02 Romain Francois * include/Rcpp/vector/Vector.h: fill__dispatch was mispelled (as fill_dispatch) for the non trivial case, so it did not work * unitTests/runit.Matrix.R: using sourceCpp * unitTests/runit.misc.R: using sourceCpp * unitTests/runit.wrap.R: using sourceCpp * unitTests/runit.support.R: using sourceCpp * unitTests/runit.rmath.R: using sourceCpp * unitTests/runit.RObject.R: using sourceCpp * unitTests/runit.stats.R: using sourceCpp * unitTests/runit.XPTr.R: using sourceCpp * unitTests/runit.Vector.R: testing List( int, IntegerVector ) which eventually uses fill__dispatch * include/Rcpp/traits/r_type_traits.h: support for as and as when T is module exposed * include/Rcpp/as.h: as and as when T is module exposed * include/Rcpp/module/Module_generated_CppFunction.h: removed the remove_const_and_reference since as and as is supported * src/attributes.cpp: automatically populating the environment with the content of a module, rather than make the module object available in the environment 2013-07-01 Romain Francois * R/unit.test.R: added helper function Rcpp:::unit_test_setup to avoid some boiler plate code in unit test files. See e.g. runit.Function.R for an example * unitTests/runit.as.R: using sourceCpp * unitTests/runit.Function.R: using sourceCpp * unitTests/runit.DataFrame.R: remove dependency on datasets 2013-06-25 Dirk Eddelbuettel * src/api.cpp: Also test for #defined(__sun) when checking for system lacking a valid backtrace() function for stack traces 2013-06-25 Romain Francois * DESCRIPTION : devel version 0.10.4.1 * src/Module.cpp : bring a simplified version of RCPP_FUNCTION 1 .. 4 * unitTests/runit.macros.R : removed, as RCPP_FUNCTION ... are deprecated * include/Rcpp/macros/preprocessor_generated.h : deprecating RCPP_FUNCTION_... macros 2013-06-24 Dirk Eddelbuettel * inst/include/Rcpp/platform/compiler.h: Note the useful wiki page http://sourceforge.net/p/predef/wiki/Home with #defines for OSs, compilers, libraries and more 2013-06-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.4 * inst/NEWS.Rd: Release 0.10.4 * inst/include/Rcpp/config.h: Release 0.10.4 * debian/*: Similarly updated for new release to Debian 2013-06-19 Romain Francois * inst/NEWS.Rd: Document planned depreciation of old RCPP_FUNCION_* macros which are redundant thanks to Rcpp Modules and Rcpp Attributes * include/Rcpp/vector/string_proxy.h : added operator string_proxy::operator==( const string_proxy& ) so that me may compare x[i] and y[i] (x and y being CharacterVector) * include/Rcpp/module/Module_generated_Pointer_CppMethod.h : remove const and reference to OUT type in several places, that was causing problems e.g. on making the Rcpp-modules vignette * include/Rcpp/module/Module_generated_CppMethod.h : idem 2013-06-18 Romain Francois * include/Rcpp/module/Module_generated_CppFunction.h : using BEGIN_RCPP / END_RCPP as suggested by Ben North on Rcpp-devel. This should reduce cross dll exceptions issues on windows. 2013-06-14 Romain Francois * include/Rcpp/stats/random/runif.h : removed unused max variable * include/Rcpp/stats/random/rf.h : removed unused n1 and n2 variables 2013-06-13 Romain Francois * src/Module.cpp: small buglet in macro. Reported on Rcpp-devel 2013-06-12 Dirk Eddelbuettel * inst/doc/Makefile: Force serial build of vignettes in yet another effort to not let R-Forge fail when trying to rebuild them 2013-06-08 Dirk Eddelbuettel * inst/doc/Rcpp.bib: Updated entries * inst/doc/Rcpp-introduction.Rnw: Added pointer to 'Rcpp Attributes' vignette, as well as to 'Rcpp Sugar' and 'Rcpp Modules' vignettes. * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Idem 2013-06-06 Romain Francois * unitTests/cpp/Vector.cpp : more unit tests for erase * unitTests/runit.Vector.R : more unit tests for erase 2013-06-05 Romain Francois * include/Rcpp/api/meat/Vector.h : fixed Vector<>::erase(iterator, iterator) and correct return value of erase * unitTests/cpp/Vector.cpp : added regression test for the above fix * unitTests/runit.Vector.R : added regression test for the above fix * include/Rcpp/module/class.h : removed useless typedef 2013-05-31 Romain Francois * unitTests/runit.sugar.R : new test for is_infinite and is_nan * unitTests/cpp/sugar.cpp : new test for is_infinite and is_nan * include/Rcpp/sugar/functions/is_infinite.h : new function is_infinite * include/Rcpp/traits/is_infinite.h : new function is_infinite * include/Rcpp/sugar/functions/is_nan.h : new function is_nan * include/Rcpp/traits/is_nan.h : new function is_nan 2013-05-30 Romain Francois * include/Rcpp/sugar/functions/all.h : bug fixed for the NA=false case * include/Rcpp/sugar/functions/is_na.h : header * include/Rcpp/sugar/functions/is_finite.h : added sugar is_finite function * include/Rcpp/traits/is_finite.h : added is_finite trait * unitTests/runit.sugar.R : added test for is_finite * unitTests/cpp/S4.cpp : new cpp file to host S4 unit tests * unitTests/runit.S4.R : rework unit tests to use attributes * unitTests/runit.Reference.R : unit tests for Rcpp::Reference * unitTests/cpp/Reference.cpp : unit tests c++ code 2013-05-26 Dirk Eddelbuettel * src/api.cpp: Minor tweak for internal formatting 2013-05-24 J.J. Allaire * R/Attributes.R: Disallow compilation for files that don't have extensions supported by R CMD SHLIB 2013-05-21 J.J. Allaire * R/Attributes.R: Lookup plugins in inline package if they aren't found within the Rcpp package * man/pluginsAttribute.Rd: Documentation updates. 2013-05-17 J.J. Allaire * src/attributes.cpp: prevent gc problems with RNGScope destructor in attributes generated functions; don't include package header file in generated cpp exports file * src/api.cpp: use unsigned long for RNG scope counter 2013-04-28 Dirk Eddelbuettel * src/api.cpp (Rcpp): No longer use Rd_format(Real|Complex) which is a very verboten R internal; formatting to string is now very bare bones 2013-04-27 Dirk Eddelbuettel * src/Makevars: Improved use as well as a new possible overrride of /usr/bin/install_name_tool on OS X, once again contributed by Simon 2013-04-16 Romain Francois * include/Rcpp/sugar/functions/na_omit.h : new function na_omit to remove missing values from a vector. * src/attributes.cpp : portability fix (from Martyn Plummer) * include/Rcpp/api/meat/Vector.h : portability fix (from Martyn Plummer) 2013-04-14 Romain Francois * include/Rcpp/traits/is_na.h: complex version did not work. added default for VECSXP and EXPRSXP versions 2013-04-02 Dirk Eddelbuettel * src/Date.cpp: Corrected operator-() for Date and Datetime objects to behave more inline with C++ standard * inst/include/Rcpp/Date.h: operator-() for Dates now returns a double as the date itself is fractional double since epoch * inst/unitTests/cpp/dates.cpp: New file with C++ portion of tests factored out from R unit test file * inst/unitTests/runit.Date.R: Rewritten for use with new C++ tests 2013-04-02 Romain Francois * include/Rcpp/generated/DataFrame_generated.h : DateFrame::create uses List::create and then feeds to the DataFrame constructor, which seems to work better than the previous approach of calling back to the data.frame function in R * include/Rcpp/DataFrame.h : private function from_list, to help the new implementation of DataFrame::create * src/api.cpp : impl of DataFrame::from_list 2013-03-31 Dirk Eddelbuettel * debian/control (Build-Depends): Modified for Debian-only rebuilds under (rc version of upcoming) R 3.0.0 release * debian/changelog: Entry for Debian build 0.10.3-2 2013-03-29 Dirk Eddelbuettel * src/api.cpp (Rcpp): Re-enable coerce_to_string<>() for real and complex types with Poor Man's Versions (TM) of Rf_EncodeReal and Rf_EncodeComplex which the Powers That Be disallow from being used 2013-03-27 Romain Francois * include/Rcpp/vector/MatrixRow.h : removed unintended printed messaged (reported on Rcpp-devel by Michaeal Love) 2013-03-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.3 * inst/NEWS.Rd: Release 0.10.3 * inst/include/Rcpp/config.h: Release 0.10.3 * debian/*: Similarly updated for new release to Debian 2013-03-21 Dirk Eddelbuettel * inst/unitTests/runit.wstring.R (test.as_vector_wstring): replace the "€" symbol with its unicode equivalent "\u20ac" 2013-03-20 Dirk Eddelbuettel * inst/doc/Rcpp.bib: Updated versions for several CRAN packages * inst/CITATION: Add information about forthcoming book 2013-03-20 Romain Francois * include/Rcpp/traits/is_wide_string.h : fixes to re-enable wrap( vector ) and wrap( vector ), needed to support package httpuv * include/Rcpp/internal/wrap.h : same 2013-03-19 Dirk Eddelbuettel * inst/include/Rcpp/config.h: Define RCPP_USE_NEW_PRESERVE_RELEASE with default value of 0 to enable/disable new preserve/release code * src/api.cpp: Bracket the new Rcpp object preserve / release code with the new variable RCPP_USE_NEW_PRESERVE_RELEASE and fall back to R behaviour if not set 2013-03-12 Romain Francois * include/Rcpp/Module.h: added virtual destructor to CppProperty 2013-03-08 Dirk Eddelbuettel * inst/include/Rcpp/platform/compiler.h: Improved g++ version detection with thanks to Yan Zhou 2013-02-28 JJ Allaire * src/attributes.cpp: standalone roxygen chunks (e.g. to document a class) are now transposed into RcppExports.R 2013-02-27 JJ Allaire * R/Rcpp.package.skeleton.R: eliminated spurious empty hello world function definition in Rcpp.package.skeleton 2013-02-24 JJ Allaire * R/Attributes.R: add global package include file to RcppExports.cpp if it exists; handle Rcpp module definitions in sourceCpp * src/attributes.cpp: handle Rcpp module definitions in sourceCpp * man/sourceCpp.Rd: documentation updates 2013-02-20 Dirk Eddelbuettel * inst/include/Rcpp/platform/compiler.h: As deteced by Gong-Yi Liao, we need to test for __LONG_LONG_MAX__ (defined in limits.h) and not LONG_LONG_MAX (defined climits which we do not include) 2013-02-19 Romain Francois * src/api.cpp : more debugging * include/RcppCommon.h : move sexp_to_name here. Used in some debugging * include/Rcpp/vector/MatrixRow.h : fix const version of operator[] * include/Rcpp/vector/Vector.h : more debugging * include/Rcpp/internal/wrap.h : more debugging. more dispatch. 2013-02-18 Romain Francois * include/Rcpp/vector/string_proxy.h : only declare operator+= * include/Rcpp/String.h : define string_proxy::operator+=, now that String is defined. 2013-02-15 JJ Allaire * R/Attributes.R: Merge existing values of build related environment variables for sourceCpp 2013-02-12 Romain Francois * src/api.cpp : More careful about RCPP_PROTECTION_STACK init 2013-02-08 Romain Francois * include/Rcpp/as.h: re-enable as(CharacterVector[int]) 2013-02-07 Dirk Eddelbuettel * inst/THANKS: Adding Ben North for the help / bug report on iterators 2013-02-05 Romain Francois * include/Rcpp/vector/string_proxy.h : more wstring support * include/Rcpp/XPtr.h : more debugging. removed delete_finalizer which is no longer used 2013-02-05 JJ Allaire * src/attributes.cpp : ensure that line comments invalidate block comments when parsing for attributes 2013-02-04 Romain Francois * include/Rcpp/traits/r_type_traits.h : make the r_type_pairstring_string_tag tag more general, handling wstring as well as string * include/Rcpp/internal/wrap.h : using make_charsexp, a more generic version of charsexp_from_wstring. * include/Rcpp/as.h : more support fot wstring * include/Rcpp/internal/wrap.h : rework the support of wstring * include/Rcpp/internal/export.h : added as_string_elt to rework the support of wstring * include/Rcpp/traits/char_type.h : new trait to help the wstring support * include/Rcpp/String.h : added some support for wstring * include/Rcpp/vector/string_proxy.h : adapt to add wstring support * unitTests/runit.wstring.R : unit tests for wstring support * unitTests/cpp/wstring.cpp : unit tests for wstring support 2013-02-03 Romain Francois * include/Rcpp/traits/wrap_type_traits.h : support for wrap( wstring ) * include/Rcpp/internal/export.h : exporting wstring and containers of wstring * include/Rcpp/internal/wrap.h : support for wrap( wstring ) and containers of wstring * include/RcppCommon.h : definition of charsexp_from_wstring * src/api.cpp: implementation of charsexp_from_wstring 2013-02-02 Romain Francois * include/Rcpp/vector/MatrixRow.h: correct operator++(int) and operator--(int) * include/Rcpp/internal/Proxy_Iterator.h: correct operators ++ and -- * include/Rcpp/sugar/Range.h: correct operators ++ and -- * include/Rcpp/sugar/tools/iterator.h: correct operators ++ and -- * include/Rcpp/vector/MatrixBase.h : correct operators ++ and -- * include/Rcpp/vector/VectorBase.h : correct operators ++ and -- * unitTests/cpp/Vector.cpp: new unit tests * unitTests/runit.Vector.R: new unit tests * src/api.cpp: comment dropTrailing0 which is not used anymore * include/Rcpp/as.h: support for as * include/Rcpp/internal/export.h: more support for wstring 2013-01-15 Dirk Eddelbuettel * src/api.cpp (Rcpp): Commented-out coerce_to_string() for real and complex arguments as R-devel (as of today) dislikes use of non-API functions Rf_EncodeComplex’, ‘Rf_EncodeReal’, ‘Rf_formatComplex’ * .Rbuildignore: Added inst/include/Rcpp/preprocessor and sugar/functions/impl which are currently empty directories * src/Timer.cpp (Rcpp): Avoid a 'long long' warning from a const 2014-01-15 JJ Allaire * R/Attributes.R: don't add source directory as an include path for sourceCpp; fix duplicate inclusion of Rcpp directory * R/RcppLdpath.R: don't quote paths on windows 2014-01-14 JJ Allaire * DESCRIPTION: bump version to 0.10.2.3 * R/Attributes.R: handle build paths with spaces on windows * R/RcppLdpath.R: handle build paths with spaces on windows * R/tools.R: handle build paths with spaces on windows * src/Timer.cpp: fix OSX build (remove __MACH__ define check) * R/: set svn eol-style native for source files * src/: set svn eol-style native for source files * inst/include/: set svn eol-style native for source files 2014-01-13 JJ Allaire * R/Attributes.R: use plugin includes in cppFunction; stop with explicit error on Windows then the Rcpl libPath or sourceCpp target file contains spaces in it's path; add source file directory as an include path for sourceCpp; special handling for sourceCpp include paths on windows * man/pluginsAttribute.Rd: clarify which fields of plugin are used by sourceCpp 2014-01-12 JJ Allaire * DESCRIPTION: bump version to 0.10.2.2 * NAMESPACE: add registerPlugin function * R/Attributes.R: add registerPlugin function; add plugins parameter to cppFunction * man/cppFunction.Rd: documentation updates * man/pluginsAttribute.Rd: documentation updates * man/registerPlugin: documentation updates 2014-01-11 JJ Allaire * R/Attributes.R: initial support for Rcpp::plugins attribute; add built-in cpp11 plugin * src/attributes.cpp: initial support for Rcpp::plugins attribute 2014-01-04 JJ Allaire * R/Attributes.R: null check on pkginfo depends field 2013-01-02 Dirk Eddelbuettel * src/Timer.cpp (Rcpp): Applied refinement of previously applied patch re *BSD builds, see http://bugs.debian.org/697032 for more 2012-12-30 Dirk Eddelbuettel * src/Timer.cpp (Rcpp): Added defined() tests for more *BSD family members as the build also failed with the FreeBSD Kernel on Debian 2012-12-27 Dirk Eddelbuettel * src/Timer.cpp (Rcpp): Applied patch kindly supplied by Rainer Hurling to support compilation on FreeBSD 2012-12-26 JJ Allaire * R/Attributes.R: return invisibly from void functions * src/attributes.cpp: return invisibly from void functions 2012-12-21 Romain Francois * NAMESPACE : remove C++ObjectS3 and C++ClassRepresentation classes * R/00_classes.R: remove unused S4 classes * src/internal.h: added Rcpp_PreserveObject, Rcpp_ReleaseObject and Rcpp_ReplaceObject as replacements to R_ versions. The back end of the Rcpp_ version is a list (generic vector) instead of a linked list and is faster * src/Module.cpp: more debugging * src/barrier.cpp: added get_Rcpp_protection_stack used in the new stack system for protecting/releasing objects in Rcpp * src/api.cpp: implemetation of Rcpp_PreserveObject, Rcpp_ReleaseObject and Rcpp_ReplaceObject. RObject::setSEXP now uses the new system. The RObject(SEXP) constructor now directly uses Rcpp_PreserveObject More debugging for the RObject class Changes in api classes to better use the new protection system * unitTests/cpp/language.cpp: hosting unit test in sourceCpp form * unitTests/runit.Language.R: update unit tests * unitTests/runit.Module.client.package.R: remove code that has been commented for ages * include/Rcpp/DottedPair.h: better use of the RObject constructor * include/Rcpp/vector/Vector.h: better use of the RObject constructor * include/Rcpp/vector/Matrix.h: Using update_matrix instead of the virtual update which has been removed. * include/Rcpp/Module.h : more careful about types and constructors * include/Rcpp/XPtr.h: more debugging * include/Rcpp/macros/debug.h: more debugging macros * include/Rcpp/module/class_Base.h: using classes instead of SEXP * include/Rcpp/module/class.h: using classes instead of SEXP * include/Rcpp/generated/Language__ctors.h : using update_language_object instead of the virtual update which has been removed. * include/Rcpp/api/meat/Vector.h : using update_vector instead of the virtual update that has been removed, more debugging * include/Rcpp/api/meat/Matrix.h : more debugging, using update_matrix instead of the virtual update which has been removed * include/Rcpp/Language.h : added update_language_object to replace update which was virtual * include/Rcpp/RObject.h : only keep declarations here 2012-12-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.2 * inst/NEWS.Rd: Release 0.10.2 * inst/include/Rcpp/config.h: Release 0.10.2 * debian/*: Similarly updated for new release to Debian * inst/doc/unitTests/Rcpp-unitTests.R: added one more variable so that unitTest vignette can be built against new sourceCpp based files 2012-12-15 Romain Francois * include/Rcpp/exceptions.h: added exception_to_r_condition * exceptions.cpp: new implementation of forward_exception_to_r that directly calls stop rather than a function in Rcpp * R/exceptions.R: remove code rendered useless * src/Rcpp_init.c: less exports * src/api.cpp: less going back to the R side 2012-12-14 Romain Francois * include/Rcpp/sugar/functions/clamp.h: clamp was pretty wrong * unitTests/runit.sugar.R: new unit test for clamp * unitTests/cpp/sugar.cpp: new unit test for clamp 2012-12-12 JJ Allaire * src/Attributes.R: always generate new dynlib file for rebuild=TRUE * src/attributes.cpp: set svn:eol-style to native; always generate new dynlib file for rebuild=TRUE; don't declare attributes constant strings extern 2012-12-12 Romain Francois * include/Rcpp/Symbol.h: c_str becomes const and added Symbol::operator==(const char* ) 2012-12-11 JJ Allaire * R/Attributes.R: always print output when shared library is not created * src/attributes.cpp: consolidate attributes into single file * src/Attributes.cpp: consolidate attributes into single file * src/AttributesGen.h: consolidate attributes into single file * src/AttributesGen.cpp: consolidate attributes into single file * src/AttributesParser.h: consolidate attributes into single file * src/AttributesParser.cpp: consolidate attributes into single file * src/AttributesTypes.h: consolidate attributes into single file * src/AttributesUtil.h: consolidate attributes into single file * inst/NEWS.Rd: additional notes on changes to attributes * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: update for changes to attributes in 0.10.2 2012-12-11 Romain Francois * include/Rcpp/String.h: missing operator +=( const StringProxy& ) * include/Rcpp/sugar/functions/strings/strings.h : string sugar functions * include/Rcpp/sugar/functions/strings/collapse.h : collapse function, implementing paste( . , collapse = "" ) * include/Rcpp/complex.h: operator==( Rcomplex, Rcomplex ) * src/api.cpp: implementation of operator==(Rcomplex, Rcomplex) * include/Rcpp/vector/Vector.h: added const version of operator[](string) 2012-12-10 JJ Allaire * R/Attributes.R: warn when depends attribute is not matched with required entries in package description; add Rtools to PATH for duration of sourceCpp * src/Attributes.cpp: warn when depends attribute is not matched with required entries in package description * src/AttributesGen.cpp: prune unnecessary includes from RcppExports * src/Timer.cpp: fix timer build issues on windows 2012-12-10 Romain Francois * src/api.cpp: import r_cast.cpp, coerce.cpp, RcppCommon.cpp and debugging.cpp content * include/platform/compiler.h: put here compiler specific deduction things * src/internal.h: new header to host function declarations for routines that are not exported into Rcpp.h * src/Rcpp_init.c: export capabilities (renamed rcpp_capabilities) * include/Rcpp/traits/traits.h: master file for all traits includes * include/Rcpp/macros/macros.h: master file for all macros includes * include/Rcpp/DataFrame.h: just have declaration for DataFrame * include/Rcpp/Benchmark/Timer.h: move it into the Rcpp:: namespace * include/Rcpp/cache.h: clean * include/Rcpp/Reference.h : field was declared const and should not be. added a ConstFieldProxy class for read only use 2012-12-09 Romain Francois * src/api.cpp: merge many .cpp files here to reduce compile time * src/barrier.cpp: merge with cache.cpp to reduce compile time * include/Rcpp/exceptions.h: drop forward_uncaught_exceptions_to_r * src/exceptions.cpp: drop forward_uncaught_exceptions_to_r * src/Date.cpp: merge all Date related files 2012-12-08 Romain Francois * src/Timer.cpp: implementation of Timer * include/Rcpp/Benchmark/Timer.h: internal performance timer, based on the code from the microbenchmark package * include/Rcpp/api/meat/Matrix.h: move more in Matrix meat * src/Date.cpp: import the code from posixt.cpp 2012-12-07 JJ Allaire * src/AttributesGen.cpp: use __ prefix for variables in generated code; add RNGScope for attribute exported functions. 2012-12-07 Romain Francois * src/random.cpp: instantiations of random generators here * include/Rcpp/stats/random/random.h: only have declarations of random generators here. Rework the Generator template so that it inherits RNGScope to provide automatic calls to GetRNGstate and PutRNGstate 2012-12-06 JJ Allaire * R/Attributes.R: revert DOS newlines; use new shared library name for each rebuild in sourceCpp * src/Attributes.cpp: revert DOS newlines; define RCPP_NO_SUGAR; use new shared library name for each rebuild in sourceCpp * src/AttributesGen.cpp: revert DOS newlines; convert 'try-error' to exception for C++ interfaces * src/AttributesGen.h: 'try-error' to exception for C++ interfaces * src/AttributesParser.cpp: revert DOS newlines; define RCPP_NO_SUGAR * src/RcppCommon.cpp: conversion from exeption to 'try-error' * include/Rcpp/exceptions.h: conversion from exeption to 'try-error' * include/Rcpp/preprocessor.h: add END_RCPP_RETURN_ERROR macro to convert exceptions to 'try-error' objects * include/Rcpp/iostream/Rstreambuf.h: revert DOS newlines * DESCRIPTION: bump version to 0.10.1.5 2012-12-06 Dirk Eddelbuettel * src/exceptions.cpp: Added include of cstdlib to compile 2012-12-06 Romain Francois * include/Rcpp/api/meat/Environment.h: meat for Environment * src/exceptions.cpp: include config so that it knows that Rcpp can demangle * unitTests/runit.environments.R: using sourceCpp * src/Environment.cpp: less includes * src/Evaluator.cpp: less includes 2012-12-05 Romain Francois * src/cache.cpp: added get_cache * include/Rcpp/hash/IndexHash.h: use a cached integer vector for the hash table payload. The cache vector increases as needed. * include/Rcpp/iostream/Rostream.h: make Rostream a template * include/Rcpp/iostream/Rstreambuf.h: make Rstreambuf a template * src/AttributesGen.cpp : include exceptions.h which was included implicitely by Rostream.h before * include/Rcpp/macros/debug.h : factor out the debugging macros * include/Rcpp/api/meat/RObject.h : only declare templates that use as and wrap. they are implemented later in the meat directory * include/Rcpp/api/meat/meat.h: directory containing implementations of templates using as and wrap * include/RcppCommon.h: removed unused test_named * src/RcppCommon.cpp: removed unused test_named * src/r_cast.cpp: less includes * src/posixt.cpp: less includes 2012-12-05 JJ Allaire * src/Attributes.R: direct hookup of external ptr in sourceCpp * src/Attributes.cpp: use code generation for compileAttributes; direct hookup of external ptr in sourceCpp * src/AttributesGen.cpp: use code generation for compileAttributes; direct hookup of external ptr in sourceCpp * src/AttributesGen.h: use code generation for compileAttributes; direct hookup of external ptr in sourceCpp * src/Module.cpp: fix typo in GetCppCallable * include/Rcpp/iostream/Rstreambuf.h: add cstdio include * DESCRIPTION: bump version to 0.10.1.4 2012-12-04 Dirk Eddelbuettel * inst/include/Rcpp/hash/hash.h: Added include inttypes.h for intptr_t 2012-12-04 JJ Allaire * R/Attributes.R: use simple code generation for sourceCpp * src/Attributes.cpp: move generators into their own source file; use simple code generation for sourceCpp * src/AttributesGen.cpp: move generators into their own source file; add C++ default argument parsing * src/AttributesGen.h: move generators into their own source file * src/AttributesParser.cpp: move generators into their own source file * src/AttributesParser.h: move generators into their own source file * src/AttributesTypes.h: new header for attributes types * src/AttributesUtil.h: new header for attributes utilities 2012-12-04 Romain Francois * include/Rcpp/hash/hash.h: new implementation of IndexHash, based on Simon's fastmatch package * include/Rcpp/sugar/functions/match.h: more efficient version of match using new IndexHash * include/Rcpp/sugar/functions/unique.h: more efficient version of unique and in using IndexHash * include/Rcpp/sugar/functions/duplicated.h: more efficient version of duplicated and in using IndexHash * include/Rcpp/sugar/functions/self_match.h: more efficient version of self_match and in using IndexHash * include/Rcpp/vector/Vector.h: more efficiently create Vector from sugar expression that are already vectors, i.e. grab the SEXP 2012-12-03 Dirk Eddelbuettel * inst/include/RcppCommon.h: Applied patch kindly contributed by Yan Zhou which provides a number of more refined definition for support of both the C++11 standard and different compilers * inst/include/Rcpp/internal/wrap.h: Idem * inst/include/Rcpp/sugar/sugar.h: Idem * inst/include/Rcpp/traits/comparator_type.h: Idem * inst/include/Rcpp/vector/Vector.h: Idem * inst/unitTests/runit.wrap.R: Idem * src/RcppCommon.cpp: Idem * DESCRIPTION: Increase minor dev. version once more 2012-12-03 JJ Allaire * R/Attributes.R: added function to check whether R development tools are currently installed 2012-12-03 Romain Francois * src/Module.cpp: move BEGIN_RCPP/END_RCPP to Module__invoke * src/coerce.cpp: added coerce_to_string implementations * include/RcppCommon.h : nicer formatting for RCPP_DEBUG_*, now up to RCPP_DEBUG_5 * include/Rcpp/vector/Vector.h: debugging * include/Rcpp/String.h: The String class * include/Rcpp/as.h: support for String * include/Rcpp/vector/converter.h : support for String * include/Rcpp/vector/string_proxy.h: support for String * include/Rcpp/internal/wrap.h : support for String * include/Rcpp/internal/r_coerce.h: support for String * include/Rcpp/sugar/functions/sapply.h: debugging * include/Rcpp/traits/wrap_type_traits.h: support for String * include/Rcpp/traits/r_type_traits.h: support for String * unitTests/cpp/String.cpp : unit tests for String * unitTests/runit.String.R: unit test for String * include/Rcpp/sugar/sets.h: support for String 2012-12-01 Dirk Eddelbuettel * inst/include/RcppCommon.h: Applied patch by Yan Zhou to add support for clang++ with libc++, and Intel's icpc when std=c++11 2012-11-29 Romain Francois * unitTests/runit.DataFrame.R: using sourceCpp * include/Rcpp/vector/Matrix.h: fix yet another const correctness issue 2012-11-27 Dirk Eddelbuettel * inst/include/Rcpp/iostream/Rostream.h: Check before deleting buf 2012-11-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.1 * inst/NEWS.Rd: Release 0.10.1 * inst/include/Rcpp/config.h: Release 0.10.1 * debian/*: Similarly updated for new release to Debian * DESCRIPTION: Added paragraph about Rcpp attributes * debian/control: Idem 2012-11-26 Romain Francois * include/Rcpp/Module.h: comment out the unused and unuseable converter overload. * include/Rcpp/sugar/functions/pmin.h: be consistent about how the pmin_op helper struct is defined (always a struct). * include/Rcpp/sugar/functions/pmax.h: same for pmax * include/Rcpp/stats/random/rbeta.h: fixed constructor issue * unitTests/runit.sugar.R: rework to use sourceCpp instead of inline * include/Rcpp/vector/Vector.h: added ctor to deal with SingleLogicalResult * include/Rcpp/vector/Matrix.h: another const correctness fix 2012-11-25 JJ Allaire * R/Attributes.R: use echo = TRUE for sourceCpp R code chunks * src/Module.cpp: BEGIN_RCPP/END_RCPP in InternalFunction_invoke * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: add documentation on correct semantics for signaling error conditions 2012-11-24 JJ Allaire * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: expand discussion of binary compatibility issues. 2012-11-23 Romain Francois * src/AttributesParser.cpp : attempt to fix build issue on r-forge * include/Rcpp/DataFrame.h: nrows() method * include/Rcpp/vector/RangeIndexer.h: now derives from VectorBase so that we can use it in sugar. 2012-11-22 JJ Allaire * include/exceptions.h: new exception constructor / stop function * src/exceptions.cpp: new exception constructor / stop function * include/RcppCommon.h: new exception constructor / stop function 2012-11-22 Romain Francois * include/Rcpp/iostream.h: use delete rdbuf() as recommended by Martyn Plummer * include/Rcpp/sugar/functions/self_match.h: self_match, giving a functionality similar to match( x, unique(x) ) * src/coerce.cpp: added coercion to STRSXP * include/Rcpp/internal/r_coerce.h : added r_coerce<.,STRPSXP> * include/Rcpp/sugar/functions/table.h: sugar table * include/Rcpp/sugar/functions/duplicated.h: sugar duplicated 2012-11-21 JJ Allaire * R/Rcpp.package.skeleton.R: add 'attributes' and 'cpp_files' parameters to Rcpp.pacakge.skeleton * inst/skeleton/rcpp_hello_world_attributes.cpp: version of hello world that uses attributes * man/Rcpp.package.skeleton.Rd: doc updates * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: doc updates * DESCRIPTION: bump version to 0.10.0.3 2012-11-21 Dirk Eddelbuettel * inst/examples/Misc/piBySimulation.r: New simple example using Rcpp attributes in a 'compute pi by simulation in R and C++' exercise * inst/examples/Misc/piSugar.cpp: Corresponding C++ variant 2012-11-21 Romain Francois * include/Rcpp/iostream/Rostream.h: Fix warning given by -Wreorder * include/Rcpp/sugar/functions/mapply/mapply_3.h: more flexible * include/Rcpp/vector/Vector.h: More efficient assign_object, which is used in the assignment operator * include/Rcpp/sugar/functions/clamp.h: added clamp function 2012-11-20 JJ Allaire * src/Attributes.cpp: ensure dynlib cache state is always updated * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: elaborate further on exporting C++ interfaces from packages 2012-11-20 Romain Francois * include/Rcpp/iostream/Rostream.h: change order of initiaization in ctor. was making solaris compiler unhappy * include/Rcpp/stats/random/rnorm.h: not using function pointer generators, as this generates (anachronisms) warning on solaris. Also, this version is more efficient since there is no need to dereference the function pointer 2012-11-19 JJ Allaire * src/AttributesParser.h: support for argument default values * src/AttributesParser.cpp: support for argument default values * src/Attributes.cpp: support for argument default values * man/exportAttribute.Rd: documentation updates * man/compileAttributes.Rd: documentation updates * man/sourceCpp.Rd: documentation updates * inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw: add documentation on changes to attributes in 0.10.1 2012-11-18 JJ Allaire * R/Attributes.R: sourceCpp embedded R code; print warning if no export attributes are found in source file * src/AttributesParser.h: sourceCpp embedded R code * src/AttributesParser.cpp: sourceCpp embedded R code; new scheme for mixing user and generated C++ headers * src/Attributes.cpp: sourceCpp embedded R code; include above generated modules * man/sourceCpp.Rd: documentation updates * man/interfacesAttribute.Rd: documentation updates 2012-11-18 Romain Francois * include/Rcpp/vector/converter.h: allow CharacterVector::create( NA_STRING ) * include/Rcpp/sugar/functions/mapply/mapply_2.h: more cases in mapply 2012-11-17 Dirk Eddelbuettel * inst/doc/Rcpp-modules/Rcpp-modules.Rnw: Change free function name 'range' to 'uniformRange' to protect it from getting clobbered by the new sugar function range. 2012-11-17 Romain Francois * include/Rcpp/internal/wrap_end.h: have calls to wrap as late as possible so that they "see" all (potentially user defined) overloads of wrap. * include/Rcpp/internal/SEXP_Iterator.h: directly iterate over SEXP. const iterator for List and ExpressionVector 2012-11-16 Romain Francois * include/Rcpp/vector/Vector.h : added static methods Vector::is_na and Vector::get_na * include/Rcpp/sugar/functions/setdiff.h: initial version of setdiff and intersect * include/Rcpp/vector/MatrixColumn.h: dealing with const-ness * include/Rcpp/vector/MatrixRow.h: dealing with const-ness * include/Rcpp/vector/traits.h: dealing with const-ness * include/Rcpp/vector/proxy.h: dealing with const-ness * include/Rcpp/vector/MatrixBase.h: dealing with const-ness * include/Rcpp/vector/Vector.h: dealing with const-ness 2012-11-15 Romain Francois * include/Rcpp/sugar/logical/SingleLogicalResult.h : apply patch suggested by Karl Millar * R/Attributes.R: new R function areMacrosDefined * man/evalCpp.Rd: documentation update * include/Rcpp/sugar/functions/match.h : generic version of match * include/Rcpp/sugar/tools/iterator.h: help iterator that helps writing match in terms of stl algorithms. * include/Rcpp/vector/Vector.h: class no_init that can be used to create an uninitialized vector. e.g. IntegerVector out = no_init(10) ; * include/Rcpp/sugar/functions/unique.h: sugar version of %in% using unordered_set * include/Rcpp/sugar/functions/minmax.h: min, max, and range 2012-11-14 JJ Allaire * src/Attributes.cpp: create sourceCpp context list using single statement 2012-11-14 Dirk Eddelbuettel * inst/announce/ANNOUNCE-0.10.0.txt: Fix typo spotted by Martin Morgan in announcement mail 2012-11-14 Romain Francois * include/Rcpp/internal/wrap.h: fix for wrap( std::complex ) * include/Rcpp/module/class_Base.h: factored out from Module.h * R/00_classes.R: the C++Class gains the parents slot to hold information about parent classes of the class * src/Module.cpp : The CppClass constructor fills the parents slot of C++Class 2012-11-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.10.0 * inst/NEWS: Release 0.10.0 * inst/include/Rcpp/config.h: Release 0.10.0 * debian/*: Similarly updated for new release to Debian 2012-11-13 Romain Francois * include/Rcpp/as.h: as * include/Rcpp/internal/wrap.h : wrap( enum ) * include/Rcpp/traits/wrap_type_traits.h: trait to help wrap( enum ) * include/Rcpp/traits/r_type_traits.h: trait to help as * include/Rcpp/module/macros.h: macros RCPP_EXPOSED_ENUM to help as/wrap of enums 2012-11-12 Dirk Eddelbuettel * inst/announce/ANNOUNCE-0.10.0.txt: Announcement draft 2012-11-12 JJ Allaire * inst/doc/Rcpp-attributes/*: New vignette 2012-11-12 Romain Francois * include/Rcpp/vector/Vector.h : adding const_iterator and associated begin() and end() methods * include/Rcpp/vector/Matrix.h : idem 2012-11-11 JJ Allaire * src/Attributes.cpp: fully qualify _ in generated code 2012-11-11 Romain Francois * include/Rcpp/iostream/Rstreambuf.h: implementing sync() so that flush works * src/Rstreambuf.cpp: implementation * src/Rostream.cpp : added Rcerr that forwards to REprintf 2012-11-10 JJ Allaire * R/Attributes.R: ensure function definitions are never stale * src/Attributes.cpp: add optional hook for inclusion of package types * examples/Attributes/Export.cpp: example use of Rcpp::export * examples/Attributes/Depends.cpp: example use of Rcpp::depends * examples/Attributes/sourceCpp.R: example use of sourceCpp() * examples/Attributes/cppFunction.R: example use of cppFunction() 2012-11-09 Romain Francois * R/Attributes.R: Passing verbose from evalCpp to cppFunction * include/RcppCommon.h: include instead of * include/Rcpp/vector/CharacterVectorExtractionIterator.h: iterator class to quickly iterate over the content of a CharacterVector. The content that is iterated over is to be considered read-only. 2012-11-08 JJ Allaire * R/Attributes.R: special sourceCpp handling for file within the src directory of a package; use .h as suffix for generated headers * src/Attributes.cpp: add information on arguments to Rcpp module; use inline rather than static linkage for generated C++ shims; generated headers: add header guard and use .h suffix; * man/cppFunction.Rd: update documentation * man/sourceCpp.Rd: update documentation * man/evalCpp.Rd: update documentation * man/exportAttribute.Rd: update documentation * man/interfacesAttribute.Rd: update documentation 2012-11-08 Romain Francois * R/Module.R: Module functions taking no arguments don't get the ellipsis anymore in their formals * src/Module.cpp: passing up the number of arguments of the function * R/Attributes.R: added evalCpp * man/evalCpp.Rd: documentation for evalCpp 2012-11-07 JJ Allaire * R/Attributes.R: derive depends from package LinkingTo; change sourceCpp plugin parameter to depends and respect Rcpp::interfaces generated include files * src/Attributes.cpp: validate exported C++ functions before calling; use static rather than inline for stubs to avoid call-site bloat; improved error message when package hpp already exists; import Rcpp namespace into package shim namespace * src/AttributesParser.h: add signature and isHidden methods * src/AttributesParser.cpp: add signature and isHidden methods * src/exceptions.cpp: add function_not_exported exception * include/Rcpp/exceptions.h: add function_not_exported exception * man/cppFunction.Rd: update documentation * man/sourceCpp.Rd: update documentation * man/compileAttributes.Rd: update documentation * man/dependsAttribute.Rd: update documentation * man/exportAttribute.Rd: update documentation * man/interfacesAttribute.Rd: update documentation 2012-11-07 Romain Francois * src/Language.cpp: Language gains a fast_eval method, without the whole try/catch * src/barrier.cpp: function char_nocheck to avoid the check in using CHAR * include/Rcpp/sugar/functions/unique.h: sugar unique and sort_unique using unordered_set (perhaps we could use it from c++11). 2012-11-06 JJ Allaire * R/Attributes.R: tweak whitespace in verbose mode * src/AttributesParser.h: support for interfaces attribute * src/AttributesParser.cpp: support for interfaces attribute * src/Attributes.cpp: support for interfaces attribute; refactor code generators; use single module for exports; return list of updated files from compileAttributes * src/Module.cpp: add package parameter to GetCppCallable * include/Rcpp/Module.h: add package parameter to GetCppCallable * man/compileAttributes.Rd: documentation updates 2012-11-05 Romain Francois * include/Rcpp/Module.h: added class CppInheritedProperty to handle inherited properties * include/Rcpp/module/class.h: implemented inheritance of properties 2012-11-05 JJ Allaire * R/Attributes.R: use modules for attribute code generation * src/Attributes.cpp: use modules for attribute code generation * src/AttributesParser.h: use modules for attribute code generation * src/AttributesParser.cpp: use modules for attribute code generation 2012-11-04 Dirk Eddelbuettel * tests/doRUnit.R: In "development releases" (such as 0.9.15.5) we now default to setting the required CRAN-test-workaround-kludge "RunAllRcppTests" to "yes" as a default -- but not for actual releases (with versions such as 0.9.15) 2012-11-04 Romain Francois * include/Rcpp/module/CppFunction.h: fixed module bug (virtual function was not defined) 2012-11-03 JJ Allaire * Use CLINK_CPPFLAGS rather than PKG_CXXFLAGS for LinkingTo include directories (identical behavior to inline) 2012-11-03 Romain Francois * include/Rcpp/sugar/functions/which_min.h : sugar which.min * include/Rcpp/sugar/functions/which_max.h : sugar which.max * include/Rcpp/module/Module.h : added get_function_ptr which returns the pointer of the target function as a DL_FUNC 2012-11-02 Dirk Eddelbuettel * inst/unitTests/runit.rmath.R: More tests added 2012-11-02 Romain Francois * include/Rcpp/module/CppFunction.h : factored CppFunction in its own file and added the get_function_ptr virtual method. added documentation * include/Rcpp/module/Module_generated_CppFunction.h: implementation of get_function_ptr in classes that derive CppFunction * src/Module.cpp: s/get_function_ptr/get_function/ * include/Rcpp/module/Module.h : factored out and documented. s/get_function_ptr/get_function/ 2012-11-01 Dirk Eddelbuettel * inst/unitTests/runit.rmath.R: New unit test file added 2012-11-01 JJ Allaire * R/Attributes.R: change 'envir' param to 'env' for consistency with the interface of loadModule * man/sourceCpp.Rd: documentation updates * man/cppFunction.Rd: documentation updates 2012-11-01 Romain Francois * include/Rcpp/sugar/logical/or.h : implementing x | y where x and y are Logical sugar expressions * include/Rcpp/sugar/logical/and.h : implementing x & y where x and y are Logical sugar expressions 2012-10-31 JJ Allaire * R/Attributes.R: add cppFunction for inline-style definitions; change 'local' param to (more clear and explicit) 'envir' param; change 'show.output' param to 'showOutput'; add parameter to onBuild hook to indicate if the source was from a 'code' parameter * src/Attributes.cpp: factored parser into it's own file * src/AttributesParser.h: attributes parser header * src/AttributesParser.cpp: attributes parser implementation * man/sourceCpp.Rd: documentation updates * man/compileAttributes.Rd: documentation updates * man/cppFunction.Rd: documentation for cppFunction * NAMESPACE: export for cppFunction 2012-10-31 Romain Francois * include/Rcpp/module/class.h: factored out of Module.h which started to be too big. class_ gains a derives( "Parent" ) for so that the class inherits method that were exposed by its parent. * include/Rcpp/Module.h: template class CppInheritedMethod for implementing inherited method * src/Module.cpp: get_class_pointer implementation 2012-10-30 Dirk Eddelbuettel * inst/include/Rcpp/Rmath.h: Finalised adding Rmath functions 2012-10-30 JJ Allaire * R/Attributes.R: new functions sourceCpp and compileAttributes that use C++11 style attributes (embedded in comments) to perform automatic generation of boilerplate marshaling code * src/Attributes.cpp: support functions for attribute handling * include/Rcpp/exceptions.h: file io exception classes * man/sourceCpp.Rd: documentation for sourceCpp * man/compileAttributes.Rd: documentation for compileAttributes * man/exportAttriute.Rd: documentation for export attribute * man/dependsAttribute.Rd: documentation for depends attribute * NAMESPACE: exports for sourceCpp and compileAttributes 2012-10-30 Romain Francois * include/Rcpp/as.h: new bare_as to simplify uses of as * include/Rcpp/module/Module_generated_Factory.h: using bare_as * R/Module.R: promoting the show method * src/Attributes.cpp: remove g++ warning (int != size_t) 2012-10-29 Dirk Eddelbuettel * inst/include/Rcpp/Rmath.h: More Rmath functions 2012-10-29 Romain Francois * R/Module.R: Taking care of a check warning * include/Rcpp/module/macros.h: adding RCPP_EXPOSED_CLASS_NODECL * include/Rcpp/Module.h: introducing converter to facilitate conversion between classes. * R/Module.R: Methods registered internally with converter will generate the appropriate "as" S4 method. 2012-10-28 Dirk Eddelbuettel * inst/include/Rcpp/Rmath.h: Beginnings of a namespave 'R' around Rmath functions so that Rcpp users can call the (scalar) functions R::pnorm() which helps with adapting or integrating programs writting outside of Rcpp 2012-10-27 Dirk Eddelbuettel * inst/include/Rcpp/module/macros.h: Add forward declaration of class to macro 'RCPP_EXPOSED_CLASS' 2012-10-25 Romain Francois * include/Rcpp/internal/wrap.h: wrapping module object with the help of the RCPP_EXPOSED_CLASS * include/Rcpp/module/macros.h: improving the macros so that wrap and as are covered * include/Rcpp/traits/wrap_type_traits.h: wrapping module objects * include/Rcpp/module/Module_generated_class_factory.h : factories are alternatives to constructors. For now, we can expose as factories any free function that returns a pointer to the target class * include/Rcpp/module/Module_generated_Factory.h : factories * include/Rcpp/Module.h: exposing factories 2012-10-24 Romain Francois * include/Rcpp/traits/is_pointer.h: traits to identify if a type is a pointer * include/Rcpp/traits/un_pointer.h: traits to remove a pointer * include/Rcpp/module/Module_generated_get_return_type.h : handle pointer return types * include/Rcpp/config.h: define RCPP_HAS_DEMANGLING for MAC OS <= 10.7 (up to Lion) * include/Rcpp/module/macros.h: new file that contains macro to help with modules * include/Rcpp/traits/r_type_traits.h : new tag to allow as where T is some class exposed in a module * include/Rcpp/as.h : implementation of as in that case 2012-10-23 Romain Francois * include/Rcpp/internal/wrap.h: new function module_wrap used internally by modules * include/Rcpp/module/Module_generated_CppMethod.h: using module_wrap and simplified the code (removing 35% of the generated code now rendered useless) * include/Rcpp/module/Module_generated_PointerCppMethod.h: using module_wrap and simplified the code * include/Rcpp/traits/module_wrap_traits.h : new file. helping implementation of module_wrap * R/00_classes.R: C++OverloadedMethods gets the field "nargs" to capture the number of arguments * R/01_show.R: cleanup * R/Module.R: handle the case where a method has no argument. In that case, the ellipsis does not end up in the formals * include/Rcpp/Module.h: exposing nargs in C++OverloadedMethods 2012-10-22 Romain Francois * include/Rcpp/as.h: support for as<> for module objects * include/Rcpp/Module.h: idem * include/Rcpp/traits/r_type_traits.h: idem * src/Module.cpp: idem 2012-10-21 Romain Francois * include/Rcpp/traits/wrap_type_traits.h: support for wrapping module objects * include/Rcpp/internal/wrap.h : idem * include/Rcpp/Module.h: idem 2012-10-13 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.15 * inst/NEWS: Release 0.9.15 * inst/include/Rcpp/config.h: Release 0.9.15 * debian/*: Similarly updated for new release to Debian 2012-10-08 Dirk Eddelbuettel * src/exceptions.cpp: Additional PROTECT for parsing exception messages before returning them to R, from a suggestion by Ben North 2012-10-07 Dirk Eddelbuettel * inst/unitTests/runit.Date.R: Added a few more tests 2012-10-06 Dirk Eddelbuettel * inst/include/Rcpp/Date.h: Dates are now represented as doubles, also added accessor functions for double and retained int * src/Date.cpp: Convert from SEXP to double, added constructor from double and added checks for 'finite' representation before converting to 'struct tm' adding support for NA, NaN and Inf * src/DateVector.cpp: Instantiate Date types as double * src/Datetime.cpp: Also added support for NA, NaN and Inf values * inst/unitTests/runit.Date.R: A few additional tests 2012-10-05 Dirk Eddelbuettel * src/exceptions.cpp: Applied patch by Martin Morgan which untangles the clang includes driven by version, and uses direct tests for presence of the header file * inst/include/RcppCommon.h: No longer define CLANG version meta variables as we can directly include the relevant header 2012-09-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.14 * inst/NEWS: Release 0.9.14 * inst/include/Rcpp/config.h: Release 0.9.14 * debian/*: Similarly updated for new release to Debian 2012-09-08 Dirk Eddelbuettel * inst/unitTests/runit.sugarOps.R: More sugar Ops unit tests 2012-09-07 Dirk Eddelbuettel * inst/unitTests/runit.sugarOps.R: (Incomplete) beginnings of new unit test file for sugar operations on vectors and matrices 2012-09-07 Romain Francois * inst/include/Rcpp/sugar/functions/sign.h: Sign gets a SEXP operator 2012-09-03 Dirk Eddelbuettel * inst/include/Rcpp/sugar/functions/math.h: Added new sugar function trunc(), round() and signif() * inst/unitTests/runit.sugar.R: Added unit tests for these 2012-09-01 Dirk Eddelbuettel * inst/doc/Makefile: The 'all' target is now empty to prevent autobuilders such as R-Forge from falling over 2012-07-23 Dirk Eddelbuettel * R/bib.R: Trim the trailing ".bib" from the generated bibtex filename as Windows adds one anyway leading to two and an error 2012-07-21 Dirk Eddelbuettel * inst/include/Rcpp/Module.h (Rcpp): Corrected typo / incomplete reference in finalizer use 2012-07-06 Dirk Eddelbuettel * inst/include/Rcpp/config.h: In order to not attempt to include exception_defines.h if on OS X (as the clang runtime may not have predictable access to g++ headers providing these), do not define RCPP_HAS_DEMANGLING which is used in src/exceptions.cpp 2012-06-28 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.13 * inst/NEWS: Release 0.9.13 * inst/include/Rcpp/config.h: Release 0.9.13 * debian/*: Similarly updated for new release to Debian * tests/doRUnit.R: Updated, added (by default commented-out) setting to enforce all tests to run, added standard copyright headers noting heritage off work by Martin Maechler and Gregor Gorjanc * inst/unitTests/runTests.R: Only check environment variable to run all tests if it is not already set (to cooperate with doRUnit.R) 2012-06-27 Dirk Eddelbuettel * src/Environment.cpp: Default ctor initializes its RObject with R_GlobalEnv; SEXP constructor does not use a default arg as it tests * inst/include/Rcpp/Environment.h: Corresponding change * inst/include/RcppCommon.h: #define(s) for before/after clang++ 3.0 * src/exceptions.cpp: Added support for clang++ (>= 3.0) which (just like g++ 4.6 or later) needs bits/exceptions_defines * inst/unitTests/runit.modref.R: re-activated * inst/unitTests/runit.Module.client.package.R: re-activated core * inst/unitTests/runit.modref.R: Run only if RunAllCppTests var set * inst/unitTests/runit.Module.client.package.R: Idem * inst/unitTests/runit.support.R: Idem * inst/unitTests/runit.rcout.R: Idem * inst/unitTests/runit.environments.R: Idem * inst/unitTests/runit.Language.R: Idem * inst/unitTests/runit.Function.R: Idem 2012-06-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.12 * inst/NEWS: Release 0.9.12 * inst/include/Rcpp/config.h: Release 0.9.12 * debian/*: Similarly updated for new release to Debian * src/Environment.cpp: Remove empty constructor which is redundant since fix in rev3592 with default SEXP value of R_GlobalEnv * inst/include/Rcpp/Environment.h: Idem * inst/unitTests/runTests.R (allTests): Command-line flag --allTests sets an environment variable indicating that all tests should run * inst/unitTests/runit.Module.R: Run only if RunAllCppTests var set * inst/unitTests/runit.Module.client.package.R: Idem * inst/unitTests/runit.client.package.R: Idem * inst/unitTests/runit.XPtr.R: Idem * inst/unitTests/runit.macros.R: Idem * inst/doc/unitTests/Rcpp-unitTests.R: Ensure Rcpp-unitTests vignette is built with RunAllCppTests flag set * cleanup: Also clean in inst/unitTests/testRcppClass/src * DESCRIPTION: Set Maintainer: to edd@debian.org as CRAN prefers to receive upload email from the same address the Maintainer field 2012-06-22 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.11 * inst/NEWS: Release 0.9.11 * inst/include/Rcpp/config.h: Release 0.9.11 * debian/*: Similarly updated for new release to Debian * DESCRIPTION: Increased Depends to R (>= 2.15.1) 2012-06-21 Dirk Eddelbuettel * inst/doc/Rcpp-modules/Rcpp-modules.Rnw: Updated to reflect use under R 2.15.1 * inst/skeleton/zzz.R: Idem 2012-06-20 Dirk Eddelbuettel * R/loadRcppModules.R: Use lib.loc= argument on packageDescription() as suggested by Kurt, and fetch libname from enclosing environment * DESCRIPTION: Typo and grammar fixes with thanks to Kurt and Doug 2012-05-25 Dirk Eddelbuettel * inst/skeleton/zzz.R: Added new 'evalqOnLoad()' call for R-devel, currently commented out 2012-05-24 Dirk Eddelbuettel * inst/skeleton/Num.cpp: Added to Rcpp.package.skeleton(); will be added when module=TRUE in call * inst/skeleton/stdVector.cpp: Idem * inst/unitTests/testRcppModule/src/rcpp_module.cpp: added more comments, added copyright header, corrected output of example functions by not escaping "backslash-n" twice * inst/unitTests/testRcppModule/src/stdVector.cpp: added some comments, added copyright header * inst/unitTests/testRcppModule/src/Num.cpp: Idem * inst/unitTests/runit.Module.client.package.R: Added four simple tests for Rcpp Modules * inst/doc/Rcpp-modules/Rcpp-modules.Rnw: Some extensions and clarifications added 2012-05-13 Dirk Eddelbuettel * inst/include/Rcpp/iostream/Rostream.h: Added Rstreambuf.h include as per rcpp-devel discussion with Alexey Stukalov 2012-05-09 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Expanded R CMD SHLIB discussion after suggested changes from SC8ren HC8jsgaard; also expanded compiler section a little mentioning clang/clang++ and icc. 2012-05-02 Dirk Eddelbuettel * src/Environment.cpp: Move one default argument to Environment.h * src/Function.cpp: Move one default argument to Function.h * inst/THANKS: Thanks to Anirban Mukherjee for these two changes 2012-04-28 John M Chambers * R/RcppClass.R: use globalVariables() from R 2.15.1 (with exists() test to no break older versions) to declare C++ fields and methods * inst/unitTests/testRcppClass/R/load.R: test use 2012-04-22 Dirk Eddelbuettel * src/debugging.cpp: Expanded 'if defined()' test to included Cygwin thanks to a patch submitted by Dario Buttari 2012-04-19 Dirk Eddelbuettel * src/Evaluator.cpp: errorOccuredSym never used and commented out 2012-04-18 John M Chambers * R/RcppClass.R: New version of setRcppClass, allowing R classes to extend C++ classes used via Rcpp modules * R/loadModule.R: New function, replaces uses of .onLoad() * man/*: Added/updated corresponding documentation 2012-04-07 Romain Francois * inst/include/Rcpp/vector/Vector.h: bug fix. reported on Rcpp-devel http://comments.gmane.org/gmane.comp.lang.r.rcpp/3292 2012-03-29 Dirk Eddelbuettel * inst/unitTests/runit.Vector.R: unit test for containsElementNamed 2012-03-29 Romain Francois * inst/include/Rcpp/vector/Vector.h: Vector<> gains the containsElementNamed method to test for presence of named element 2012-03-24 Romain Francois * src/cache.cpp: Using a single Rcpp_cache, stored in the Rcpp namespace * src/Evaluator.cpp: Using tryCatch instead of rcpp_tryCatch, no more using .Internal; but still define rcpp_TryCatch for backwards compat. 2012-03-23 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added short subsection on how to test a package from the command-line, expanding a patch by Glenn Lawyer in response to an initial rcpp-devel post by Dirk 2012-02-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.10 * inst/NEWS: Release 0.9.10 * inst/include/Rcpp/config.h: Release 0.9.10 * debian/*: Similarly updated for new release to Debian 2012-02-16 Douglas Bates * src/Evaluator.cpp: PROTECT the expr argument to Evaluator::Run. Reorganize code. 2011-12-15 Douglas Bates * src/Evaluator.cpp: Avoid Rf_install inside an R API call 2012-02-12 Dirk Eddelbuettel * R/excections.R: Revert to previous use with .Internal * R/tools.R: Add branch for R 2.15.0 which can use assingInMyNamespace; else still use unlockBinding 2012-02-12 Dirk Eddelbuettel * Rcpp-introduction.Rnw: Small wording fix thanks to Pat Burns 2012-02-06 Romain Francois * R/exceptions.R: one less .Internal call * src/Evaluator.cpp: one less .Internal call 2012-02-03 Romain Francois * inst/include/Rcpp/Extractor.h: remove use of Fast in Extractor * inst/include/Rcpp/sugar/functions/mapply/mapply.h: new sugar function, similar to sapply, but with 2 or 3 (for now) input vectors 2012-02-01 Romain Francois * inst/include/Rcpp/iostream/Rostream.h: no need to include Rcpp.h here * inst/include/RcppCommon.h: include Rostream.h here, instead of ... * inst/include/Rcpp.h: ... here (needed for RcppArmadillo) 2012-01-29 Romain Francois * inst/include/Rcpp/sugar/diff.h: custom implementation of diff for the REALSXP case, skipping unnecessary NA tests 2012-01-24 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: New FAQ entry on passing a single option to g++, based on a rcpp-devel question by Whit Armstrong. 2012-01-15 Romain Francois * inst/include/Rcpp/vector/Vector.h: fixing IntegerVector(int,int), reported by Gregor Kastner on rcpp-devel * inst/unitTests/runit.Vector.R: regression test for the above 2011-12-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.9 * inst/NEWS: Release 0.9.9 * inst/include/Rcpp/config.h: Release 0.9.9 * debian/*: Similarly updated for new release to Debian 2011-12-24 Dirk Eddelbuettel * Reverting the 'int64' changes listed below (during the period from Oct-31 to Nov-07) which adversely affect packages using Rcpp We will re-apply the 'int64' changes in a way which should cooperate more easily with 'long' and 'unsigned long' This covered svn revisions 3264 to 3308. * DESCRIPTION: Remove (for now) Depends: on int64 * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Ditto for int64_t example * inst/unitTests/runit.Module.client.package.R: On Windows, deactivate 'test.Module.package' * inst/unitTests/runit.client.package.R: On Windows, deactivate 'test.client.packageA' test 2011-12-23 Dirk Eddelbuettel * inst/unitTests/runTests.R: unit tests output 'fallback' directory changed to '..' and files are now in top-level of $pkg.Rcheck/ 2011-12-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.8 * inst/NEWS: Release 0.9.8 * inst/include/Rcpp/config.h: Release 0.9.8 * debian/*: Similarly updated for new release to Debian 2011-12-20 Dirk Eddelbuettel * inst/skeleton/zzz.R (.onLoad): correct order of arguments 2011-12-18 Dirk Eddelbuettel * inst/examples/FastLM/lmArmadillo.R: Link with -llapack when using external Armadillo library (but RcppArmadillo makes all this easier) 2011-12-18 Romain Francois * inst/doc/*: Fixes to various vignettes for new version of highlight 2011-12-16 Douglas Bates * inst/unitTests/runit.stats.R: Correct cut+paste typo in qbinom * inst/include/Rcpp/XPtr.h: Check for XPtr type constructing from SEXP 2011-12-12 John M Chambers * R/RcppClass.R: Added setRcppClass for classes extending C++ classes * man/setRcppClass.Rd: Added corresponding documentation * NAMESPACE: Added corresponding exports entry 2011-11-13 Dirk Eddelbuettel * inst/include/Rcpp/stats/f.h: Correct call to not require ncp parameter * inst/unitTests/runit.stats.R: Add unit tests for pf(), pnf(), pchisq(), pnchisq() and pcauchy() 2011-11-07 Romain Francois * include/Rcpp/internal/wrap.h: implemented wrap_dispatch_importer__impl for int64 and uint64, needed for RProtoBuf * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Add int64_t usage example 2011-11-06 Romain Francois * include/Rcpp/modules/Module_generated_Pointer_method.h: added code to deal with const free "methods", e.g. OUT foo( const Class*, ...) in modules Before const_method could only deal with actual const methods of the class, e.g. OUT Class::foo( ... ) const * include/Rcpp/modules/Module_generated_Pointer_CppMethod.h: idem * include/Rcpp/as.h: deal with as and as * include/Rcpp/internal/export.h : deal with as< some_container > and as< some_container > where some_container is some container that has iterators, e.g. std::vector 2011-10-31 Romain Francois * include/Rcpp/int64/int64_lite.h: handling int64_t and uint64_t types, based on the int64 package * include/Rcpp/internal/wrap.h: new dispatch layers to handle int64_t, uint64_t and containers of these * DESCRIPTION: new depending on int64 2011-10-28 Dirk Eddelbuettel * inst/include/Rcpp/iostream/Rostream.h (Rcpp): Added tentative patch for operator<< also contributed by Jelmer Ypma -- but kept commented out for now 2011-10-25 Dirk Eddelbuettel * src/Rostream.cpp: Patch by Jelmer Ypma which adds a new device 'Rcout' not unlike std::cout but uses Rprintf internally * src/Rstreambuf.cpp: Idem * include/include/Rcpp/iostream/Rostream.h: Idem * include/include/Rcpp/iostream/Rstreambuf.h: Idem * include/include/Rcpp.h: Include new headers * inst/unitTests/runit.rcout.R: Added simple unit test 2011-09-29 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.7 * inst/NEWS: Release 0.9.7 * inst/include/Rcpp/config.h: Release 0.9.7 * debian/*: Similarly updated for new release to Debian * inst/include/Rcpp/sugar/block/SugarBlock_1.h: Apply second path by Martyn Plummer to permit compilation on Solaris * inst/include/Rcpp/sugar/block/SugarBlock_2.h: Idem * inst/include/Rcpp/sugar/block/SugarBlock_3.h: Idem * inst/include/Rcpp/sugar/matrix/outer.h: Idem * inst/include/Rcpp/vector/LazyVector.h: Idem * inst/unitTests/testRcppModule/src/stdVector.cpp: Idem 2011-09-24 Dirk Eddelbuettel * inst/include/Rcpp/Extractor.h: Apply patch by Martyn Plummer to help with compilation on Solaris * inst/include/Rcpp/sugar/block/Vectorized_Math.h: Idem * inst/include/Rcpp/sugar/functions/math.h: Idem * inst/include/Rcpp/sugar/block/SugarBlock_2.h: Also applied path by Martyn Plummer, but with additional #ifdef layer for SunPro Compiler * inst/include/Rcpp/vector/LazyVector.h: Idem 2011-08-26 Douglas Bates * inst/examples/OpenMP/OpenMPandInline.r: Added another variant using import_transform for the Rcpp Vector class. 2011-08-26 Dirk Eddelbuettel * inst/include/*h: Removed exception specifiers in function headers * src/*cpp: Corresponding changes in implementations * inst/examples/OpenMP/OpenMPandInline.r: Added two std::transform() variants as suggested in rcpp-devel email by Davor Cubranic 2011-08-25 Dirk Eddelbuettel * inst/examples/OpenMP/OpenMPandInline.r: Added new example for OpenMP via inline, comparing simple loops with plain Rcpp and sugar 2011-08-23 Dirk Eddelbuettel * inst/examples/Misc/ifelseLooped.r: Added new example based on blog post today, and a StackOverflow ansers---and which shows how Rcpp can accelerate loops that may be difficult to vectorise due to dependencies * inst/examples/Misc/: New directory for small examples regrouping the new example as well as the fibonacci example added in Rcpp 0.9.6 2011-08-17 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added a short section including an example on the issue raised by Murray wherein 64 bit 'long' integer types can be cast with loss to numeric types without error or warning. 2011-07-28 Dirk Eddelbuettel * inst/unitTests/runit.Function.R: new unit test for accessing a non-exported function from a namespace 2011-07-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.6 * inst/NEWS: Release 0.9.6 * inst/include/Rcpp/config.h: Release 0.9.6 * debian/*: Similarly updated for new release to Debian 2011-07-24 Dirk Eddelbuettel * inst/examples/Fibonacci/fib.r: New example showing how to compute a Fibonacci sequence using Rcpp and compare it to R and byte-compiled R 2011-07-14 Dirk Eddelbuettel * inst/examples/RcppGibbs/RcppGibbs.R: New example RcppGibbs, extending Sanjog Misra's Rcpp illustration of Darren Wilkinson's comparison of MCMC Gibbs Sampler implementations; * inst/examples/RcppGibbs/timeRNGs.R: added short timing on Normal and Gaussian RNG draws between Rcpp and GSL as R's rgamma() is seen to be significantly slower 2011-07-13 Romain Francois * inst/include/Rcpp/traits/is_eigen_base.h: helper traits to facilitate implementation of the RcppEigen package. The is_eigen_base traits identifies if a class derives from EigenBase using SFINAE * inst/include/Rcpp/internal/wrap.h: new layer of dispatch to help RcppEigen 2011-07-07 Romain Francois * inst/include/Rcpp/XPtr.h: The XPtr class template gains a second template parameter allowing the developper to supply his/her own finalizer instead of the default one that calls delete 2011-07-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.5 * inst/NEWS: Release 0.9.5 * inst/include/Rcpp/config.h: Release 0.9.5 * debian/*: Similarly updated for new release to Debian 2011-07-02 Dirk Eddelbuettel * cleanup: Also clean in examples/OpenMP/ 2011-06-09 Dirk Eddelbuettel * inst/skeleton/zzz.R (.onLoad): Force load of methods package before calling loadRcppModules() to make 'R CMD check' happier 2011-06-06 Romain Francois * inst/include/Rcpp/vector/Vector.h : init becomes protected to fix the bug reported by Doug Bates on Rcpp-devel. 2011-05-31 Romain Francois * R/loadRcppModules.R: New argument "direct" in loadRcppModules * R/tools.R: New unexported function forceAssignInNamespace 2011-05-29 Dirk Eddelbuettel * inst/include/Rcpp/stats/random/rlnorm.h: Repaired accidental header guard from 'norm' to 'lnorm' so that the file really gets included, make several calls to standard library 'exp()' explicit as '::exp()' and fixed a cut-and-paste typo 2011-05-24 Dirk Eddelbuettel * inst/include/Rcpp/internal/wrap.h: For arguments of type const char *, wrap now checks for NULL arguments before calling Rf_mkString() * unitTests/runit.wrap.R: Added unit test for this 2011-05-14 Dirk Eddelbuettel * inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw: Corrected an error in STL example and added two more STL examples 2011-04-27 Dirk Eddelbuettel * inst/examples/OpenMP/piWithInterrupts.cpp: Beginnings of new contributed example on OpenMP as well as user interrupt handling 2011-04-26 Romain Francois * inst/include/Rcpp/sugar/functions/mean.h: new sugar function: mean * inst/include/Rcpp/sugar/functions/var.h: new sugar function: var * inst/include/Rcpp/sugar/functions/sd.h: new sugar function: sd 2011-04-19 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: New example setting row and column names for matrices 2011-04-16 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: New example using Rcpp.plugin.maker 2011-04-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.4 * inst/NEWS: Release 0.9.4 * inst/include/Rcpp/config.h: Release 0.9.4 * debian/*: Similarly updated for new release to Debian 2011-04-12 Romain Francois * inst/unitTests/testRcppModules/src/stdVector.cpp: compiler disambiguation * src/r_cast.cpp: use a callback to R's "as.character" instead of calling Rf_coerceVector, which did not work as expected for factors 2011-04-11 Romain Francois * R/loadRcppModules.R: New R function "loadRcppModules" that looks for the "RcppModules" field in the DESCRIPTION file, loads and populates the modules into the package NAMESPACE * man/loadRcppModules.Rd: documentation * inst/unitTests/testRcppModule: using loadRcppModules 2011-04-11 Dirk Eddelbuettel * inst/man/Rcpp-package.Rd: Added JSS reference in \references{} * inst/doc/*: Added JSS reference to vignettes 2011-04-09 Dirk Eddelbuettel * inst/CITATION: Finalized using JSS data on volume, number, pages 2011-04-07 Dirk Eddelbuettel * inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw: Add patch by Christian pointing out need for Rcpp:: namespace qualifier, and hint for Rcpp-FAQ 2011-04-05 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added OS X entry for min. sufficient versions of OS X itself and Xode based on Simon's post to rcpp-devel 2011-04-05 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.3 * inst/NEWS: Release 0.9.3 * inst/include/Rcpp/config.h: Release 0.9.3 * debian/*: Similarly updated for new release to Debian 2011-04-05 Romain Francois * R/01_show.R: set of cosmetic changes to the show method for C++ classes * inst/include/Rcpp/Module.h: fixed module bug by not using singletons of the class_ template 2011-04-03 Dirk Eddelbuettel * inst/doc/Rcpp-introduction.Rnw: Updated to forthcoming JSS paper * inst/CITATION: Added citation() support using forthcoming paper * inst/doc/Makefile: Trying make parallel builds possible by not calling 'clean' in the 'all' target; thanks to Brian Ripley for the heads-up 2011-04-02 Dirk Eddelbuettel * cleanup: Also clean in inst/unitTest/testRcppModule/src/ * inst/include/RcppCommon.h: Define new variable for g++ < 4.6.0 * src/exceptions.cpp: Include up to g++-4.5 only * inst/unitTests/testRcppModule/src/stdVector.cpp: Use #ifdef not #if * inst/include/Rcpp/module/Module_generated_ctor_signature.h: Add a bit of null-op code to suppress a 'unused parameter' warning in the initial (and non-templated) ctor_signature() function 2011-03-21 Dirk Eddelbuettel * inst/unitTests/testRcppModule/src/stdVector.cpp: Protect push_back declaration by #ifdef as it conflicts with -std=c++0x use for g++-4.5 2011-03-17 Dirk Eddelbuettel * inst/include/RcppCommon.h: Condition the typedef for 'long long' of rcpp_long_long_type on the (still experimental) support for C++0x which can be enabled with the non-portable g++ flag '-std=c++0x'; adding a test for C++0x support suppresses a new warning with g++ about long long being part of C++98; thanks to Kurt Hornik for raising this 2011-03-10 Dirk Eddelbuettel * inst/include/Rcpp/grow.h: Applied another patch kindly supplied by Murray which fixes another clang/llvm and C++ conformance issue by re-ordering declarations as unqualified names must be declared before they are used, even when used within templates. 2011-02-28 Dirk Eddelbuettel * inst/doc/Makefile: Call R and Rscript relative to R_HOME/bin 2011-02-23 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.2 * inst/NEWS: Release 0.9.2 * inst/include/Rcpp/config.h: Release 0.9.2 * debian/*: Similarly updated for new release to Debian * inst/include/RcppCommon.h: Apply patch by Alexey Stukalov to enable basic Intel Compiler support without Cxx0x or TR1 features * inst/THANKS: Added some Thank You! to Baptiste, Alexey and Ken * inst/include/Rcpp/Module.h: Minor reworking of module loading macro to get rid of one g++ warning 2011-02-22 Dirk Eddelbuettel * inst/unitTests/runit.Module.client.package.R: Add a test for OS X 10.5.* or older and do not execute the test here as g++ 4.2.1 balks at some of the Rcpp modules code. Thanks to Simon Urbankek for pinning this down and Baptiste Auguie for additonal testing. 2011-02-20 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added RcppArmadillo example 2011-02-19 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added three more setup-related questions in the first section following another rcpp-devel question 2011-02-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.1 * inst/NEWS: Release 0.9.1 * inst/include/Rcpp/config.h: Release 0.9.1 * debian/*: Similarly updated for new release to Debian 2011-02-13 Dirk Eddelbuettel * inst/include/Rcpp/Module.h: Cache return of Rf_install("Module") in a static helper function used by the LOAD_RCPP_MODULE macro 2011-02-11 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Added two more examples 2011-02-10 Douglas Bates * inst/include/Rcpp/XPtr.h: Replace calls to EXTPTR_PTR with R_ExternalPtrAddr. The distinction is important when R is compiled with PROTECTCHECK enabled. 2011-02-01 Romain Francois * inst/include/Rcpp/vector/Vector.h: extra PROTECT'ion in several places 2011-01-25 Dirk Eddelbuettel * inst/include/Rcpp/DataFrame_generated.h: Assign Rf_install() result to local SEXP (by modifying generator script creating the file) * inst/include/Rcpp/DataFrame.h: Assign Rf_install() result to local SEXP * inst/include/Rcpp/DottedPair.h: idem * inst/include/Rcpp/grow.h: idem * inst/include/Rcpp/Module.h: idem * inst/include/Rcpp/vector/eval_methods.h: idem * inst/include/Rcpp/vector/Vector.h: idem 2011-01-25 Douglas Bates * src/exceptions.cpp: Assign Rf_install() result to local SEXP * src/Evaluator.cpp: idem * src/Reference.cpp: idem * src/S4.cpp: idem * inst/include/Rcpp/Date.h: Use predefined symbol. 2011-01-22 Dirk Eddelbuettel * src/cache.cpp: Assign Rf_install() result to local SEXP * src/Environment.cpp: idem * src/Evaluator.cpp: idem * src/Function.cpp: idem * src/Function.cpp: idem * src/RObject.cpp: idem * src/Symbol.cpp: idem * inst/doc/Rcpp.bib: Added SoDA (some time ago) 2011-01-13 Douglas Bates * src/Reference.cpp: Protect the value being set in Reference::FieldProxy::set 2011-01-11 Romain Francois * inst/include/Rcpp/vector/string_proxy.h: fix implicit conversion to int, reported by Daniel Sabanes Bove on Rcpp-devel * inst/unitTests/runit.vector.R: unit test for the above fix 2011-01-08 Dirk Eddelbuettel * inst/doc/Rcpp.bib: Updated a number of CRAN versions 2011-01-07 Dirk Eddelbuettel * inst/include/Rcpp/config.h (RCPP_VERSION): Set to 0.9.0, at last. 2011-01-06 Douglas Bates * R/zzz.R (.onLoad): Don't call init_Rcpp_cache here. * src/Rcpp_init.c: Don't register init_Rcpp_cache. It should only be called once and it is called in the C function R_init_Rcpp. * NAMESPACE: Use registered symbols instead of relisting them. Registration allows for checking the number of arguments. 2011-01-04 Dirk Eddelbuettel * src/debugging.cpp: Treat the *BSD flavours like Windows and offer file and line number but not stack trace (for lack of execinfo) * src/Makevars: Replace implicit variable $^ with explicit list 2011-01-02 Dirk Eddelbuettel * inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw: Applied patch with additional documentation by Christian Gunning 2010-12-23 Romain Francois * inst/include/Rcpp/RObject.h: New internal class SEXPstack to handle garbage collection. Presumably more efficient than R_PreserveObject and R_ReleaseObject * inst/include/Rcpp/sugar/operators/times.h: More efficient operator* for REALSXP sugar expressions, avoiding unnecessary NA tests. * inst/include/Rcpp/sugar/operators/divides.h: More efficient operator/ for REALSXP sugar expressions, avoiding unnecessary NA tests. * inst/include/Rcpp/sugar/operators/minus.h: More efficient operator- for REALSXP sugar expressions, avoiding unnecessary NA tests. 2010-12-22 Romain Francois * inst/include/Rcpp/sugar/operators/plus.h: More efficient operator+ for REALSXP sugar expressions, avoiding unnecessary NA tests. 2010-12-22 Dirk Eddelbuettel * inst/unitTests/runit.Vector.R: Applied patch by Christian Gunning to add more tests for complex-typed vectors 2010-12-20 Dirk Eddelbuettel * R/inline.R (Rcpp.plugin.maker): Reverse order in PKG_LIBS 2010-12-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.9.0 * debian/*: Similarly updated for new release to Debian 2010-12-18 Dirk Eddelbuettel * inst/announce/ANNOUNCE-0.9.0.txt: Started announcement post * inst/unitTests/runit.Date.R: Added new unit tests for date and datetime from string 2010-12-17 Dirk Eddelbuettel * inst/include/Rcpp/Datetime.h: correct default format to use %OS for fractional seconds and not the popular typo %OS (i.e. ooh, not zero) * src/Datetime.cpp: add missing as.POSIXct() after strptime for constructor from string as we then use the constructor from double * src/Date.cpp: add missing as.Date() after strptime for constructor from string as we then use the constructor from int 2010-12-13 Romain Francois * inst/include/Rcpp/vector/string_proxy.h: List::Proxy did not convert bool correctly, reported on Rcpp-devel by Daniel SabanC)s BovC) 2010-12-12 Romain Francois * R/SHLIB.R: new unexported R function SHLIB, small wrapper around R CMD SHLIB * inst/include/Rcpp/sprintf.h: returning a std::string to avoid leaks 2010-12-10 Dirk Eddelbuettel * inst/include/Rcpp/sprintf.h: Use vsnprintf() instead 2010-12-10 Romain Francois * inst/include/Rcpp/barrier.h: faster versions (crossing the write barrier) for string_elt, etc ...(to be used only internally) * src/barrier.cpp: implementation of the above 2010-12-09 John M Chambers * src/Module.cpp: Rcpp/src/exceptions.cpp, Rcpp/src/Rcpp_init.c, etc. add a not_initialized exception and a dummy_pointer to identify such objects, throw exc. back to R 2010-12-07 Romain Francois * inst/include/Rcpp/vector/matrix.h: Matrix gains a nested ::Sub typedef 2010-12-05 Romain Francois * inst/include/Rcpp/module/Module_generated_class_constructor.h: the default constructor was always considered valid because of the use of &yes instead of &yes_arity<0> * R/Rcpp.package.skeleton.R: Rcpp.package.skeleton( "foo", example_code = FALSE) did not work properly. Rcpp.package.skeleton gains some arguments 2010-12-05 Dirk Eddelbuettel * src/Date.cpp: Add 1900 to tm.year after mktime00() call as we now no longer assume the field is '1900-less' * src/Date.cpp: Define new static const variable baseYear as 1900 and use throughout * inst/unitTests/runit.Date.R (test.Date.getFunctions): Added unit tests for the get* functions of the Date class * R/bib.R (bib): Correct expression for default Rcpp bibtex file 2010-12-04 Dirk Eddelbuettel * inst/include/Rcpp/Date.h: Remove addition of 1900 in getYear() 2010-12-04 Romain Francois * inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw: documentation patch by Christian Gunnning * inst/include/Rcpp/vector/matrix.h: fix SubMatrix. Bug reported by Christian Gunnning on Rcpp-devel * inst/include/Rcpp/vector/SubMatrix.h: factored out of matrix.h * inst/include/Rcpp/sprintf.h: new sprintf template to format strings 2010-12-03 Dirk Eddelbuettel * inst/unitTests/runit.RObject.R: fix 'inherits' test added today * inst/include/Rcpp/module/Module_generated_Constructor.h: Applied patch by Tama Ma for up to seven args in ctor * inst/include/Rcpp/module/Module_generated_class_constructor.h: Idem * inst/include/Rcpp/module/Module_generated_ctor_signature.h: Idem 2010-12-03 Romain Francois * inst/include/Rcpp/RObject.h : new inline method inherits that checks if an object inherits from a given class (wrapper around Rf_inherits) * inst/unitTests/runit.RObject.R: unit test for the above 2010-12-02 Douglas Bates * inst/include/Rcpp/generated/Function__operator.h, inst/include/Rcpp/Function.h: operator() becomes const. 2010-11-29 Romain Francois * inst/include/Rcpp/vector/Vector.h: trying to please suncc after CRAN checks * R/Module.R: protect the module$refClassGenerators <- generators line against the case where there are no classes (triggered a problem with the parser package) 2010-11-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.9 * debian/*: Similarly updated for new release to Debian 2010-11-26 Romain Francois * inst/include/Rcpp/vector/Vector.h: List::create( _["foo"] ) sets the SEXP to R_MissingArg, usueful for formal arguments specifications, simpler form than List::create( _["foo"] = R_MissingArg ) * inst/include/Rcpp/macros/unroll.h: helper macro RCPP_UNROLL_LOOP * inst/include/Rcpp/vector/MatrixColumn.h: added MatrixColumn::operator=( MatrixColumn& ) otherwise it gets synthetized by the compiler * inst/include/Rcpp/vector/MatrixRow.h: same for MatrixRow * inst/include/Rcpp/vector/Matrix.h: added Matrix( SubMatrix ) and Matrix::operator=( SubMatrix ) 2010-11-25 Romain Francois * inst/include/Rcpp/module/Module_generated_function.h: new .function with formal argument specification * inst/include/Rcpp/module/Module_generated_CppFunction.h: helper classes for the above * R/Module.R: using the formal argument specification if available * R/populate.R: new R function populate to dump the contents of a module into an environment or a namespace * man/populate.Rd: documentation for populate 2010-11-24 Romain Francois * R/00_classes.R: formals<- method for C++Function that allows to set default arguments, etc .. to a C++ function 2010-11-23 Dirk Eddelbuettel * inst/doc/Makefile: Call Rscript with --vanilla to skip user settings 2010-11-23 Romain Francois * R/00_classes.R: C++Class gains a docstring slot to host self documentation * R/Module.R: calling an exposed C++ more efficiently by using the xp directly rather than traversing the map internally * R/00_classes.R: C++Function gains a docstring slot to host self documentation of the internal function. And a "signature" slot to host the C++ signature of the function * R/01_show.R: updated show( C++Function ) to display the docstring and the signature. updated show( C++Class ) to display the docstring. * inst/include/Rcpp/module/Module_generated_CppFunction.h: self documentation for exposed C++ functions and extraction of the signature * inst/include/Rcpp/module/Module_generated_function.h: idem 2010-11-22 Romain Francois * R/00_classes.R: C++OverloadedMethods gains an "info" class methods, factored out from Module.R * R/01_show.R: more information printed in show( C++Class ) * inst/include/Rcpp/Module/Module_generated_get_signature.h: templates to grab method signatures * inst/include/Rcpp/Module.h: CppMethod gains a signature method that returns the signature of the method. * R/00_classes.R: C++OverloadedMethods gains a "signatures" field that contains the signature of each overload * R/Module.R: registered method gain an automatically generated self description that contains the method(s) signature(s) and the docstring that is declared in .method * inst/include/Rcpp/Module/Module_generated_CppMethod.h: implement signature * inst/include/Rcpp/Module/Module_generated_Pointer_CppMethod.h: idem 2010-11-21 Romain Francois * R/Module.R: internal version of cpp_hasDefaultConstructor * src/Module.cpp: implementation (Class__has_default_constructor) * inst/include/Rcpp/Module.h: support (class_.has_default_constructor) * inst/include/Rcpp/module/Module_generated_class_constructor.h: new interface for exposing constructors, the init_ disappears and the template arguments are directly applied to the .constructor function * inst/include/Rcpp/module/Module_generated_Constructor.h: removed init_* * inst/include/Rcpp/module/Module_generated_method.h: .method gains a docstring argument to allow self documentation of exposed methods * inst/include/Rcpp/module/Module_generated_PointerMethod.h: idem * R/Module.R: grab method docstrings 2010-11-20 John M Chambers * R/Module.R: now checks for the existence of a default constructor for a C++ class and generates a suitable $initialize() method accordingly. 2010-11-20 Romain Francois * inst/include/Rcpp/vector/MatrixRow.h: added missing return *this ; * R/Module.R: dispatch based on void-ness of the methods. For example if all methods are known to be void, etc ... * R/00_classes.R: more information in the C++OverloadedMethods ref class * src/Module.cpp: new .External CppMethod__invoke_void and CppMethod__invoke_notvoid that are used when we know for sure that all overloaded methods are void, or not void * inst/include/Rcpp/Module.h: class_ gains invoke_void and invoke_notvoid to support the changes above 2010-11-18 Douglas Bates * inst/include/Rcpp/module/Module_generated_[class_]Constructor.h: allow up to 6 arguments to .constructor 2010-11-18 Romain Francois * inst/include/Rcpp/Module.h: rework the class_ template to allow overloaded methods * R/00_classes.R: The C++Method class disappears and the C++OverloadedMethods enters. a "C++OverloadedMethods" object points to a set of overloaded C++ methods that all share the same name. * R/Module.R: adapt some of the code to cope with changes above 2010-11-17 Romain Francois * inst/include/Rcpp/sugar/as_vector.h: added the as_vector function that turns a sugar matrix expression into a vector of the appropriate type * inst/include/Rcpp/vector/Matrix.h: new SubMatrix class 2010-11-13 Romain Francois * inst/include/Rcpp/Module.h: expose constructors as the "cpp_constructor" field of "C++ClassRepresentation" and the "constructors" slot of "C++Class" 2010-11-07 Romain Francois * inst/include/Rcpp/sugar/operators/minus.h: fixed Minus_Vector_Primitive * inst/unitTests/runit.sugar.R: new test for the above 2010-11-05 Romain Francois * inst/include/Rcpp/Module.h: exposing multiple constructors in modules * src/Module.cpp: The mangled class name is now "Rcpp_" plus the class name. The previous version used the address of the external pointer to the module, which was not constant. 2010-11-04 Douglas Bates * inst/include/Rcpp/module/Module_generated_Constructor.h: remove redundant 'return's. 2010-11-04 Romain Francois * inst/include/Rcpp/Module.h: experimental way to specify which constructor to use in classes exposed by modules. This is still too restrictive as it only allows one constructor. * inst/include/Rcpp/sugar/block/SugarMath.h: extend the SUGAR_MATH_1 macro so that we can apply functions (e.g. sqrt) directly on SEXP 2010-11-01 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.8.8 * debian/*: Similarly updated for new release to Debian 2010-10-30 Dirk Eddelbuettel * inst/include/RcppCommon.h: New define IS_GCC_450_OR_LATER * inst/include/Rcpp/Extractor.h: Do not enable Rcpp::Fast if g++ 4.5.0 or later is used -- we need to figure out what upsets it 2010-10-23 Romain Francois * inst/include/Rcpp/vector/MatrixRow.h: Faster row indexing * inst/include/Rcpp/vector/Matrix.h: added use of _ to get columns and rows of a matrix. For example if x is a NumericMatrix, x(_,i) returns the same as x.column(i) and x(i,_) returns the same as x.row(i) * inst/unitTests/runit.Matrix.R: unit tests for the above * inst/include/Rcpp/sugar/functions/sum.h: the sugar version of sum now takes care of missing values correctly * inst/include/Rcpp/sugar/functions/cumsum.h: sugar version of cumsum 2010-10-21 Romain Francois * inst/include/Rcpp/vector/MatrixColumn.h: Fixed indexing bug (mismatch between number of rows and number of columns * inst/unitTests/runit.Matrix.R: test fix above based on the R-help/Rcpp-devel thread: http://article.gmane.org/gmane.comp.lang.r.rcpp/851 * inst/include/Rcpp/vector/MatrixColumn.h: Column gains a operator= taking a sugar expression. Faster indexing (caching the pointer instead of calling nrow many times) * inst/include/Rcpp/vector/Matrix.h: first pass at making matrix indexing faster 2010-10-21 Dirk Eddelbuettel * inst/include/Rcpp/Module.h: Reorder instantiation for class_ 2010-10-20 Dirk Eddelbuettel * include/Rcpp/XPtr.h: Applied patch by Karl Millar * include/Rcpp/vector/Vector.h: Idem 2010-10-19 Dirk Eddelbuettel * src/posixt.cpp: Correct POSIXct, POSIXt ordering for R 2.12.0 2010-10-14 Dirk Eddelbuettel * DESCRIPTION (Version): Release 0.8.7 * debian/*: Similarly updated for new release to Debian 2010-10-10 Romain Francois * tests/doRUnit.R: workaround to disable tests on windows 64 until we can figure out what upsets R CMD check. * R/Module.R: expose the finalizer 2010-10-07 John M Chambers * R/Module.R: modify cpp_refMethods to substitute the .External directly with the method and class pointers. 2010-10-03 Dirk Eddelbuettel * inst/include/Rcpp/stats/random/r*: Added comment reminding users read up on Section 6.3 of "Writing R Extensions" and the need to call GetRNGstate() and PutRNGstate() when using R's RNGs 2010-09-30 Romain Francois * inst/include/Rcpp/vector/MatrixRow.h: Matrix row inherits VectorBase so that it becomes a sugar expression, so that we can do something like this: NumericMatrix x( ... ) ; NumericVector x0 = x.row(0) ; * inst/include/Rcpp/vector/MatrixColumn.h: idem for columns * cleanup: run make clean in the inst/doc directory to install the fake vignettes 2010-09-27 Romain Francois * inst/include/Rcpp/traits/is_sugar_expression.h: new trait class to recognize sugar expressions * inst/include/Rcpp/vector/Vector.h: operator=( sugar expression) no longer allocate unnecessary memory. 2010-09-26 Romain Francois * inst/include/Rpp/Fast.h: new helper class Rcpp::Fast that allows faster indexing of Vector * inst/include/Rcpp/sugar/operators/plus.h: port to operator+ the same improvements than in operator* 2010-09-25 Romain Francois * inst/include/Rcpp/routines.h: declare routines that are registered * src/Rcpp_init.c: register routines * R/*.R: use registration information in many .Call and .External functions to speed things up * inst/include/Rcpp/RangeIndexer.h: experimenting with loop unrolling 2010-09-24 John M Chambers * R/Module.R: modify cpp_fields to substitute the .Call directly with the field and class pointers; supplements the changes entered by Romain on 9-22. (svn rev 2165, 2141) * src/Rcpp_init.c: set up registration of .Call's (rev 2167) 2010-09-24 Romain Francois * inst/include/Rcpp/sugar/Range.h : Range gains some operators (++,--,n etc ...) * inst/examples/ConvolveBenchmarks/convolve3_cpp.cpp: using the new Range operators * inst/include/Rcpp/sugar/operators/times.h: speed improvements. Not using pointer to member functions seems to be beneficial. * inst/include/Rcpp/sugar/nona/nona.h: sugar function that wraps a sugar expression in an object that pretends it does not contain any missing values. This allows many sugar functions and operators to use their fast versions when we know that the object does not contain missing values. 2010-09-22 Romain Francois * R/Module.R: set [[ and [[<- as regular methods too, which restores previous behavior 2010-09-17 Romain Francois * src/Reference.cpp: new objects are created via a callback to R's new function, as R_do_new_object did always return the same environment * R/00_classes.R: new ref class C++Method to represent C++ methods and holding their external pointers directly (same idea as C++Field) * inst/include/Rcpp/Module.h: internal support for C++Method (template class S4_CppMethod) 2010-09-17 John M Chambers * R/00_classes.R, R/02_completion.R, et al.: use of environment underlying the reference classes removes need for slots in C++Object class (svn rev's 2133, 2134) 2010-09-16 Romain Francois * R/00_classes.R: moving classes definition here * inst/Rcpp/Module.h: added C++ class S4_field that builds S4 objects of class C++Field. Build the list of fields as part of the creation of the C++Class objects * src/Module.cpp: .Call functions CppField__get and CppField__set to get/set values of an object's field using external pointers directly (no std::map lookup internally) * R/Module.R: (unexported) functions .getField and .setField that call CppField__get and CppField__set * inst/include/Rcpp/Reference.h: skeleton for a Rcpp::Reference class that will help dealing with reference classes on the C++ side * src/Reference.cpp: implementation (needs update) 2010-09-16 John M Chambers * R/Module.R, tests/modRef.R: un-generic of new(); return a generator object for C++ classes. Use environment as superclass. 2010-09-15 Romain Francois * DESCRIPTION: added the declaration MinimumSvnRev to control which version of R-devel we need so that Rcpp fully works, currently set to 52905 * R/zzz.R: check the svn revision of R against the declared MinimumSvnRev requirement and print a message if necessary (this will only stay for the interim period while we develop 0.8.7 so that we all are on the same page. * inst/include/Rcpp/Module.h: added methods to class_Base : methods_arity and methods_voidness to query the number of arguments of methods of a class and if the method is void * R/Module.R: implement referenceMethods (from methods) for 'C++Class' 2010-09-11 Dirk Eddelbuettel * src/Date.cpp: Add include of unistd.h to make Solaris happy 2010-09-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.6 * debian/*: Similarly updated for new release to Debian 2010-09-08 Dirk Eddelbuettel * inst/include/RcppCommon.h: Also include typeinfo header file 2010-09-08 Romain Francois * inst/include/Rcpp/Module.h : added class_Base::property_names method to grab the names of all fields (properties) * src/Module.cpp : added R access (.Call) function CppClass__properties to grab the names of the fields (property) from the XP of a class * inst/include/Rcpp/Module.h : added class_Base::property_is_readonly method to query if a property is read only * src/Module.cpp : added R access (.Call) function CppClass__property_is_readonly to query if a class property is read only * inst/include/Rcpp/Module.h : added class_Base::property_class method to grab the C++ class of a property * src/Module.cpp : added R access (.Call) function CppClass__property_class to grab the C++ class of a property 2010-09-06 Dirk Eddelbuettel * inst/examples/ConvolveBenchmarks/exampleRCode.r: Rewritten / simplified using the rbenchmark::benchmark() function * DESCRIPTION: Added Suggests: on rbenchmark package 2010-09-04 Dirk Eddelbuettel * inst/examples/ConvolveBenchmarks/exampleRCode.r: Some cosmetics * inst/examples/ConvolveBenchmarks/convolve3_cpp.cpp: Remove one unneccessary loop to set values to zero (which the ctor does for us) 2010-09-03 Dirk Eddelbuettel * inst/doc/Rcpp-extending/Rcpp-extending.Rnw: Add highlight definitions * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Idem * inst/doc/Rcpp-package/Rcpp-package.Rnw: Idem 2010-09-02 Dirk Eddelbuettel * src/msvcmath.cpp: Undo unmotivated msvc patch * inst/include/Rcpp/msvc/: Idem * inst/include/Rcpp/XPtr.h: Idem * inst/include/RcppCommon.h: Idem * src/Date.cpp: Idem * DESCRIPTION: Added Suggests: on highlight package 2010-08-20 Romain Francois * inst/include/Rcpp/complex.h : binary operators for Rcomplex : +,-,*,/ 2010-08-15 Romain Francois * inst/include/Rcpp/sugar/SugarBlock.h: more control of the NA behavior in SUGAR_BLOCK_2. SUGAR_BLOCK_2 will now propagate the NA, and the new SUGAR_BLOCK_2_NA will use a fixed NA (can be true or false). This can be useful if the function that is sugar'ed never generates NA. * inst/include/Rcpp/sugar/undoRmath.h : undo the macros done by Rmath.h 2010-08-13 Douglas Bates * include/Rcpp.h: undo more defines from Rmath.h 2010-08-13 Romain Francois * inst/include/Rcpp/sugar/complex.h: simplify complex sugar functions Re, Im, Conj, Mod * inst/include/Rcpp/sugar/complex.h: new sugar functions operating on complex expressions: exp, log, sqrt, cos, sin, tan, acos, asin, atan, acosh, asinh, atanh, cosh, sinh, tanh * inst/unitTests/runit.sugar.R: added regression test for complex functions which did not handle NA properly before * DESCRIPTION: no longer requireing GNU make as we dont use it anymore * src/Makevars: removed the use of ifeq (which was the last thing requiring GNU make) 2010-08-12 Romain Francois * inst/include/Rcpp/sugar/math.h: replace previous versions of floor, abs, exp, ceil, ceiling with versions generated by the SUGAR_MATH_1 macro 2010-08-11 Romain Francois * inst/include/Rcpp/vector/vector.h: Vector gains constructor taking size and function pointers, acting as generators : Vector( const int& siz, stored_type (*gen)(void), bool seed = true ) template Vector( const int& siz, stored_type (*gen)(U1), const U1& u1, bool seed = true) template Vector( const int& siz, stored_type (*gen)(U1,U2), const U1& u1, const U2& u2, bool seed = true) so that for example : NumericVector( 10, norm_rand ) generates a N(0,1) vector of size 10 * inst/include/Rcpp/stats/random/rlnorm.h: Added rlnorm and rlnorm_ * inst/include/Rcpp/stats/random/rgamma.h: Added rgamma and rgamma_ * inst/include/Rcpp/stats/random/rt.h: Added rt and rt_ * inst/include/Rcpp/stats/random/rbinom.h: Added rbinom and rbinom_ * inst/include/Rcpp/stats/random/rnchisq.h: Added rnchisq and rnchisq_ * inst/include/Rcpp/stats/random/rgeom.h: Added rgeom and rgeom_ * inst/include/Rcpp/stats/random/rhyper.h: Added rhyper and rhyper_ * inst/include/Rcpp/stats/random/rnbinom_mu.h: Added rnbinom_mu and rnbinom_mu_ * inst/include/Rcpp/stats/random/rnbinom.h: Added rnbinom and rnbinom_ * inst/include/Rcpp/stats/random/rpois.h: Added rpois and rpois_ * inst/include/Rcpp/stats/random/rweibull.h: Added rweibull and rweibull_ * inst/include/Rcpp/stats/random/rlogis.h: Added rlogis and rlogis_ * inst/include/Rcpp/stats/random/rwilcox.h: Added rwilcox and rwilcox_ * inst/include/Rcpp/stats/random/rsignrank.h: Added rsignrank and rsignrank_ * inst/include/Rcpp/stats/random/rnorm.h: some optimization * inst/include/Rcpp/stats/random/rf.h: calculate n2/n1 just once * inst/include/Rcpp/sugar/SugarBlock.h : templates and macros to facilitate generation of sugar functions that take one or two double parameters * inst/include/Rcpp/sugar/math.h: using SugarBlock to generate new sugar functions: (1 parameter) : gamma, lgamma, digamma, trigamma, tetragamma, pentagamma, expm1, log1p, factorial, lfactorial, cos, acosh, atan, cos, cosh, log, log10, sqrt, sin, sinh, tan, tanh (2 parameter) : choose, lchoose, beta, lbeta, psigamma 2010-08-10 Douglas Bates * include/Rcpp/stats/nbinom[_mu].h: Replace conflicting data member name 'size' by 'siz' 2010-08-10 Romain Francois * inst/include/Rcpp/stats/random/rnorm.h: Added rnorm and rnorm_ * inst/include/Rcpp/stats/random/runif.h: Added runif and runif_ * inst/include/Rcpp/stats/random/rbeta.h: Added rbeta and rbeta_ * inst/include/Rcpp/stats/random/rcauchy.h: Added rcauchy and rcauchy_ * inst/include/Rcpp/stats/random/rchisq.h: Added rchisq and rchisq_ * inst/include/Rcpp/stats/random/rexp.h: Added rexp and rexp_ * inst/include/Rcpp/stats/random/rf.h: Added rf and rf_ * inst/include/Rcpp/stats/stats.h : fixed name clash reported on Rcpp-devel http://permalink.gmane.org/gmane.comp.lang.r.rcpp/610 2010-08-09 Romain Francois * inst/include/Rcpp/stats/lnorm.h: Added d-p-q (lnorm|weibull|logis|f) generated by the script * inst/include/Rcpp/vector/Vector.h: further dispatch to allow generators to be passed to constructors of Vector * inst/include/Rcpp/traits/has_iterator.h: new SFINAE detection of generators * inst/include/Rcpp/Generator.h : base template class for generators 2010-08-06 Douglas Bates * unitTests/runit.stats.R: Corrected instances of numeric arguments passed as integers, deleted tests for binomial with fixed parameter values. 2010-08-06 Romain Francois * ../scripts/stats.R: R script to generate the template code for dpq functions * include/Rcpp/stats/unif.h: Added d-p-q unif and tests * include/Rcpp/stats/gamma.h: Added d-p-q gamma and tests * include/Rcpp/stats/chisq.h: Added d-p-q chisq 2010-08-05 Douglas Bates * include/Rcpp/stats/beta.h: Added d-p-q beta and tests * include/Rcpp/stats/binom.h: Added pbinom and qbinom, and tests of same in runit.stats.R * include/Rcpp/stats/pois.h: Added ppois and qpois (plus tests in runit.stats.R). * include/Rcpp/stats/norm.h: Added pnorm and qnorm and corresponding tests in unitTests/runit.stats.R 2010-08-05 Dirk Eddelbuettel * inst/include/Rcpp/stats/norm.h: Added dnorm sugar function * inst/include/Rcpp/stats/t.h: Added dt, pt, qt sugar functions * inst/include/unitTests/runit.stats.R: Added corresponding tests 2010-08-05 Romain Francois * inst/include/Rcpp/sugar/functions/seq_along.h: added seq(int,int) to mimic the R syntax : seq( 0, 5 ) * inst/include/Rcpp/sugar/Range.h: fixed compiler confusion * inst/include/Rcpp/stats: new sugar functions Rcpp::stats::dpois and Rcpp::stats::dbinom inspired by Richard Chandler post on Rcpp-devel: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2010-August/000940.html * inst/include/Rcpp/sugar/sum.h: preliminary version of Rcpp::sum (does not deal with NA properly yet) 2010-08-04 Romain Francois * inst/include/Rcpp/sugar/: rework sugar matrix so that operator()(int,int) is always used instead of operator[](int) * inst/include/Rcpp/sugar/matrix/outer.h: new implementation based on LazyVector, so that the value from the vector expression is only retrieved once 2010-08-02 Romain Francois * inst/include/Rcpp/XPtr.h: give default values to tag and prot in XPtr ctor 2010-07-30 Romain Francois * inst/doc/Rcpp-quickref/* : new vignette Rcpp-quickref: quick reference guide to Rcpp API 2010-07-28 Romain Francois * inst/include/Rcpp/sugar/exp.h: adapt to stricter standards on solaris/suncc 2010-07-25 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.5 * debian/*: Similarly updated for new release to Debian 2010-07-17 Romain Francois * inst/include/Rcpp/vector/Vector.h: faster lhs use of names, only using callback to R if necessary. (discovered while profiling RProtoBuf) * inst/include/Rcpp/RObject.h : faster lhs and rhs use of RObject::slot, using R API functions R_do_slot and R_do_slot_assign 2010-07-16 Dirk Eddelbuettel * src/Date.cpp: Small fix which may make Solaris/SunStudio happy 2010-07-16 Romain Francois * man/Rcpp-package.Rd : removed old content and point to the Rcpp-package vignette for current guidelines. * DESCRIPTION: Updated to mention sugar and modules 2010-07-10 Romain Francois * src/Makevars: Remove last call to $shell by turning C++0x detection off (and into a switch users can edit) which should make builds more stable * src/Makevars.win: Idem * src/cxx0x/cxx0x.R: Detection script deprecated for now 2010-07-10 Romain Francois * man/CppClass-class.Rd: changed use of \linkS4Class to suppress a warning with the development version of R * man/CppObject-class.Rd: idem 2010-07-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.4 * debian/*: Similarly updated for new release to Debian 2010-07-09 Romain Francois * src/RObject.cpp: adapt the SlotProxy class to deal with the special case of the .Data slot (slot<- changes the internal SEXP) * R/Module.R: the C++Class now inherits from "character", to facilitate S4 method dispatch * src/Module.cpp: The CppClass ctor sets the .Data of the C++Class object to an obfuscated name to avoid class names clashes at the R level. 2010-07-08 Romain Francois * inst/include/Rcpp/sugar/functions/head.h: new sugar function : head * inst/include/Rcpp/sugar/functions/tail.h: new sugar function : tail * inst/include/Rcpp/sugar/functions/tail.h: new sugar function : diag 2010-07-07 Dirk Eddelbuettel * inst/README: Updated and now pointing to all the other documentation 2010-07-07 Romain Francois * inst/include/Rcpp/sugar/functions/rep.h: version of rep that takes a primitive as the first argument 2010-07-07 Dirk Eddelbuettel * inst/unitTests/runTests.R: Reverted to running all tests now that tests are reorganised using the one-compile-per-function scheme which significantly speeds up running of the numerous unit tests 2010-07-06 Dirk Eddelbuettel * src/Date.cpp: Imported mktime() from R (which is due to Arthur Olson) 2010-07-06 Romain Francois * inst/include/Rcpp/sugar/functions/ifelse.h: using compile time dispatch based on the NA-ness of the condition type. ifelse handles primitive arguments on the lhs, rhs or both * inst/include/Rcpp/sugar/functions/rev.h: new sugar function: rev 2010-07-05 Romain Francois * inst/include/Rcpp/RcppCommon.h : no more using variadic macros in RCPP_DEBUG * inst/include/Rcpp/vector/Matrix.h: move ncol, nrow, rows and cols in Matrix (used to be in Vector) * inst/include/Rcpp/traits/matrix_interface.h: new SFINAE helper to detect matrix interface (helps matrix sugar expressions) 2010-07-03 Romain Francois * inst/include/Rcpp/traits/result_of.h : also deal with functions taking two arguments (useful for e.g. outer) * inst/include/Rcpp/vector/MatrixBase.h : new CRTP base class for Matrix to facilitate sugar syntax on matrices. * inst/include/Rcpp/sugar/matrix/outer.h : new sugar function: outer * inst/include/Rcpp/sugar/matrix/row.h: new sugar function: row * inst/include/Rcpp/sugar/matrix/col.h: new sugar function: col * inst/include/Rcpp/sugar/matrix/lower_tri.h: new sugar function: lower_tri * inst/include/Rcpp/sugar/matrix/upper_tri.h: new sugar function: upper_tri * inst/include/Rcpp/sugar/functions/rep.h: new sugar function : rep * inst/include/Rcpp/sugar/functions/rep_len.h: new sugar function : rep_len * inst/include/Rcpp/sugar/functions/rep_each.h: new sugar function : rep_each 2010-07-02 Dirk Eddelbuettel * src/RcppStringVector: Now uses std::vector * inst/include/classic/RcppStringVector.h: Idem * inst/unitTests/runit.List.R: Added simple test for RcppStringVector 2010-07-01 Dirk Eddelbuettel * src/RcppDateVector: Index argument is int here as well * src/RcppDatetimeVector: Idem * inst/include/classic/RcppDateVector.h: Idem * inst/include/classic/RcppDatetimeVector.h: Idem * inst/unitTests/runit.List.R: Added simple test for RcppList 2010-06-30 Dirk Eddelbuettel * src/DateVector: Index argument is int; throw declared * src/DatetimeVector: Idem * inst/include/Rcpp/DateVector.h: Idem * inst/include/Rcpp/DatetimeVector.h: Idem 2010-06-28 Romain Francois * inst/include/Rcpp/sugar/Im.h: * inst/include/Rcpp/sugar/Re.h: * inst/include/Rcpp/sugar/Conj.h: * inst/include/Rcpp/sugar/Mod.h: added sugar functions for complex vectors: Re, Im, Conj, Mod 2010-06-27 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.3 * debian/*: Similarly updated for new release to Debian * inst/unitTests/runTests.R: Stop-gap measure to reduce the number of tests run on Windows as we now have so many tests that the build exceeds the time limit granted by the win-builder service. The forced reduction of tests can be overcome by adding --allTests as a command-line argument on Windows, or by running on another platform. 2010-06-25 Romain Francois * inst/include/Rcpp/posix.h: anticipate R 2.12.0 switch of classes POSIXt and POSIXct * inst/include/classic: New home for the 'classic' API headers. Also some refactoring of the internals so that they can interoperate better withuse the new API. 2010-06-24 Romain Francois * inst/include/Rcpp/vector/RangeIndexer.h: factored the RangeIndexer class out of Vector, so that we can at a later time specialize it for character vectors, lists, etc ... 2010-06-24 Dirk Eddelbuettel * inst/include/Rcpp/Date.h: add struct tm member variable and sensible (ie non-intra-day) accessor functions; add SEXP ctor * src/Date.cpp: Implementation of the above * inst/unitTests/runit.Date.R: tests for the above * inst/include/Rcpp/Datetime.h: New Datetime class * src/Datetime.cpp: Implementation for new Datetime class * inst/unitTests/runit.Datetime.R: first tests for Rcpp::Datetime * inst/include/Rcpp/Datetime_forward.h: API Integration * inst/include/Rcpp/DatetimeVector.h: New DatetimeVector class * src/Datetime.cpp: Implementation for new DatetimeVector class 2010-06-23 Dirk Eddelbuettel * src/Date.cpp: Import mktime00() from R's src/main/datetime.c, completed class implementation * inst/include/Rcpp/Date.h: Add mktime00() declaration * inst/include/Rcpp/DateVector.h: New DateVector class * src/Date.cpp: Implementation for new DateVector class 2010-06-23 Romain Francois * inst/include/Rcpp/Date_forward.h: forward declaration of Rcpp::Date and support for wrap( container of Rcpp::Date ), e.g. wrap( vector ) * inst/include/Rcpp/sugar/Range.h: added the concept of range to allow modification of several elements of a vector. * inst/examples/ConvolveBenchmarks: version of the convolution function using sugar indexing. 2010-06-22 Dirk Eddelbuettel * inst/include/Rcpp/Date.h: New Date class (not yet complete) * src/Date.cpp: Implementation for new Date class (not yet complete) * inst/unitTests/runit.Date.R: first tests for Rcpp::Date 2010-06-21 Dirk Eddelbuettel * inst/examples/SugarPerformance/: New example to benchmark the new syntactic 'sugar' classes 2010-06-19 Dirk Eddelbuettel * inst/include/RcppDoxygenExamples.h: Correct three wrong paths for ConvolveBenchmak example files, and add missing FastLM/ examples 2010-06-18 Romain Francois * inst/include/Rcpp/sugar/*: implementation of Rcpp sugar, covering binary operators (<,>,<=,>=,!=,==) for logical vectors or logical expressions, arithmetic operators (+,-,*,/) for vectors and expressions, and several functions similar to the R functions of the same name, currently: abs, all, any, ceiling, diff, exp, ifelse, is_na, lapply, pmin, pmax, pow, sapply, seq_along, seq_len, sign * inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw: vignette documenting Rcpp sugar 2010-06-17 Romain Francois * inst/include/Rcpp/Vector.h: split into more manageable files * inst/include/Rcpp/vector/VectorBase.h: simplify the VectorBase class so that it is just implementing CRTP. It does not inherit from RObject anymore. This will help implementation of sugar. 2010-06-16 Dirk Eddelbuettel * src/RcppDateVector.cpp: Also provide non-const operator()(int i) * inst/include/RcppDateVector.h: Idem 2010-06-16 Romain Francois * inst/include/Rcpp/InternalFunction.h: new class Rcpp::InternalFunction * R/Module.R: R support for Rcpp::InternalFunction * inst/include/Rcpp/Module.h: added the LOAD_RCPP_MODULE macro to allow loading a module from C++ * R/Module.R: if the first argument is an external pointer already, Module assumes it is a module pointer. (R support for the item above) 2010-06-15 Dirk Eddelbuettel * src/RcppDatetimeVector.cpp: Use std::vector internally * inst/include/RcppDatetimeVector.h: Idem * src/RcppDateVector.cpp: Use std::vector internally * inst/include/RcppDateVector.h: Idem 2010-06-14 Dirk Eddelbuettel * src/RcppDatetimeVector.cpp: Add constructor from int * inst/include/RcppDatetimeVector.h: Idem * src/RcppDateVector.cpp: Add constructor from int * inst/include/RcppDateVector.h: Idem 2010-06-13 Dirk Eddelbuettel * src/RcppResultSet.cpp: Proper template specialisation for wrap * inst/include/RcppResultSet.h: Idem * src/RcppDateVector.cpp: Add const qualifier to operator()(int i) * inst/include/RcppDateVector.h: Idem 2010-06-13 Romain Francois * inst/include/Rcpp/Vector.h: added new factory functions for Vector: Vector::import and Vector::import_transform 2010-06-12 Dirk Eddelbuettel * src/RcppDate.cpp: Simple RcppDate(SEXP) ctor added * inst/include/RcppDate.h: Idem * src/RcppResultSet.cpp: carved out four new wrap() functions by splitting the existing code in add() methods off 2010-06-11 Romain Francois * R/help.R: workaround to allow the syntax "Rcpp ? something" to bring Rcpp documentation * inst/include/Rcpp/Module.h: support for exposing public data members * inst/doc/Rcpp-modules/Rcpp-modules.Rnw: a section to mention fields as a way to expose data members * inst/Rcpp/traits/is_na.h : new helper class Rcpp::traits::is_na 2010-06-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.2 * debian/*: Similarly updated for new release to Debian 2010-06-08 Romain Francois * src/RcppCommon.cpp: track if demangling is available (currently only available with gcc) 2010-06-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.1 * debian/*: Similarly updated for new release to Debian 2010-06-07 Dirk Eddelbuettel * inst/doc/Rcpp-extending*: Extended mini vignette "Rcpp-extending" 2010-06-07 Romain Francois * inst/doc/Rcpp-extending*: Added new mini vignette "Rcpp-extending" 2010-06-05 Dirk Eddelbuettel * inst/doc/Rcpp-FAQ*: Extended mini vignette "Rcpp-FAQ" 2010-06-05 Romain Francois * inst/doc/Rcpp-FAQ*: Added new mini vignette "Rcpp-FAQ" 2010-06-04 Romain Francois * inst/include/Rcpp/Module.h: * R/Module.R: support for properties of C++ objects 2010-06-03 Romain Francois * src/RcppCommn.cpp: added show method for C++Object and C++Class * inst/include/Rcpp/XPtr.h: getTag and getProtected are deprecated, will be removed in Rcpp 0.8.2. methods tag and prot should be used instead. The new methods support both lhs and rhs use. 2010-06-02 Romain Francois * inst/include/Rcpp/traits/r_type_traits.h: added missing support for std::complex, needed by RcppArmadillo * src/RcppCommon.cpp: added internal .Call function as_character_externalptr to extract the address of the pointer wrapped by an external pointer 2010-06-01 Romain Francois * inst/doc/Rcpp-package*: new mini vignette "Rcpp-package" to improve the documentation of Rcpp.package.skeleton and details the steps involved in making a package that uses Rcpp * inst/doc/Rcpp-modules/Rcpp-modules.Rnw: document how to use modules in other packages (namespace, etc ...) * R/Rcpp.package.skeleton: added the module argument * R/Module.R: prompt method for Module objects to generate skeleton of an Rd file with the list of functions and classes defined by the module. 2010-05-30 Romain Francois * R/Module.R: completion for C++ modules. 2010-05-29 Romain Francois * R/Module.R: when a Module is loaded, it creates extensions of the class C++Object for each internal class to enable S4 dispatch * R/Module.R: support for completion of methods of C++ objects 2010-05-28 Romain Francois * R/cppfunction.R: withdrawn, we now use inline::cxxfunction which is more flexible and we no longer need to depend on inline * man/cppfunction.Rd: * * inst/unitTests/runTests.R: The tests now require a recent version of inline (>= 0.3.4.2) 2010-05-27 Romain Francois * inst/include/Rcpp/Module.h: adding support for registering a free function that takes a pointer to the class of the wrapped object as first argument in class_ 2010-05-26 Romain Francois * inst/include/Rcpp/Module.h: * src/Module.cpp : limited support for exposing c++ classes in Rcpp modules * R/Module.R : classes "C++Class", "C++Object" holding external pointers and $ method dispatching internally 2010-05-24 Dirk Eddelbuettel * src/Rcpp*.cpp: Moved template code from the older API to headers headers in inst/include/*.h; removed empty source files 2010-05-21 Romain Francois * R/exceptions.R: rework rcpp_tryCatch to prevent evaluating the expression too early (reported by Doug Bates on Rcpp-devel) * src/Evaluator.cpp: rework Evaluator::run() so that it correctly evaluates inside an environment (reported by Doug Bates on Rcpp-devel) 2010-05-20 Romain Francois * inst/include/Rcpp/Vector.h : correct throw specs for vector_from_string (reported by Brian Ripley from solaris) * inst/include/Rcpp/internal/Proxy_Iterator.h: fixed constness of several operators in Proxy_Iterator to try to suite suncc/solaris * inst/include/Rcpp/config.h: define RCPP_ENABLE_MODULES to hide the experimental module features from the official api * R/getDLL.R: removed and promoted to getDynLib in inline 2010-05-19 Romain Francois * inst/include/Rcpp/as.h: add throw specification to as specialization, reported by suncc compiler on CRAN checks * inst/include/Rcpp/Module.h : adding the concept of Rcpp modules, inspired from boost.python * R/Module.R: R side support for modules * R/getDLL.R: generic (s4) function to get the DLL based on either its name e.g. getDLL( "Rcpp" ) or an object of class CFunc (from the inline package) 2010-05-17 Dirk Eddelbuettel * DESCRIPTION: Release 0.8.0 * debian/*: Similarly updated for new release to Debian 2010-05-11 Romain Francois * inst/include/Rcpp/traits/*.h: added support for long long int and unsigned long long int, which is size_t on win64 2010-05-10 Romain Francois * inst/include/Rcpp/Dimension.h: added a const operator[], requested in the Rcpp-devel thread : http://article.gmane.org/gmane.comp.lang.r.rcpp/327 * inst/include/Rcpp/preprocessor.h: added __rcpp_info__ pseudo reflection information to RCPP_XP_FIELD * inst/unitTests/runit.macros.R: testing RCPP_XP_FIELD 2010-05-06 Romain Francois * inst/include/Rcpp/DataFrame.h: DataFrame( RObject::SlotProxy ) and DataFrame( RObject::AttributeProxy ) constructors * inst/include/Rcpp/DataFrame.h: DataFrame::create now uses the R function data.frame and not as.data.frame, which respects the stringsAsFactors argument. * inst/include/Rcpp/preprocessor.h: added RCPP_XP_FIELD_SET and RCPP_XP_FIELD_SET macros to generate getter and setter for a field of a class handled by an external pointer. RCPP_XP_FIELD is modified to generate both getter and setter 2010-05-05 Romain Francois * inst/include/Rcpp/S4.h: S4 gains a "is" method to identify if an object is of a given S4 class, following Doug's advice in lme4a * inst/include/Rcpp/algo.h: new STL-like algorithms Rcpp::any and Rcpp::any_if * inst/include/Rcpp/Vector.h: Vector gains a constructor taking an RObject::SlotProxy and a constructor taking an RObject::AttributeProxy, allowing this construct NumericVector x( y.slot( "foo" ) ) 2010-05-04 Romain Francois * inst/include/Rcpp/preprocessor_generated.h: new macros to hide most of the boiler plate code RCPP_FUNCTION_0, ..., RCPP_FUNCTION_1 RCPP_FUNCTION_VOID_0, ... RCPP_XP_METHOD_0, ... RCPP_XP_METHOD_CAST_0, ... RCPP_XP_METHOD_VOID_0, ... 2010-05-03 Dirk Eddelbuettel * inst/unitTests/runit.DataFrame.R: unit tests for Rcpp::DataFrame 2010-05-03 Romain Francois * inst/include/Rcpp/exceptions.h : move the what methods of exception classes so that the symbol is defined for sure in the shared library. This seems to make a difference due to vague linkage issues. Decrypted from http://gcc.gnu.org/wiki/Visibility 2010-05-02 Romain Francois * inst/include/Rcpp/as.h: add throw(not_compatible) in Rcpp::as * inst/include/Rcpp/clone.h: the clone(SEXP) moves to the headers 2010-04-28 Romain Francois * inst/include/Rcpp/Vector.h: changed Vector( size_t ) to Vector( int ) to allow Vector( 0 ) and Vector::create() 2010-04-27 Romain Francois * inst/include/Rcpp/preprocessor.h: new macro RCPP_ENUM_TRAITS to generate traits needed to support wrap for an enum type (used in RProtoBuf) * R/Rcpp.package.skeleton.R: correctly handle the example_code argument 2010-04-26 Romain Francois * inst/include/Rcpp/DataFrame_*.h: new class Rcpp::DataFrame * inst/include/Rcpp/preprocessor.h: added RCPP_XP_FIELD macro * inst/include/Rcpp/preprocessor_generated.h: added the set of macros RCPP_WRAPPER_0, ..., RCPP_WRAPPER_65 to help wrapping existing C functions into .Call callables functions 2010-04-16 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.12 * debian/*: Similarly updated for new release to Debian * RcppLdpath.R: Remove shQuote() from trying to protect spaces in Windows pathnames as it breaks backticks expansion usage 2010-04-06 Romain Francois * inst/include/Rcpp/traits/*.h: added support for long 2010-04-04 Romain Francois * inst/include/* : headers are moved to inst/include so that they are are not duplicated on multi arch platforms * R/RcppLdPath.R: RcppCxxFlags is updated to reflect the above change * src/Makevars: simplified as the headers don't need to be copied to each arch lib directory anymore * src/Makevars.win: same * inst/include/Rcpp/Vector.h : Vector<> gains a templated assignment operator 2010-04-02 Romain Francois * src/Rcpp/Formula.h: new Rcpp::Formula class * inst/unitTests/runit.Formula.R: unit test for Rcpp::Formula 2010-03-26 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.11 * debian/*: Similarly updated for new release to Debian * inst/examples/FastLM: Updated to use new create() method * inst/unitTests/runit.Matrix.R: New unit test new Matrix constructors 2010-03-26 Romain Francois * src/Rcpp/Vector.h: Fixed bug in diag() 2010-03-23 Dirk Eddelbuettel * inst/unitTests/runit.CharacterVector.R: New unit test for bug found by Doug 2010-03-23 Romain Francois * src/Rcpp/Vector.h: fixed critical bug. Vector did not have copy constructor and assignement operators * src/exceptions.cpp: added the demangle helper function to help debugging * src/RcppCommon.h: added the DEMANGLE macro and the RCPP_DEBUG macro to help debugging. 2010-03-20 Romain Francois * src/Rcpp/Vector.h : Vector gains a templated fill method to fill all elements of a vector with the same value 2010-03-19 Romain Francois * src/Rcpp/Vector.h : Matrix gains a diag method to create diagonal matrices * src/Rcpp/Named.h: Named is no longer a class, but a templated function. This preserves all the existing interface, but also allows Named to be used in making simple vectors, e.g through the Vector::create factory functions * src/Rcpp/Vector.h: Vector gains the "create" factory methods taking up to 20 arguments that can be named (using the Argument class or the _ placeholder) * src/Rcpp/make_list.h: removed since Vector::create does the job more generically and more efficently 2010-03-19 Dirk Eddelbuettel * src/Rcpp/Vector.h: Matrix now also accepts a single int in the constructor to create matrices of square sizes * src/RcppFrame.h: Patch by Alistair Gee to make ColDatum more robust src/RcppFrame.h: Idem * inst/unitTests/runit.RcppFrame.R: New unit test for RcppFrame 2010-03-16 Romain Francois * src/Rcpp/make_list.h: set of helper factories make_list to facilitate production of named generic vectors. * src/Rcpp/Named.h: new class Rcpp::Argument similar to Named but does not contain the object, just the name. The templated Argument::operator= makes a Named. This allows an application to define a set of arguments that it uses in order to have a nicer construct. see the runit.Argument.R file for an example 2010-03-15 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.10 * debian/*: Similarly updated for new release to Debian * RcppLdpath.R: Use shQuote() to protect spaces in Windows pathnames 2010-03-15 Romain Francois * inst/codebloat/codebloat.R: script to generate code (creating a pairlist with up to n arguments). * src/Rcpp/Function.h : Function gains a body method to retrieve the body of the function (using the BODY macro from Rinternals.h) 2010-03-14 Romain Francois * src/Rcpp/S4.h : Rcpp::S4 gains a new constructor taking a string reference and building a new S4 object of that type. This throws an exception if the object is not successfully created (e.g the class is not a known S4 class) 2010-03-13 Romain Francois * src/Rcpp/S4.h : new class Rcpp::S4 2010-03-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.9 * debian/*: Similarly updated for new release to Debian 2010-03-12 Romain Francois * inst/unitTests/runit.environments.R: mac os has a different locale * src/Rcpp/traits/is_convertible.h: the detection is now performed without the help of cxx0x or tr1 which makes it compatible with gcc 4.2 * src/Rcpp/traits/is_same.h: new traits is_same to help detect if two types are the same (not currently used) * src/Rcpp/traits/wrap_type_traits.h: use "unsigned int" instead of "size_t" in the template specializations (64 bit compatibility) 2010-03-10 Dirk Eddelbuettel * R/RcppLdPath.R: More specific about quote-protection of path on Windows * inst/doc/Rcpp-introduction.Rnw: Applied several fixes kindly suggested by Matt Kraai 2010-03-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.8 * debian/*: Similarly updated for new release to Debian 2010-03-09 Romain Francois * man/Rcpp.package.skeleton.Rd: some more documentation 2010-03-07 Dirk Eddelbuettel * inst/doc/Rcpp-introduction.Rnw: Added vignette based on a recent paper 2010-03-07 Romain Francois * src/Rcpp/StringTransformer.h: new class template StringTransformer that allows using a character by character function to modify elements of a string vector (example available in package RcppExamples) * src/Rcpp/Vector.h: string_proxy::iterator is made const char* because R uses a global cache for the CHARSXP 2010-03-05 Romain Francois * src/Rcpp/Vector.h: string_proxy gains begin(), end(), size(), and operator[] for iterating over characters of the CHARSXP 2010-03-02 Romain Francois * src/Rcpp/Vector.h: Vector gains a nested r_type type that is an integral_constant to facilitate TMP * src/RcppCommon.{h,cpp}: added RCPP_CALL_VECTOR and RCPP_CALL_MATRIX macros to facilitate calling a function templated by T = Vector the macro hides the boiler-plate switch( TYPEOF(x) ){ case INTSXP : ... } 2010-03-01 Romain Francois * src/Rcpp/Vector.h: more typedef : CharacterMatrix, StringMatrix, GenericMatrix, ExpressionMatrix, ListMatrix * src/ExpressionVector.cpp : replaced by templates in Vector.h * src/Rcpp/Vector.h: use templates to cover ExpressionVector additional methods : eval() and eval(const Environment& ) 2010-02-28 Romain Francois * src/Rcpp/Vector.h : more generic code for vectors. All vector types are now generated from the template Rcpp::Vector where RTYPE is one of INTSXP, LGLSXP, REALSXP, RAWSXP, STRSXP, VECSXP or EXPRSXP. 2010-02-24 Romain Francois * src/Rcpp/exceptions.h: some exception classes factored out * src/Rcpp/VectorBase.h: now a template, using the Curiously recurring template pattern (the type parameter is the derived class) * src/Rcpp/SEXP_Vector.h: the intermediate class SEXP_Vector_Base is removed, reverting the change on 2010-02-09. This will facilitate the introduction of the Curiously recurring template pattern on vectors * src/Rcpp/MatrixRow.h : Row has been factored out of SimpleVector into a separate template class Rcpp::MatrixRow * src/Rcpp/SimpleVector.h: gains a row method that returns a SimpleVector::Row, aka MatrixRow * src/Rcpp/CharacterVector.h : gains a row method that returns a CharacterVector::Row, aka MatrixRow * src/Rcpp/SEXP_Vector.h : gains a row method that returns a SEXP_Vector::Row aka MatrixRow * src/Rcpp/MatrixColumn.h : Column class to access elements of a matrix column 2010-02-23 Romain Francois * src/Rcpp/SimpleVector.h: added the class SimpleVector::Row to support STL algorithms working on a row of a matrix. * src/Rcpp/internal/ListInitialization.h: new class that supports use of operator, (inspired from blitz) giving this notation: IntegerVector x(3); x = 0, 1, 2 ; 2010-02-21 Romain Francois * src/Rcpp/as.h: more generic as implementation. primitive types are handled through templates which for example makes it possible to as in RProtoBuf. std::deque and std::list become as'able when T is a primitive type as indicated by the Rcpp::traits::r_type_traits * src/as.cpp: removed since as is now fully implemented via templates 2010-02-19 Romain Francois * src/Rcpp/as.h: as now delegates to a template class Exporter since partial specialization was not possible with the interface of as. It is possible to partially specialize Exporter. std::vector when T is a primitive type is now handled through Exporter. Some support Exporter have been added and used in RcppArmadillo * src/Rcpp/internal/wrap.h: support for std::complex and std::complex (needed for RcppArmadillo) * src/Rcpp/traits/wrap_type_traits.h : The Importer concept has been introduced to support wrap() of more types. If a class has a typedef "r_import_type" then the following interface is assumed and used. The corresponding class must have methods int size() and r_import_type get(int). As usual further dispatch is performed based on r_import_type (primitive, etc ...). RcppArmadillo has an example of this for wrapping arma::field objects using the FieldImporter class. 2010-02-18 Romain Francois * src/Rcpp/Language.h: added fixed_call to support STL algorithms similar to generate. * inst/unitTests/runit.Language.R: unit test for fixed_call * src/Rcpp/Environment.h: Environment gains a find method which searches for a binding in the associated environment but also in all its parents, as opposed to get which just looks in the environment. 2010-02-17 Dirk Eddelbuettel * src/Makevars: Simplified as RcppExample.cpp is shipped off * src/Makevars.win: Simplified as RcppExample.cpp is shipped off 2010-02-17 Romain Francois * src/Rcpp/SEXP_Vector.h : The lhs use of operator[](string) has been improved so that if the name does not exist in the vector, the vector grows. * inst/unitTests/runit.GenericVector.R: new unit test test.List.implicit.push.back about the new operator[](string) * src/Rcpp/SimpleVector.h : new template class SimpleMatrix that derives from SimpleVector, with typedefs NumericMatrix IntegerMatrix, LogicalMatrix, RawMatrix, ComplexMatrix. The actual functionality comes from SimpleVector but SimpleMatrix has constructors and assignment operators that behave slighlty differently : they check that their input is a matrix * src/Rcpp/traits/wrap_type_traits: added support for float * src/Rcpp/Rcpp.h: now including RObject here instead of in RcppCommon.h because RObject is a client of implicit converters (attr) and so we need to leave a hook for third party code, e.g. RcppArmadillo 2010-02-16 Dirk Eddelbuettel * src/Makevars.wim: Applied improved version kindly supplied by Brian Ripley * R/RcppExample.R, man/RcppExample.Rd: Moved to RcppExamples package * man/RcppDate.Rd, man/RcppParams.Rd, man/RcppResultSet.Rd, RcppVector.Rd, src/RcppExample.cpp: Idem * inst/examples/FastLM: Slightly reworked, actual code factored out and used in a per-library demo/test script and a joint benchmark.r 2010-02-15 Dirk Eddelbuettel * inst/examples/FastLM: New example directory with two 'fast lm' implementations using, respectively, GNU GSL (in C) and Armadillo (in C++); Armadillo is seen as faster for lack of extra copying 2010-02-14 Romain Francois * src/Rcpp/Language.h: accepting Function in unary_call and binary_call to support STL algorithms using R functions. 2010-02-14 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.7 * debian/*: Similarly updated for new release to Debian 2010-02-14 Romain Francois * src/Rcpp/Language.h: fixing serious bug. The 'code bloat' constructors taking a std::string did not explicitely create a symbol, so the created calls were wrong. * src/Rcpp/Language.h: new template classes Rcpp::unary_call and Rcpp::binary_call to allow use of Language objects in STL algorithms. * inst/unitTests/runit.Language.R: unit test and example of using unary_call and binary_call 2010-02-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.6 * NEWS: Updated * debian/*: Similarly updated for new release to Debian 2010-02-12 Romain Francois * src/Rcpp/Environment.h: Environment gains a default constructor. This is needed for RInside. 2010-02-10 Romain Francois * src/Rcpp/SEXP_Vector.h: SEXP_Vector (and therefore ExpressionVector and GenericVector, a.k.a List) gain methods push_front, push_back and insert that are templated and use the 'implicit wrap idiom' to add an element to the front or, the back or an arbitrary (valid) position of the list, pushing other elements. Internally the SEXP is actually copied. * src/Rcpp/SEXP_Vector.h: SEXP_Vector gains an erase method modelled after std::vector<>::erase to remove elements from a list. erase has a single iterator (or int) form that removes one element, and a range based version erase(iterator first, iterator last) that erases all elements between first and last. * src/Rcpp/VectorBase.h: VectorBase gains a version of offset to support retrieving the offset of a given name of a vector: offset( const std::string& name) * src/Rcpp/SimpleVector.h : uses the new offset to perform names based indexing (FR #808) * src/Rcpp/SEXP_Vector.h: same * src/Rcpp/CharacterVector.h: same * inst/unitTests/runit.GenericVector.R: unit tests for names based indexing * inst/unitTests/runit.IntegerVector.R: same * inst/unitTests/runit.CharacterVector.R: same 2010-02-09 Dirk Eddelbuettel * inst/skeleton/Makevars: Use $R_HOME/bin indirection * inst/skeleton/Makevars.win: Idem 2010-02-09 Romain Francois * src/Rcpp/SEXP_Vector.h: The functionality of SEXP_Vector that was independent of the template parameter was factored out into a new base class SEXP_Vector_Base. This follows the advice of item 44 of Effective C++. * src/Rcpp/SEXP_Vector.h: SEXP_Vector_Base::iterator is introduced as well as methods begin() and end() to support use of stl algorithms on lists. * inst/unitTests/runit.GenericVector.R: new unit test for testing SEXP_Vector_Base::iterator and illustrating a c++ version of lapply using std::transform * src/Rcpp/CharacterVector.h: CharacterVector gains a random access iterator, begin() and end() to support STL algorithms. The iterator dereferences to a StringProxy * src/Rcpp/RObject.h: remove RObject::asFoo methods which were deprecated in Rcpp 0.7.5. The alternative is to use Rcpp::as 2010-02-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.5 * debian/*: Similarly updated for new release to Debian 2010-02-07 Romain Francois * src/RcppSexp.h: class RcppSexp removed (was deprecated) * src/Rcpp/*.h: defaults copy constructors and assignment operators have been added for all classes extending RObject. Otherwise the compiler generates default versions that circumvent the garbage collection management 2010-02-06 Dirk Eddelbuettel * inst/examples/functionCallback/newApiExamples.r: Added simpler version using the new API * inst/examples/functionCallback/newApiExamples.r: Updated * inst/unitTests/runit.RcppVector.R: added test for NA/NaN * inst/unitTests/runit.RcppMatrix.R: idem 2010-02-06 Romain Francois * src/Rcpp/RObject.h : asFoo methods are deprecated. * src/Rcpp/DottedPair.h : using R_len_t instead of int to anticipate future changes in R * src/Rcpp/VectorBase.h: idem * src/DottedPair.cpp: idem * src/VectorBase.cpp: idem * src/as.cpp: idem * src/Rcpp/SimpleVector.h: SimpleVector is now only parameterized by the SEXP type. The c type is automatically retrieved using the storage_type trait class. 2010-02-05 Dirk Eddelbuettel * inst/THANKS: Added in order to show our appreciation 2010-02-04 Romain Francois * src/Rcpp/DottedPair.h: code bloat to allow creation of DottedPair containing up to 5 objects without variadic templates RInside for example needs this. * src/Rcpp/Language.h: same * src/Rcpp/Pairlist.h: same * src/Rcpp/grow.h: same * src/Rcpp/internal/wrap.h : one more level of dispatch to identify if there needs a cast between the primitive iterated over and the target storage type. For example size_t needs a cast to be stored in an integer vector. This will be useful for the RProtoBuf package with e.g. types like google::protobuf::int64 which needs to be cast to double. Consequently the special handling of bool has been withdrawn as bool can now be assimilated to a primitive type that does require casting (to int) 2010-02-03 Romain Francois * src/Rcpp/VectorBase.h: VectorBase gains a names method that uses the proxy pattern to get or set the names of a vector * src/Rcpp/DottedPair.h: DottedPair gains a << operator to add an object to the queue of the list. this is much useful when variadic templates are not available * src/Rcpp/RObject.h: support for slot assignment. The slot method now uses the proxy pattern. * inst/unitTests/runit.S4.R: unit test for slot assignment 2010-02-02 Romain Francois * src/internal/r_coerce.h : coercion is now handled by a templated function r_coerce, for example r_coerce takes an int, performs coercion and returns a double * src/traits/has_iterator.h : introduce a trait that uses the SFINAE idiom to check if a class T has a nested type called "iterator". This helps wrap dispatch which now uses the range based wrap implementation in that case * src/Rcpp/wrap.h: The range based wrap function is exposed at the Rcpp:: level. The interface is wrap( InputIterator first, InputIterator last ) and dispatch is performed internally using iterator traits 2010-02-01 Romain Francois * src/traits/wrap_type_traits.h: new namespace Rcpp::traits:: to host Rcpp type traits used by the template meta programming dispatching of wrap 2010-01-31 Dirk Eddelbuettel * doxyfile: several updates plus improvements related to examples/ * src/RcppDoxygenExamples.h: A phony empty file needed mainly to define a few \example tags for Doxygen 2010-01-31 Romain Francois * src/Rcpp/internal/wrap.h: more wrap for stl templates are candidate for wrap (when T can be wrapped) std::list -> vector or list std::multiset -> vector or list std::map -> named vector or named list std::multimap -> named vector or named list std::tr1::unordered_map -> named vector or named list std::tr1::unordered_set -> vector or list std::tr1::unordered_multiset -> vector or list * inst/unitTests/runit.wrap.R : unit tests for the new wrappable types 2010-01-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.4 * debian/*: Similarly updated for new release to Debian * inst/unitTests/runit.RcppMatrix.R: also test STL return * inst/unitTests/runit.RcppVector.R: added 2010-01-30 Romain Francois * src/Rcpp/internal/wrap.h: rework wrap using traits and template meta programming. wrap is now really a template and has many generated specializations. This file is a private header and should only be included by RcppCommon.h * src/Rcpp/Language.h: Language gains Function aware constructors and eval methods 2010-01-28 Romain Francois * src/Rcpp/DottedPair.h: DottedPair::Proxy are no more lazy, i.e traversal of the pair list happens at construction time, so that the proxy can be created once and used many times more efficiently. * src/Rcpp/DottedPair.h: Pairlist and Language are now derived from the new virtual class DottedPair since both class were almost identical * src/Rcpp/SimpleVector.h: simple vectors gain a range based assign method and a range based assign constructor * inst/unitTests/runit.IntegerVector.R: new unit test test.IntegerVector.range.constructors * src/Rcpp/Dimension.h: new class Rcpp::Dimension to support creation of vectors with dimensions * src/Rcpp/*Vector.h: using Rcpp::Dimension * src/Rcpp/SimpleVector.h: data is initialized with 0 when the object is constructed from size or Dimension constructor * inst/unitTestsrunit.CharacterVector.R: new unit test to test constructors using Dimension * inst/unitTests/runit.IntegerVector.R: idem * inst/unitTests/runit.GenericVector.R: idem * R/unit.tests.R: new unexported function "test" to trigger unit tests using installed test cases * src/Rcpp/CharacterVector.h: minor bug fix in assign * inst/unitTest/runit.RcppResultSet.R: compare time using as.numeric to avoid timezone problems 2010-01-27 Dirk Eddelbuettel * inst/unitTests/runit.RcppMatrix.R: added * inst/unitTests/runit.RcppMatrixView.R: added * inst/unitTests/runit.RcppVector.R: added * inst/unitTests/runit.RcppVectorView.R: added 2010-01-27 Romain Francois * src/Rcpp/CharacterVector.h: CharacterVector gains a default constructor * src/Rcpp/CharacterVector.h: CharacterVector gains range constructors and range based assign methods facilitating construction from iterators * inst/unitTests/runit.CharacterVector.R: unit tests for assign and range based constructors * src/Rcpp/CharacterVector.h: CharacterVector::StringProxy gets a printing operator <<(std::ostream& ) * src/Rcpp/Environment.h: removed the static Environment::RCPP_NAMESPACE which caused problems when embedding R * src/Rcpp/RObject.h: RObject::AttributeProxy::operator RObject replaced by templated implicit conversion operator, delegating the actual work to as<>. * src/Environment.h: Binding::operator RObject is removed since it can be automatically generated by the templated implicit conversion operator * man/RcpUnitTests.Rd: fix html rendering * inst/doc/Makefile: clean the index.html file before copying it 2010-01-26 Dirk Eddelbuettel * src/RcppDatetime.cpp: New SEXP-based constructor * src/RcppDatetime.h: idem, bug fix for operator- * src/RcppDate.h: new accessor getJulian() [relative to epoch just like R's julian()] to complement getJDN() * inst/unitTests/runit.RcppDatetime.R: added 2010-01-26 Romain Francois * src/Rcpp/clone.h: explicit cloning of RObjects. The clone template function creates a new object of the same class as the object it is passed in, encapsulating a duplicate of the SEXP contained by the input RObject. * src/Rcpp/r_cast.h: new template function to handle casts from one SEXP to another. This is mostly useful internally * src/Rcpp/VectorBase.h: VectorBase gains a offset method that is responsible to calculate the correct offset based on variable number of size_t arguments. currently the number of arguments can be 1 (vector indexing) and 2 (matrix indexing) but arbitrary number of arguments will be added later for arbitrary array-like indexing. * src/Rcpp/SimpleVector.h: outsourcing offset calculation to VectorBase::offset * src/Rcpp/CharacterVector.h: use offset to implement matrix-like indexing for matrices of strings * inst/unitTests/runit.CharacterVector.R: unit test for matrix indexing (test.CharacterVector.matrix.indexing) * inst/Rcpp/SEXP_Vector.h: use offset to implement matrix like indexing on lists * inst/unitTests/runit.GenericVector.R: unit test for matrix indexing (test.List.matrix.indexing) 2010-01-26 Dirk Eddelbuettel * inst/unitTests/runit.RcppDate.R: added 2010-01-25 Romain Francois * src/Rcpp/wrap.h: wrap is back at being a template. The template parameter T is first converted to SEXP implicitely and the wrap(SEXP) method is used. This allows clients to only have to implement an implicit conversion to SEXP operator for their class and have wrap for free. * src/Rcpp/SEXP_Vector.h: factored out ExpressionVector and GenericVector into a templated SEXP_Vector class parameterized by the SEXP type (VECSXP or EXPRSXP). GenericVector and ExpressionVector now are generated from the template. This will ease adding features to both classes. * src/as.cpp: also use coercion for as, as, as as (FR #768) * src/Rcpp/as.h: smarter template as, now the template attempts to create an object by passing the SEXP as the first parameter, so any class that has a constructor taking a SEXP can be as<>'ed. see item below for how this can be useful * src/Rcpp/Environment.h: lhs use of Environment::Binding is now a bit smarter and uses as<> to implicitely convert the SEXP to the requested type, so that if as makes sense, this works: Foo foo = env["x"] ; * src/Rcpp/Environment.h: Environment::assign gains a templated form so that we can assign anything that can be wrapped to a name in an environment. * inst/unitTests/runit.environments.R: new unit test 'test.environment.assign.templated' to test the templated assign * src/Makevars(.win?): listen to the RCPP_CXX0X environment variable and if set to "yes" attempt to add c++0x support if possible 2010-01-24 Dirk Eddelbuettel * configure.in: Withdrawn as OS X universal binaries are only built when there is src/Makevars and neither src/Makefile nor configure * configure: idem * src/Makevars: Again a static file, content copied from Makevars.in, -std=c++0x selection back to simply unabling a comment 2010-01-24 Romain Francois * src/SimpleVector.h : new template to replace simple vector classes. now NumericVector, IntegerVector, LogicalVector, ComplexVector and RawVector are all generated from the same template class. A first attempt at matrix indexing is added as part of this. * inst/unitTests/runit.NumericVector.R: new unit tests about matrix indexing * src/Rcpp/VectorBase.h: added the exception not_a_matrix that is thrown when attempting to perform matrix indexing on a vector that is not a matrix. 2010-01-23 Dirk Eddelbuettel * inst/unitTests/runit.RcppParams.R: added * inst/unitTests/runit.RcppResultSet.R: added 2010-01-23 Romain Francois * src/wrap.cpp: s/copy/std::copy/ * src/RcppDateTime.h: explicitely include (win64 warning) 2010-01-22 Romain Francois * src/Makevars.win: disable c++0x entirely (for now) * src/Rcpp/Environment.h: make sure what() is const. (suncc finding) * src/RcppCommon.h: pre declare classes, as an attempt to deal with the suncc warning "RObject may not have a type qualifier." * src/Rcpp/*.h: make sure RcppCommon.h is the first included header * src/*cpp: make sure foo.cpp only include Rcpp/foo.h * src/Environment.cpp: use Evaluator instead of R_ToplevelExec * src/RcppFunction.{h,cpp}: listen to some suncc warnings * src/RcppFrame.cpp: listen to some suncc warnings * src/as.cpp: use transform instead of assign, which should make the code more portable (particularly suncc) and also deal with coercion 2010-01-21 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.3 * debian/*: Similarly updated for new release to Debian * INDEX: updated * configure.in: Some more small cleanups * inst/skeleton/Makevars.win: Add missing default file 2010-01-21 Romain Francois * configure.in: Some small cleanups, add RCPP_CXX0X env var 2010-01-20 Romain Francois * src/*: make update private virtual in RObject and couple it with setSEXP so that it gets called automatically, instead of manually * src/*: move more code depending on c++0x from cpp files to header files 2010-01-20 Dirk Eddelbuettel * configure.in: Detect C++ capabilties (via g++ major/minor) via small C++ program embedded in autoconf macro 2010-01-19 Romain Francois * configure.in: use the cxx0x.R script to discover if the compiler being used is c++0x capable * configure: regenerated from updated configure.in * src/Makevars.in: using CLINK_CPPFLAGS variable * src/Makevars.win: using CLINK_CPPFLAGS variable with the cxx0x.R discovery script 2010-01-18 Dirk Eddelbuettel * R/RcppLdpath.R: Rewrote logic for LdFlags() to decide when linking is static: default now is everywhere but Linux, and choices can be overriden as before 2010-01-18 Romain Francois * inst/discovery/cxx0x.R: replaces the cxx0x.c file to take care of compiling, etc... 2010-01-17 Romain Francois * src/exceptions.cpp: slightly less dumb exception logic on non GCC compilers. exceptions will now trigger an R error with a default message (we don't attempt to get the exception class or message because we don't know how to) * src/Rcpp/Pairlist.h: Pairlist lacked a default constructor which is needed when the variadic templates are not available * inst/unitTests/*: add -std=c++0x in inline when necessary * R/RcppLdPath.R : new script RcppCxx0xFlags() and Cxx0xFlags() that compile, load and call a simple C file in order to check the compiler version and add the -std=c++0x flag * inst/discovery/cxx0x.c: discovery script. simple C script that returns "-std=c++0x" if it is compiled with GCC >= 4.3 and "" otherwise 2010-01-16 Dirk Eddelbuettel * src/Rcpp/*h: call Rf_length() etc as ::Rf_length() to ensure we get the one from the top-level namespace 2010-01-16 Romain Francois * src/Rcpp/Environment.h: Environment gains a new_child method to create an environment enclosed by this * inst/unitTests/runit.environments.R: unit test for new_child * src/Rcpp/ExpressionVector.h: ExpressionVector gains a convenience methods eval to evaluate itself * inst/unitTests/runit.ExpressionVector.R: added unit tests for ExpressionVector::eval * src/Rcpp/ExpressionVector.h: ExpressionVector gains a constructor ExpressionVector( const std::string& ) that parses the string as R code * inst/unitTests/runit.ExpressionVector.R: added unit tests to cover the new constructor * src/Rcpp/Environment.h : the Rcpp namespace is cached because we use it in many places and retrieving it is an "expensive" operation that requires a round trip to the R side * src/Evaluator.cpp: use the cached Rcpp namespace * R/Rcpp.package.skeleton: now generating example C++ and R code that uses Rcpp, also the generated Makevars contains a hack so that the generated package can pass check (after edition of Rd files, NAMESPACE, etc ...) * inst/skeleton: added example code used by the skeleton generator 2010-01-15 Romain Francois * src/Rcpp/NumericVector.h: cache the start of the array to improve performance of operator[] * src/NumericVector.cpp: idem * src/Rcpp/IntegerVector.h: * src/Rcpp/RawVector.h: * src/Rcpp/ComplexVector.h: * src/Rcpp/LogicalVector.h: idem * src/IntegerVector.cpp: * src/RawVector.cpp: * src/ComplexVector.cpp: * src/LogicalVector.cpp: idem 2010-01-13 Romain Francois * R/cpp.package.skeleton.R: new function cpp.package.skeleton to extend the code generation performed by package.skeleton to Rcpp features * man/cpp.package.skeleton.Rd: documentation for cpp.package.skeleton * src/Rcpp/VectorBase.h: new virtual class Rcpp::VectorBase to manage common things of all vectors (length, names, etc ...) all Vector classes now derive from VectorBase * src/Rcpp/Environment.h: Environment::Binding gains a templated conversion operator, to facilitate distance 2 implicit conversion making this possible: Environment env("package:stats") ; Function f = env["rnorm"] ; * src/Rcpp/GenericVector.h: GenericVector::Proxy gains an assignement operator to deal with Environment::Binding. This is to work around distance 1 implicit conversion restrictions * src/Rcpp/NumericVector.h: operator[], begin and end are promoted to inline member functions * src/Rcpp/IntegerVector.h: idem * src/Rcpp/RawVector.h: idem * src/Rcpp/LogicalVector.h: idem 2010-01-12 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.2 * debian/*: Similarly updated for new release to Debian * .Rbuildignore: Add 'inst/doc/{html,latex,man} as we no longer ship the voluminous doxygen-generated content * inst/doc/examples/ConvolveBenchmarks/convolve2*: Added simple benchmark on the well-known vector convolution example from 'Writing R Extensions' to compare C and C++ implementations * inst/doc/examples/ConvolveBenchmarks/buildAndRun.sh: idem inst/doc/examples/ConvolveBenchmarks/exampleRCode.r: idem 2010-01-12 Romain Francois * inst/doc/examples/ConvolveBenchmarks/convolve2*: Added additional C++ examples to convolution benchmark highlighting performance gains 2010-01-11 Romain Francois * src/Rcpp/CharacterVector.h: StringProxy gains operator+= * src/CharacterVector.cpp: implementation * src/Rcpp/*Vector.h: operator[] now throws index out of bounds exception when needed (FR#770) * src/*Vector.cpp: same * src/Rcpp/Environment.h: operator[](string) for environment allowing to get/set values of a binding in this environment. The Environment::Binding class has been created to act as a proxy. * src/Environment.cpp: idem * inst/unitTests/runit.environments.R: unit tests for the above 2010-01-10 Romain Francois * src/Rcpp/Pairlist.h: operator[] for pairlist using proxies * src/Pairlist.cpp : idem * inst/unitTests/runit.Pairlist.R: new unit tests * src/Rcpp/Language.h: same for Language * src/Language.cpp : idem * inst/unitTests/runit.Language.R: new unit tests * inst/unitTests/runit.Function.R: added unit test for function throwing exceptions * src/Function.cpp: grab the condition message and not the call 2010-01-09 Romain Francois * src/Rcpp/RObject.h: attr can now be used to get or set the attribute (used to be read only). This is another manifestation of the proxy pattern. The rhs can be anything wrap can handle * inst/unitTests/runit.RObject.R: added test.RObject.attr.set unit test (setting attribute). * src/Rcpp/Function.h: Function::operator() now throws an exception if an R error occurs. 2010-01-08 Dirk Eddelbuettel * configure.in: provide basic support for c++ compiler version detection at build-time so that we can add -std=c++0x when applicable; provide defaults in case we do not use g++ * src/Makevars.in: copied from Makevars, set C++ flags from configure * configure.win: simply log what g++ version is being used 2010-01-08 Romain Francois * src/Rcpp/wrap.h: added wrap( size_t ) to disambiguate it * int/unitTests/runit.XPTr.R: forgot to set the finalizer on the external pointer * src/Rcpp/Pairlist.h: Pairlist gains a push_back, replace, length, size, remove and insert methods * src/Rcpp/Language.h: idem for Language 2010-01-07 Romain Francois * src/Rcpp/Pairlist.h: gains a push_front method * src/Rcpp/wrap.h : now the result type of the various wrap functions depends on the parameters. wrap( bool ) makes a LogicalVector, etc ... wrap(SEXP) dispatches to the appropriate Rcpp:: class depending on TYPEOF * src/Rcpp/RObject.h: added methods "isS4", "slot" and "hasSlot" to deal with S4 objects * inst/unitTests/runit.S4.R: unit tests * src/Rcpp/ComplexVector.h: new class Rcpp::ComplexVector to manage ... complex vectors (CPLXSXP) * src/ComplexVector.cpp: implementation * inst/unitTests/runit.ComplexVector.R: unit tests * src/Rcpp/Promise.h: new class Rcpp::Promise to manage promises (PROMSXP). only read access so far (no way to force the promise) * src/Promise.cpp: implementation * src/Rcpp/RObject.h: the result of attr is now an RObject rather than a SEXP. This does not change previous behavior because of the implicit conversion * src/Rcpp/ExpressionVector.h: new class Rcpp::ExpressionVector which shares a lot with GenericVector. * src/ExpressionVector.cpp: implementation * inst/unitTests/runit.ExpressionVector.R: unit tests * src/Rcpp/CharacterVector.h: new class Rcpp::CharacterVector to manage character vectors (STRSXP). StringVector is a convenience typedef equivalent to CharacterVector * src/CharacterVector.cpp: implementation * inst/unitTests/runit.CharacterVector.R: unit tests * src/Rcpp/WeakReference.h: new class Rcpp::WeakReference to wrap WEAKREFSXP with accessors to the key and value * src/WeakReference.cpp: implementation * src/Rcpp/Rcpp_Rinternals.h: borrowed from Rinternals so that we can use VECTOR_PTR (which R forbids unless we define USE_RINTERNALS, but defining it disables NO_R_REMAP) * src/Rcpp/GenericVector.h : added begin and end to allow stl type iteration over generic vectors. Now using the Proxy pattern (from Item 30 of More Effective C++) to allow getting and setting the elements of the list through the operator[]. * int/unitTests/runit.GenericVector.R: examples are reworked using [] where set and get were used. 2010-01-06 Dirk Eddelbuettel * src/RcppCommon.h: Protect definition of logTxt by #ifndef * inst/doc/Rcpp-unitTests.Rnw: Minor LaTeX tweak 2010-01-06 Romain Francois * src/Rcpp/wrap.h : wrap can now use initializer lists (available on on GCC >= 4.4). * src/wrap.cpp: implementation * int/unitTests/runit.wrap.R: unit tests * src/RObject.cpp : make methods RObject::asFoo calling Rcpp::as to avoid code duplication 2010-01-05 Romain Francois * src/Rcpp/GenericVector.h : new class Rcpp::GenericVector and an alias Rcpp::List to handle lists (VECSXP), aka generic vectors * src/GenericVector.cpp : implementation * inst/unitTests/runit.GenericVector.R: unit tests * src/Rcpp/IntegerVector.h : new class Rcpp::IntegerVector to manage integer vector (INTSXP). IntegerVector can be constructed from SEXP of appropriate type, from an int which simply allocates a vector that big, or using an initialization list (the last is GCC >= 4.4 only). Additionally IntegerVector defines begin() and end() so that they can be used in STL algorithms * src/IntegerVector.cpp : implementation * inst/unitTests/runit.IntegerVector.R: unit tests * src/Rcpp/NumericVector.h : same as above, but for numeric vectors (REALSXP) * src/NumericVector.cpp : implementation * inst/unitTests/runit.NumericVector.R: unit tests * src/Rcpp/RawVector.h : same as above, but for numeric vectors (RAWSXP) * src/RawVector.cpp : implementation * inst/unitTests/runit.RawVector.R: unit tests * src/Rcpp/LogicalVector.h : same as above, but for numeric vectors (RAWSXP) * src/LogicalVector.cpp : implementation * inst/unitTests/runit.LogicalVector.R: unit tests * src/RcppCommon.h: improve the conditional compiling logic with macros HAS_VARIADIC_TEMPLATES and HAS_INIT_LISTS instead of CXX0X. This ensures the package can be compiled with older GCC, with lower functionality * src/RcppCommon.{h,cpp}: added a capabilities function that can be used to bring the result of the two above macros to R * R/RcppLdPaths.R: added unexported function RcppCapabilities to call the internal capabilities. capabilities is an alias to RcppCapabilities so that we can call Rcpp::capabilities() 2010-01-04 Romain Francois * src/Rcpp/Function.h: new class Rcpp::Function to manage functions (closures, primitives and builtins) all share the Function class (at least for now). This is implemented as a functor taking variable number of arguments, so it looks pretty similar to the R function * src/Function.cpp: implementation * inst/unitTests/runit.Function.R: unit tests * src/Rcpp/Pairlist.h: new class Rcpp::Pairlist to manage dotted pair lists (LISTSXP). unsurprisingly this shares a lot of similarities with Language class * src/Pairlist.cpp: implementation * inst/unitTests/runit.Pairlist.R: unit tests for Rcpp::Pairlist * src/Rcpp/wrap.h: wrap no more a template. this was not a good idea as it prevented implicit conversion to SEXP behavior when wrap'ing a RObject. * src/Rcpp/Environment.h: added the remove method * src/unitTests/runit.environments.R: remove unit test * src/unitTests/runit.Language.R: remove verbose=TRUE in cfunction call (generated noise) * src/wrap.cpp: added a few missing PROTECT 2010-01-04 Dirk Eddelbuettel * src/excections.cpp: Get rid of another unused variable * src/RcppCommon.cpp: Idem 2010-01-03 Romain Francois * src/Rcpp/Environment.h: Environment gains the parent method that returns the parent environment * src/Rcpp/as.h: template as<> to convert SEXP to classic C++ types, factored out of RObject * src/as.cpp: specific implementations. as, as as, ... * inst/unitTests/runit.as.R: unit tests * src/Rcpp/wrap.h : factored out from RObject. there is now a template wrap in addition to the specific implementations. The template generates a warning and return NULL * src/wrap.cpp: specific implementations of the wrap template (factored out of RObject) * src/Rcpp/pairlist.h : variadic templates to recursively generate a pairlist (CAR and CDR) from any number of "wrap("'able objects. (factored out of Language) * src/pairlist.cpp: end of recursion for the above * src/Rcpp/grow.h : grow a pairlist with any wrappable object. Used in pairlist * src/grow.cpp : specific implementation for Named object to allow tagging the head of the pairlist. * src/Rcpp/Named.h : new class Named that is used to specify named elements in a pairlist. * src/Named.cpp: implementation * src/Rcpp/RObject.h: added wrap(const char* const) RObject factory method * src/Rcpp/RObject.h: rework the garbage collection mechanism so that it is automatic and hidden. methods preserve and release are now private to the RObject class and the SEXP may only be changed using the protected setSEXP member function. isPreserved and forgetPreserve are defunct. * src/Rcpp/RObject.h: RObject gains assignment operators and copy constructors * src/RcppCommon.h: added the CXX0X define that controls whether we can use C++0x features offered by the gcc. currently the define is hardcoded, but this will eventually be a configure guess. The canUseCXX0X function can be called to bring this back to R * R/RcppLdPath.R: added the canUseCXX0X R function to query the internal canUseCXX0X function, use this in RcppCxxFlags so that code linking against Rcpp (inline code or packages) can take advantage of it * src/Rcpp/Language.h : new class Rcpp::Language to manage calls (LANGSXP SEXP) * src/Language.cpp : implementation * inst/unitTests/runit.Language.R: unit tests * src/Rcpp/Environment.h : added constructors and made the SEXP based constructor smarter (using as.environment) * inst/unitTests/runit.environments.R: more unit tests * src/Rcpp/Symbol.h: new class Rcpp::Symbol to encapsulate symbols. This allows to use Symbol("rnorm") instead of the most cryptic Rf_install("rnorm") * src/Symbol.cpp: implementation * inst/unitTests/runit.Symbol.R: unit tests 2010-01-03 Dirk Eddelbuettel * doxyfile: updated to current doxygen standard using -u 2010-01-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.1 * debian/*: Similarly updated for new release to Debian 2010-01-02 Romain Francois * pkg/src/RcppSexp.h: Added to preserve existing interface, implementation use the redesigned class src/RObject.h 2010-01-01 Romain Francois * pkg/src/Rcpp/RObject.h: RObject::RObject constructors are replaced by the Rcpp::wrap set of functions. Currently the wrap functions make a RObject object but it is likely that as new classes become available in the new API, wrap will return instances of classes that extend RObject. * pkg/src/Rcpp/RObject.h: s/protect/preserve/, added methods isPreserved and forgetPreserve * ** : adapted examples, code, and unit tests to reflect both above items 2009-12-31 Romain Francois * src/Rcpp/Evaluator.h : new class Rcpp::Evaluator that eases evaluation of R expression with error capture. so that we can for example throw C++ exceptions * src/Evaluator.cpp : implementation of Rcpp::Evaluator * inst/unitTests/runit.evaluator: unit tests of Rcpp::Evaluator * inst/Rcpp/RObject.h: RObject::RObject(SEXP) now initializes isProtected * inst/src/Environment.cpp: use of exceptions 2009-12-30 Romain Francois * src/Rcpp/Environment.h : added support for environment through the Rcpp::Environment class * src/Environment.cpp: idem * inst/unitTests/runit.environments.R: testing the above * src/RcppCommon.h: now includes , needed for the environment support 2009-12-30 Romain Francois * src/Makevars* : adapt for allowong copy of the Rcpp directory * src/Rcpp_RObject.h: replace by src/Rcpp/RObject.h * src/Rcpp_XPtr.h: replaced by src/Rcpp/XPtr.h * src/*.cpp: adapt to the Rcpp directory * cleanup: idem 2009-12-30 Romain Francois * inst/unitTests/runit.RObject.R: new unit tests * inst/unitTests/runit.exceptions.R: idem * inst/unitTests/runit.XPtr.R: idem * man/RcppUnitTests.Rd: shows and link unit test reports generated at build time 2009-12-29 Romain Francois * src/Rcpp_RObject.{h,cpp}: new namespace Rcpp and new class Rcpp::RObject to replace RcppSexp with the same functionality. * src/Rcpp_XPtr.h: replaces RcppXPtr.h and the class is now Rcpp::XPtr<> and extends Rcpp::RObject * inst/examples/RcppInline/external_pointer.r: use the new namespace * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: idem * inst/examples/RcppInline/RcppSexpTests.r: idem * DESCRIPTION: marked as version 0.7.0.5 * inst/doc/*: fake (empty) vignette and unit test trigger * inst/unitTests/*: prepare the space for unit tests * tests/doRUnit.R : added the usual RUnit tests trigger 2009-12-29 Romain Francois * src/RcppXPtr.h: now RcppXPtr extends RcppSexp and RcppSexp manages garbarge collection, attributes, etc ... * src/exceptions.cpp: replaces src/exception_handling.cpp * DESCRIPTION: now suggesting RUnit. 2009-12-29 Romain Francois * src/RcppXPtr.h: added operator SEXP() to class RcppXPtr to ease implicit conversion from RcppXPtr to SEXP. This means we can directly return the RcppXPtr object to R when the return type of the function is SEXP. (no need to explicitely call asSexp anymore) * src/RcppSexp.{h,cpp} : idem 2009-12-29 Romain Francois * src/RcppXPtr.h: new smart external pointer wrapper. The RcppXPtr template can be used to wrap a external pointer (SEXP) so that it looks like the dumb pointer it is wrapping (as far as the * and -> operator are concerned). The template parameter controls the type of object that is wrapped by the pointer. * src/Rcpp.h: importing the RcppXPtr.h header * src/RcppExample.cpp: added an example of RcppXPtr usage * inst/examples/RcppInline/external_pointer.r: added example using the RcppXPtr template * DESCRIPTION: marking this as 0.7.0.4 2009-12-28 Romain Francois * R/exceptions.R: s/uncaught_cpp_exception/cpp_exception/ and added a 'class' argument to hold the class name of the C++ exception (range_error, etc ...) * inst/examples/RcppInline/UncaughtExceptions.r: extend examples to show how to grab details of the C++ exception * src/exception_handling.cpp: factored out from RcppCommon.cpp, now able to grab the class name of the exception and its message. 2009-12-27 Dirk Eddelbuettel * R/RcppInline.R: Removed as we now use cfunction() from inline (>= 0.3.4) * man/{RcppInline,internals}.Rd: idem * NAMESPACE: removed entries related to cfunction and methods * DESCRIPTION: Added 'Suggests: inline (>= 0.3.4) * inst/examples/RcppInline/*R: Add library(inline) or require(inline) 2009-12-27 Romain Francois * src/RcppCommon.{h,cpp} : added experimental uncaught exception management * R/zzz.R : added .onAttach, used to register the uncaught exception management on package attach * R/exceptions.R : added R side of the exception management, unexported as it is only used by internal C++ code * inst/examples/RcppInline/UncaughtExceptions.r: demo of the uncaught exception system * src/RcppSexp.{h,cpp} : added method isNULL to test if the underlying SEXP is NULL * src/RcppSexp.{h,cpp} : added some methods to deal with attributes attributeNames : the names of the attributes as a vector hasAttribute : test whether the SEXP has the given attribute attr : extract the attribute (might return NULL) * src/RcppSexp.{h,cpp} : added RcppSexp(bool), RcppSexp(vector) constructors and RcppSexp.asBool(), RcppSexp.asStdVectorBool() methods * inst/examples/RcppInline/RcppSexpTests.r: examples/tests of the above items 2009-12-26 Romain Francois * src/RcppSexp.{h,cpp} : added std::set<{int,double,Rbyte,string}> as accepted input type for the RcppSexp class (needed by RProtoBuf) * inst/examples/RcppInline/RcppSexpTests.r: examples/tests of the above 2009-12-21 Romain Francois * src/RcppSexp.{h,cpp} : support for raw vector added into RcppSexp * inst/examples/RcppInline/RcppSexpTests.r: examples of raw vector support 2009-12-20 Dirk Eddelbuettel * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: Minor simplifications using new RcppSexp types, added third example 2009-12-19 Dirk Eddelbuettel * DESCRIPTION: Release 0.7.0 * DESCRIPTION: Descrition fields reworded and expanded to explicitly mention 'inlining' ability as well as simple SEXP support. * src/RcppSexp.{h,cpp}: Switch to R_PreserveObject and R_ReleaseObject with a big thanks to Romain for the most appropriate suggestion * src/RcppSexp.{h,cpp}: Added converters for vectors of int, double, and std::string vectors * src/RcppResultsSetp.{h,cpp}: Added simple single SEXP return * src/RcppCommon.{h,cpp}: Adding simple logging facility * inst/examples/RcppInline/RcppSexpTests.r: expanded for new types 2009-12-18 Dirk Eddelbuettel * R/RcppInline.R: Another improvement for Rcpp use * inst/examples/RcppInline/RcppSimpleExamples.r: Another simple case 2009-12-17 Dirk Eddelbuettel * R/RcppInline.R: Improved / simplified in light of getting it to work on Windoze too so switched to setting env var explicitly; also split into three args for CPPFLAGS, CXXFLAGS and LIBS * man/RcppInline.Rd: Updated accordingly to reflect new args * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: Idem 2009-12-16 Dirk Eddelbuettel * src/RcppSexp.{h,cpp}: Added simple RcppSexp class for simple conversion from and to single-element SEXPs -- currently limited to int, double, std::string * inst/examples/RcppInline/RcppSexpTests.r: Simple tests for this 2009-12-15 Dirk Eddelbuettel * DESCRIPTION: License changed to 'GPL (>= 2)' * COPYING: Changed from LGPL 2.1 to GPL 2 (or later) * src/*.{h,cpp}: Relicensed under GPL 2 (or later) 2009-12-13 Dirk Eddelbuettel * R/RcppInline.R: Extended to for additional header and library arguments so that we can work with arbitrary other projects * man/RcppInline.Rd: Added documentation for these arguments * inst/examples/RcppInline/RcppInlineWithLibsExamples.r: New examples using GNU GSL to show how to compile + link via inline 2009-12-11 Dirk Eddelbuettel * R/RcppInline.R: Imported function 'cfunction' from the inline package, along with small patch to directly support Rcpp. The inclusion may be temporary -- if our patch is integrated into inline we may just depend on that package * man/RcppInline.Rd: Imported from inline, plus change for Rcpp * inst/examples/RcppInline/RcppInlineExample.r: Small example taken from the 'Intro to HPC with R' tutorials * R/RcppVersion.R: Removed as unused as redundant given read.dcf() in R * man/RcppVersion.R: idem * NAMESPACE: updated accordingly * INDEX: idem 2009-11-18 Dirk Eddelbuettel * DESCRIPTION: Add Dominick back into Authors per his new request reversing his requests to be removed from last December 2009-11-17 Dirk Eddelbuettel * man/RcppParams.Rd: applied patch by Frank S. Thomas to fix example 2009-11-15 Dirk Eddelbuettel * src/RcppDateVector.{cpp,h}: Moved out of Rcpp.{h,cpp} * src/RcppDatetimeVector.{cpp,h}: idem * src/RcppFunction.{cpp,h}: idem * src/RcppMatrix.{cpp,h}: idem * src/RcppMatrixView.{cpp,h}: idem * src/RcppNumList.{cpp,h}: idem * src/RcppResultSet.{cpp,h}: idem * src/RcppStringVector.{cpp,h}: idem * src/RcppStringVectorView.{cpp,h}: idem * src/RcppVector.{cpp,h}: idem * src/RcppVectorView.{cpp,h}: idem * src/RcppCommon.cpp: takes remaining utility function from Rcpp.cpp 2009-11-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.8 * src/RcppParams.{cpp,h}: Code reorginsation, moved out of Rcpp.{h,cpp} * src/RcppDate.{cpp,h}: idem * src/RcppDatetime.{cpp,h}: idem * src/RcppCommon.h: New header file for common defines and includes * src/Makevars{,.win}: Updated and generalised to reflect new files 2009-11-08 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.7 * man/RcppVector.Rd: Remove erraneous use of \R in \title{} section noticed by the Rd parser in R-devel (with thanks to Kurt Hornik) 2009-11-06 Dirk Eddelbuettel * src/RcppList.{h,cpp}: Added a simple class to accept list() objects in order to cope with non-rectangular data-types -- this comes from the RProtoBuf code currently only on r-forge where we need accept lists that are potentially nested. The API for RcppList is not fully fleshed out and needs a few more append() member functions. Also length is currently fixed. * cleanup: Change header file removal to Rcpp*.h * inst/README: Added short README about history and status * inst/doc/: Updated doxygen documentation 2009-09-29 Dirk Eddelbuettel * inst/examples/functionCallback/*: Added simple C++ / R example of defining an R function that is passed to and called from C++ 2009-08-03 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.6 * src/Rcpp.{h,cpp}: Added exists() method for RcppParams to test for existence of a named parameter. * inst/doc/: Updated doxygen documentation 2009-04-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.5 * COPYING: Added 2009-03-30 Dirk Eddelbuettel * src/Makevars: Add $(R_ARCH) to target directory path when copying the header file as an OS X user reported not finding it with default settings. 2009-03-01 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.4 * .Rbuildignore: Added to exclude debian/ from source tarball 2009-02-25 Dirk Eddelbuettel * src/Makevars.win: Renamed from Makefile.win, added missing mkdir * cleanup: Remove a few more Windows files 2009-02-24 Dirk Eddelbuettel * inst/doc/{html,latex,man}: Added new documentation of the C++ classes * doxyfile: Added Doxygen configuration file for doc generation 2009-02-22 Dirk Eddelbuettel * src/Rcpp.{h,cpp}: cleaner use of namespace 'std' by formal prefix rather than via 'using namespace std' * src/Rcpp.h: define R_NO_MAP and use Rf_* form of R API functions 2009-02-18 Dirk Eddelbuettel * src/Rcpp.{h,cpp}: Added a few explicit casts, and removed unused loop variable; all to make 'g++ -Wall' happy 2009-02-10 Dirk Eddelbuettel * src/Rcpp.{cpp,h}: Expanded a few of the throw() messages 2009-01-09 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.3 * R/RcppLdpath.R: Also defined shorter functions CxxFlags() and LdFlags() which cat() the longer forms RcppCxxFlags() and RcppLdFlags() to further simplify use via litter or Rscript in Makefile or Makevars * man/Rcpp-package.Rd: Mention short form CxxFlags() and LdFlags() * src/Makevars: Applied another build correction for OS X suggested by Simon Urbanek * src/Rcpp.{cpp,h}: Added 'view-only' classes RcppVectorView, RcppMatrixView and RcppStringVectorView contributed by David Reiss 2008-12-02 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.2 * R/RcppLdPath.R: Correct output for the default Linux case 2008-11-30 Dirk Eddelbuettel * DESCRIPTION: Release 0.6.1 * src/Makevars: Added, replacing src/Makefile: thanks to Simon for a rewrite that provides OS X support * src/Makefile: Retired * src/Makefile.win: Now build libRcpp.a instead of Rcpp.a * src/Rcpp.{cpp,h}: Removed #ifdef statements related to QuantLib and Date ops as we no longer need to split this off -- one build for all uses; also added another date offset for the difference between the Unix epoch of Jan 1, 1970 and what certain spreadsheets use (which is what QuantLib) follows. With this change, Rcpp is completely decoupled from QuantLib headers, yet can be used from QuantLib 0.2.10 or later. However, this also removes data conversion from R/Rcpp to QL as Rcpp no longer 'knows' QL. * R/RcppLdPath.R: Adds new functions RcppLdPath() to return lib/ directory path, and RcppLdFlags() to return arguments, including the optional rpath settings on Linux * R/RcppExample.R: Added new example 'RcppVectorExample()', extended default print method for examples * man/Rcpp-package.Rd: Expanded / updated documentation of package use when building other packages * cleanup: Removing static libraries too but do not remove src/Makevars 2008-11-05 Dirk Eddelbuettel * Release 0.6.0 * New maintainer * src/Makefile{,.win}: New files, including functionality from both configure and RcppSrc/Makefile; we now build two libraries, one for use by the package which also runs the example, and one for users to link against * src/Makevars.in: Removed * src/Rcpp.{cpp,h}: moved in from ../RcppSrc * src/Rcpp.{cpp,h}: Add new type RcppDatetime corresponding to POSIXct in with full support for microsecond time resolution between R and C++ * man/*: Several new manual pages added * configure{,.in,.win}: Removed as src/Makefile* can handle this more easily * DESCRIPTION: Minor cleanup and reformatting, Date: now uses svn:keyword Date property * NAMESPACE: Renamed RcppTemplateVersion to RcppVersion, deleted RcppDemo * demo/ directory removed as vignette("RcppAPI") is easier and more reliable to show vignette documentation * R/zzz.R: RcppTemplateDemo() removed, vignette("RcppAPI") is easier * man/RcppTemplateDemo.Rd removed as well * R/RcppExample.R: reindented, rewritten to set default arguments * R/RcppTemplateVersion.R: renamed to RcppVersion.R * man/RcppTemplateVersion.Rd: renamed to RcppVersion.Rd * RcppSrc/Rcpp.{cpp,h}: moved to src/ directory * RcppSrc/Makefile{,.win}: removed * inst/doc/RcppAPI.{Rnw,pdf}: Added footnote onto titlepage about how this document has not (yet) been updated along with the channges made Rcpp/NAMESPACE0000644000176200001440000000221415121245304012371 0ustar liggesusersuseDynLib(Rcpp, .registration = TRUE) import(methods) importFrom(utils, capture.output, assignInNamespace, .DollarNames, prompt, packageDescription, package.skeleton, glob2rx) exportClasses(Module, "C++Field", "C++OverloadedMethods", "C++Constructor", "C++Class", "C++Object", "C++Function") S3method(.DollarNames, "C++Object") S3method(.DollarNames, "Module") exportMethods(prompt, show, .DollarNames, initialize, "formals<-") export(Module, Rcpp.package.skeleton, populate, setRcppClass, loadRcppClass, loadModule, cppFunction, exposeClass, evalCpp, sourceCpp, compileAttributes, registerPlugin, RcppLdFlags, # deprecated since Rcpp 0.12.19 released Sep 2018 LdFlags, # deprecated since Rcpp 0.12.19 released Sep 2018 demangle, sizeof, cpp_object_initializer, cpp_object_dummy, Rcpp.plugin.maker, getRcppVersion) S3method(print, bytes) S3method(format, Rcpp_stack_trace) S3method(str, Rcpp_stack_trace) S3method(print, Rcpp_stack_trace) exportClass(RcppClass) Rcpp/TODO0000644000176200001440000000466212471457623011671 0ustar liggesusers Current active misfeatures o Rcpp.package.skeleton() does not work with supplied functions, eg Rcpp.package.skeleton("foo", list=c("funA", "funB")) ends in error. o Sugar ops unit tests on +, -, ... need double, fail with int o DataFrame::create(Named("a")=b, Named("b")=b) fails with NumericVectors Documentation o Finish the quickref vignette o Maybe a vignette about stats functions o Add a vignette about the API API o Rcpp::Factor and Rcpp::Ordered o Fast indexing and g++ 4.5.0 or later: open issue of why this compiler gets upset when the previous version(s) coped just fine o Vector::resize Modules o Class inheritance. Reflect C++ inheritance at the R level. Syntactic sugar o logical indexing, ie NumericVector( LogicalVector ) o recycling : binary operators and math functions of 2 or more arguments need to recycle their arguments. o not sure rep should be lazy, i.e. rep( x, 4 ) fetches x[i] 4 times, maybe we should use LazyVector like in outer to somehow cache the result when it is judged expensive to calculate o crossprod o Vector * Matrix, Matrix * Matrix o operator% o operator/ needs to handle the case of division by 0 o matrix functions : apply o for character vectors: nchar, grepl, sub, gsub o Compound operators: ++,--,+=, -=, ... o other statistical distribution functions : multinom : this only has dmultinom which is handled in R, so maybe we can skip it signrank : has the weird call to .C( "signrank_free" ), need to understand that wilcox : has the weird call to .C( "wilcox_free" ), need to understand that tukey : only has p and q, no r or d o other random generators: rmultinom : tricky because it generates a matrix rnbeta : the R version is implemented in R (not in C), should we still have it in Rcpp in compile code ? rnf : idem rnt : idem Testing o all r* functions : rnorm, etc ... o many dpq functions have not been tested yet o new autogenerated sugar functions: cos, acosh, atan, cos, cosh, log, log10, sqrt, sin, sinh, tan, tanh o attributes (although our tests currently use attributes extensively so it's not clear what else we'd add here) Rcpp/inst/0000755000176200001440000000000015127740107012137 5ustar liggesusersRcpp/inst/prompt/0000755000176200001440000000000012253723677013472 5ustar liggesusersRcpp/inst/prompt/module.Rd0000644000176200001440000000103412253723677015244 0ustar liggesusers\name{NAME} \alias{NAME} \title{ Rcpp module: %% ~~ Name of the module ~~ } \description{ Rcpp module %% ~~ A concise description of the module ~~ } \details{ The module contains the following items: FUNCTIONS CLASSES } \source{ %% ~~ reference to a publication or URL ~~ %% ~~ perhaps a reference to the project page of the c++ code being exposed ~~ } \references{ %% ~~ possibly secondary sources and usages ~~ %% ~~ perhaps references to the C++ code that the module exposes ~~ } \examples{ show( NAME ) } \keyword{datasets} Rcpp/inst/include/0000755000176200001440000000000015127275607013572 5ustar liggesusersRcpp/inst/include/Rcpp/0000755000176200001440000000000015130420312014451 5ustar liggesusersRcpp/inst/include/Rcpp/Light0000644000176200001440000000164414154713250015463 0ustar liggesusers// Rcpp/Light: R/C++ interface class library -- without Rcpp Modules // // Copyright (C) 2008 - 2021 Dirk Eddelbuettel // Copyright (C) 2009 - 2021 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 . // no Modules #define RCPP_NO_MODULES // include Rcpp as usual #include Rcpp/inst/include/Rcpp/longlong.h0000644000176200001440000000220314771021271016451 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // longlong.h: Rcpp R/C++ interface class library -- long long support // // Copyright (C) 2013 - 2017 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2018 - 2025 Dirk Eddelbuettel, Romain Francois and Kevin Ushey // // 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 . #ifndef RCPP_LONG_LONG_H #define RCPP_LONG_LONG_H typedef long long int rcpp_long_long_type; typedef unsigned long long int rcpp_ulong_long_type; # define RCPP_HAS_LONG_LONG_TYPES #endif Rcpp/inst/include/Rcpp/Module.h0000644000176200001440000005614015126566764016110 0ustar liggesusers // Module.h: Rcpp R/C++ interface class library -- Rcpp modules // // 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 . #ifndef Rcpp_Module_h #define Rcpp_Module_h #include #include namespace Rcpp{ namespace internal{ template std::string get_converter_name(const char* from, const char* to){ std::string method_name( ".___converter___" ) ; typedef typename Rcpp::traits::r_type_traits< typename Rcpp::traits::remove_const_and_reference::type >::r_category FROM_CATEGORY ; if( Rcpp::traits::same_type< FROM_CATEGORY, ::Rcpp::traits::r_type_module_object_tag >::value ){ method_name += "Rcpp_" ; } method_name += from ; method_name += "___" ; typedef typename Rcpp::traits::r_type_traits< typename Rcpp::traits::remove_const_and_reference::type >::r_category TO_CATEGORY ; if( Rcpp::traits::same_type< TO_CATEGORY, ::Rcpp::traits::r_type_module_object_tag >::value ){ method_name += "Rcpp_" ; } method_name += to ; return method_name ; } } class CppClass ; class CppObject ; template class result { public: result( T* ptr_ ) : ptr(ptr_){} operator T*(){ return ptr ; } private: T* ptr; } ; template class object { public: typedef T object_type ; object( T* ptr_ ) : ptr(ptr_){} operator T*(){ return ptr ; } T* operator->(){ return ptr ; } T& operator&(){ return *ptr ; } T* ptr ; } ; namespace internal { template SEXP make_new_object( Class* ptr ){ Rcpp::XPtr xp( ptr, true ) ; Function maker = Environment::Rcpp_namespace()[ "cpp_object_maker"] ; return maker( typeid(Class).name() , xp ) ; } } } #include #include namespace Rcpp { template inline void signature(std::string& s, const char* name) { s.clear(); s += get_return_type() + " " + name + "("; int n = sizeof...(T); int i = 0; // Using initializer list as c++11 implementation of a fold expression (void)std::initializer_list{ (s += get_return_type(), s += (++i == n ? "" : ", "), 0)... }; s += ")"; } template class CppFunctionN : public CppFunction { public: CppFunctionN(RESULT_TYPE (*fun)(T...), const char* docstring = 0) : CppFunction(docstring), ptr_fun(fun) {} SEXP operator()(SEXP* args) { BEGIN_RCPP return call(ptr_fun, args); END_RCPP } inline int nargs() { return sizeof...(T); } inline bool is_void() { return std::is_void::value; } inline void signature(std::string& s, const char* name) { Rcpp::signature(s, name); } inline DL_FUNC get_function_ptr() { return (DL_FUNC)ptr_fun; } private: RESULT_TYPE (*ptr_fun)(T...); }; template class CppFunction_WithFormalsN : public CppFunctionN { public: CppFunction_WithFormalsN(RESULT_TYPE (*fun)(T...), Rcpp::List formals_, const char* docstring = 0) : CppFunctionN(fun, docstring), formals(formals_) {} SEXP get_formals() { return formals; } private: Rcpp::List formals; }; } #include #include namespace Rcpp{ template class CppMethod { public: typedef Rcpp::XPtr XP ; CppMethod() {} virtual SEXP operator()(Class* /*object*/, SEXP* /*args*/) { return R_NilValue ; } virtual ~CppMethod(){} virtual int nargs(){ return 0 ; } virtual bool is_void(){ return false ; } virtual bool is_const(){ return false ; } virtual void signature(std::string& s, const char* name ){ s = name ; } } ; template class CppInheritedMethod : public CppMethod { public: typedef Rcpp::XPtr XP ; typedef CppMethod ParentMethod ; CppInheritedMethod( ParentMethod* parent_method_pointer_ ) : parent_method_pointer(parent_method_pointer_) {} SEXP operator()( Class* object, SEXP* args){ return (*parent_method_pointer)( (Parent*)object, args ) ; } inline int nargs(){ return parent_method_pointer->nargs() ; } inline bool is_void(){ return parent_method_pointer->is_void() ; } inline bool is_const(){ return parent_method_pointer->is_const() ; } inline void signature(std::string& s, const char* name){ return parent_method_pointer->signature(s, name) ; } private: ParentMethod* parent_method_pointer ; } ; template inline void ctor_signature(std::string& s, const std::string& classname) { s.assign(classname); s += "("; int n = sizeof...(T); int i = 0; // Using initializer list as c++11 implementation of a fold expression (void)std::initializer_list{ (s += get_return_type(), s += (++i == n ? "" : ", "), 0)... }; s += ")"; } template class Constructor_Base { public: virtual Class* get_new( SEXP* args, int nargs ) = 0 ; virtual int nargs() = 0 ; virtual void signature(std::string& s, const std::string& class_name) = 0 ; } ; template class Constructor: public Constructor_Base { public: virtual Class* get_new( SEXP* args, int nargs ){ return get_new_impl(args, nargs, traits::make_index_sequence()); } virtual int nargs(){ return sizeof...(T) ; } virtual void signature(std::string& s, const std::string& class_name ){ ctor_signature(s, class_name) ; } private: template Class* get_new_impl(SEXP* args, int nargs, traits::index_sequence) { return new Class( as(args[Is])... ) ; } }; template class Factory_Base { public: virtual Class* get_new( SEXP* args, int nargs ) = 0 ; virtual int nargs() = 0 ; virtual void signature(std::string& s, const std::string& class_name) = 0 ; } ; template class Factory : public Factory_Base { public: Factory( Class* (*fun)(T...) ) : ptr_fun(fun){} virtual Class* get_new( SEXP* args, int nargs ){ return get_new( args, traits::make_index_sequence() ) ; } virtual int nargs(){ return sizeof...(T) ; } virtual void signature(std::string& s, const std::string& class_name ){ ctor_signature(s, class_name) ; } private: template Class* get_new( SEXP* args, traits::index_sequence ){ return ptr_fun( bare_as(args[I])... ) ; } Class* (*ptr_fun)(T...) ; } ; inline bool yes( SEXP* /*args*/, int /* nargs */ ){ return true ; } template bool yes_arity( SEXP* /* args */ , int nargs){ return nargs == n ; } typedef bool (*ValidConstructor)(SEXP*,int) ; typedef bool (*ValidMethod)(SEXP*,int) ; template class SignedConstructor { public: SignedConstructor( Constructor_Base* ctor_, ValidConstructor valid_, const char* doc ) : ctor(ctor_), valid(valid_), docstring(doc == 0 ? "" : doc){} Constructor_Base* ctor ; ValidConstructor valid ; std::string docstring ; inline int nargs(){ return ctor->nargs() ; } inline void signature(std::string& buffer, const std::string& class_name){ ctor->signature(buffer, class_name) ; } } ; template class SignedFactory { public: SignedFactory( Factory_Base* fact_, ValidConstructor valid_, const char* doc ) : fact(fact_), valid(valid_), docstring(doc == 0 ? "" : doc){} Factory_Base* fact ; ValidConstructor valid ; std::string docstring ; inline int nargs(){ return fact->nargs() ; } inline void signature(std::string& buffer, const std::string& class_name){ fact->signature(buffer, class_name) ; } } ; template class SignedMethod { public: typedef CppMethod METHOD ; SignedMethod( METHOD* m, ValidMethod valid_, const char* doc ) : method(m), valid(valid_), docstring(doc == 0 ? "" : doc) {} METHOD* method ; ValidMethod valid ; std::string docstring ; inline int nargs(){ return method->nargs() ; } inline bool is_void(){ return method->is_void() ; } inline bool is_const(){ return method->is_const() ; } inline void signature(std::string& s, const char* name){ method->signature(s, name); } } ; template class S4_CppConstructor : public Reference { typedef Reference Base; public: typedef XPtr XP_Class ; typedef Reference::Storage Storage ; S4_CppConstructor( SignedConstructor* m, const XP_Class& class_xp, const std::string& class_name, std::string& buffer ) : Reference( "C++Constructor" ){ RCPP_DEBUG( "S4_CppConstructor( SignedConstructor* m, SEXP class_xp, const std::string& class_name, std::string& buffer" ) ; field( "pointer" ) = Rcpp::XPtr< SignedConstructor >( m, false ) ; field( "class_pointer" ) = class_xp ; field( "nargs" ) = m->nargs() ; m->signature( buffer, class_name ) ; field( "signature" ) = buffer ; field( "docstring" ) = m->docstring ; } RCPP_CTOR_ASSIGN_WITH_BASE(S4_CppConstructor) } ; template class S4_CppOverloadedMethods : public Rcpp::Reference { typedef Rcpp::Reference Base; public: typedef Rcpp::XPtr XP_Class ; typedef SignedMethod signed_method_class ; typedef std::vector vec_signed_method ; S4_CppOverloadedMethods( vec_signed_method* m, const XP_Class& class_xp, const char* name, std::string& buffer ) : Reference( "C++OverloadedMethods" ){ int n = static_cast(m->size()) ; Rcpp::LogicalVector voidness(n), constness(n) ; Rcpp::CharacterVector docstrings(n), signatures(n) ; Rcpp::IntegerVector nargs(n) ; signed_method_class* met ; for( int i=0; iat(i) ; nargs[i] = met->nargs() ; voidness[i] = met->is_void() ; constness[i] = met->is_const() ; docstrings[i] = met->docstring ; met->signature(buffer, name) ; signatures[i] = buffer ; } field( "pointer" ) = Rcpp::XPtr< vec_signed_method >( m, false ) ; field( "class_pointer" ) = class_xp ; field( "size" ) = n ; field( "void" ) = voidness ; field( "const" ) = constness ; field( "docstrings" ) = docstrings ; field( "signatures" ) = signatures ; field( "nargs" ) = nargs ; } RCPP_CTOR_ASSIGN_WITH_BASE(S4_CppOverloadedMethods) } ; template class CppMethodImplN : public CppMethod { public: typedef typename std::conditional::type Method; typedef CppMethod method_class; typedef typename Rcpp::traits::remove_const_and_reference::type CLEANED_RESULT_TYPE; CppMethodImplN(Method m) : method_class(), met(m) {} SEXP operator()(Class* object, SEXP* args) { // Can't pass pointer to member function directly to `call()`, so wrap it in a lambda auto f = [&object, this](T... cpp_args) -> CLEANED_RESULT_TYPE { return (object->*met)(cpp_args...); }; return call(f, args); } inline int nargs() { return sizeof...(T); } inline bool is_void() { return std::is_void::value; } inline bool is_const() { return IsConst; } inline void signature(std::string& s, const char* name) { Rcpp::signature(s, name); } private: Method met; }; template using CppMethodN = CppMethodImplN; template using const_CppMethodN = CppMethodImplN; template class Pointer_CppMethodImplN : public CppMethod { public: typedef typename std::conditional::type Method; typedef CppMethod method_class; typedef typename Rcpp::traits::remove_const_and_reference::type CLEANED_RESULT_TYPE; Pointer_CppMethodImplN(Method m) : method_class(), met(m) {} SEXP operator()(Class* object, SEXP* args) { // Need to have `object` as the first argument to the function, so wrap it in a lambda auto f = [&object, this](T... cpp_args) -> CLEANED_RESULT_TYPE { return met(object, cpp_args...); }; return call(f, args); } inline int nargs() { return sizeof...(T); } inline bool is_void() { return std::is_void::value; } inline bool is_const() { return IsConst; } inline void signature(std::string& s, const char* name) { Rcpp::signature(s, name); } private: Method met; }; template using Pointer_CppMethodN = Pointer_CppMethodImplN; template using Const_Pointer_CppMethodN = Pointer_CppMethodImplN; template class CppProperty { public: typedef Rcpp::XPtr XP ; CppProperty(const char* doc = 0) : docstring( doc == 0 ? "" : doc ) {} ; virtual ~CppProperty(){} ; virtual SEXP get(Class* ) { throw std::range_error("cannot retrieve property"); } virtual void set(Class*, SEXP) { throw std::range_error("cannot set property"); } virtual bool is_readonly(){ return false; } virtual std::string get_class(){ return ""; } std::string docstring ; } ; template class CppInheritedProperty : public CppProperty { public: typedef CppProperty Base ; CppInheritedProperty( CppProperty* parent_property_ ) : Base( parent_property_->docstring.c_str() ), parent_property(parent_property_) {} SEXP get( Class* obj ){ return parent_property->get( (Parent*)obj ) ; } void set( Class* obj, SEXP s) { parent_property->set( (Parent*)obj, s ) ; } bool is_readonly(){ return parent_property->is_readonly() ; } std::string get_class(){ return parent_property->get_class() ; } private: CppProperty* parent_property ; } ; template class CppFinalizer{ public: CppFinalizer(){} ; virtual void run(Class* ){} ; } ; template class FunctionFinalizer : public CppFinalizer { public: typedef void (*Pointer)(Class*) ; FunctionFinalizer( Pointer p ) : finalizer(p){} ; virtual void run(Class* object){ finalizer( object ) ; } private: Pointer finalizer ; } ; template class S4_field : public Rcpp::Reference { typedef Rcpp::Reference Base; public: typedef XPtr XP_Class ; S4_field( CppProperty* p, const XP_Class& class_xp ) : Reference( "C++Field" ){ RCPP_DEBUG( "S4_field( CppProperty* p, const XP_Class& class_xp )" ) field( "read_only" ) = p->is_readonly() ; field( "cpp_class" ) = p->get_class(); field( "pointer" ) = Rcpp::XPtr< CppProperty >( p, false ) ; field( "class_pointer" ) = class_xp ; field( "docstring" ) = p->docstring ; } RCPP_CTOR_ASSIGN_WITH_BASE(S4_field) } ; #include #include template class enum_ { public: typedef enum_ self ; enum_( const char* name_ ) : name(name_), values(), parent_typeinfo_name( typeid(Parent).name() ){ } ~enum_(){ Rcpp::Module* module = getCurrentScope() ; module->add_enum( parent_typeinfo_name, name, values ) ; } self& value( const char* name_, Enum value_ ){ values.insert( PAIR( name_, static_cast( value_ ) ) ) ; return *this ; } private: std::string name ; typedef std::map< std::string, int > MAP ; typedef MAP::value_type PAIR ; MAP values ; std::string parent_typeinfo_name ; } ; } namespace Rcpp { template void function(const char* name_, RESULT_TYPE (*fun)(T... t), const char* docstring = 0) { Rcpp::Module* scope = ::getCurrentScope(); if (scope) { scope->Add(name_, new CppFunctionN(fun, docstring)); } } template void function(const char* name_, RESULT_TYPE (*fun)(T... t), Rcpp::List formals, const char* docstring = 0) { Rcpp::Module* scope = ::getCurrentScope(); if (scope) { scope->Add(name_, new CppFunction_WithFormalsN(fun, formals, docstring)); } } } namespace Rcpp { template void converter( const char* from, const char* to, TO (*fun)(FROM), const char* docstring = 0 ){ std::string fun_name = internal::get_converter_name( from, to ) ; function( fun_name.c_str(), fun, docstring ) ; } class CppClass : public S4{ typedef S4 Base; public: typedef XPtr XP_Class ; typedef Rcpp::XPtr XP ; CppClass( SEXP x) : S4(x){}; // #nocov CppClass( Module* p, class_Base* cl, std::string& buffer ) : S4("C++Class") { XP_Class clxp( cl, false, R_NilValue, R_NilValue ) ; slot( "module" ) = XP( p, false ) ; slot( "pointer" ) = clxp ; buffer = "Rcpp_" ; buffer += cl->name ; slot( ".Data" ) = buffer ; slot( "fields" ) = cl->fields( clxp ) ; slot( "methods" ) = cl->getMethods( clxp, buffer ) ; slot( "constructors") = cl->getConstructors( clxp, buffer ) ; slot( "docstring" ) = cl->docstring ; slot( "typeid" ) = cl->get_typeinfo_name() ; slot( "enums" ) = cl->enums ; slot( "parents" ) = cl->parents ; } RCPP_CTOR_ASSIGN_WITH_BASE(CppClass) } ; class CppObject : public S4{ typedef S4 Base; public: typedef Rcpp::XPtr XP ; CppObject( Module* p, class_Base* clazz, SEXP xp ) : S4("C++Object") { slot( "module" ) = XP( p, false ) ; slot( "cppclass" ) = Rcpp::XPtr( clazz, false ) ; slot( "pointer" ) = xp ; } RCPP_CTOR_ASSIGN_WITH_BASE(CppObject) } ; } #define RCPP_MODULE_BOOT(name) _rcpp_module_boot_##name #define RCPP_MODULE(name) \ void _rcpp_module_##name##_init() ; \ static Rcpp::Module _rcpp_module_##name( # name ) ; \ extern "C" SEXP _rcpp_module_boot_##name(){ \ ::setCurrentScope( & _rcpp_module_##name ) ; \ _rcpp_module_##name##_init( ) ; \ Rcpp::XPtr mod_xp(& _rcpp_module_##name , false); \ ::setCurrentScope( 0 ) ; \ return mod_xp ; \ } \ void _rcpp_module_##name##_init() // silly little dance to suppress a 'defined but not used variable' warning #ifdef __GNUC__ #define VARIABLE_IS_NOT_USED __attribute__ ((unused)) #else #define VARIABLE_IS_NOT_USED #endif // static variable to hold Rf_install symbol to prevent it from being gc'ed static VARIABLE_IS_NOT_USED SEXP moduleSym = NULL; // helper macro to cache the result of Rf_install("Module"): once // it is allocated and in the symbol table it is safe from gc #define GET_MODULE_SYM ( moduleSym == NULL ? moduleSym = Rf_install("Module") : moduleSym ) // this macro is called by code wanting to load a module -- see RInside's rinside_module_sample0.cpp #define LOAD_RCPP_MODULE(NAME) \ Shield __load_module_call__( Rf_lang2( GET_MODULE_SYM, _rcpp_module_boot_##NAME() ) ); \ Rcpp_fast_eval( __load_module_call__, R_GlobalEnv ); #endif Rcpp/inst/include/Rcpp/complex.h0000644000176200001440000000452312621416426016312 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // complex.h: Rcpp R/C++ interface class library -- binary operators for Rcomplex // // Copyright (C) 2010 - 2015 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 . #ifndef RCPP__complex_H #define RCPP__complex_H inline Rcomplex operator*( const Rcomplex& lhs, const Rcomplex& rhs) { Rcomplex y ; y.r = lhs.r * rhs.r - lhs.i * rhs.i ; y.i = lhs.r * rhs.i + rhs.r * lhs.i ; return y ; } inline Rcomplex operator+( const Rcomplex& lhs, const Rcomplex& rhs) { Rcomplex y ; y.r = lhs.r + rhs.r ; y.i = lhs.i + rhs.i ; return y ; } inline Rcomplex operator-( const Rcomplex& lhs, const Rcomplex& rhs) { Rcomplex y ; y.r = lhs.r - rhs.r ; y.i = lhs.i - rhs.i ; return y ; } inline Rcomplex operator/( const Rcomplex& a, const Rcomplex& b) { Rcomplex c ; double ratio, den; double abr, abi; if( (abr = b.r) < 0) abr = - abr; if( (abi = b.i) < 0) abi = - abi; if( abr <= abi ) { ratio = b.r / b.i ; den = b.i * (1 + ratio*ratio); c.r = (a.r*ratio + a.i) / den; c.i = (a.i*ratio - a.r) / den; } else { ratio = b.i / b.r ; den = b.r * (1 + ratio*ratio); c.r = (a.r + a.i*ratio) / den; c.i = (a.i - a.r*ratio) / den; } return c ; } inline bool operator==( const Rcomplex& a, const Rcomplex& b) { return a.r == b.r && a.i == b.i ; } // to prevent a redefinition error in dplyr (<= 0.4.3) which has the _same_ // definition of operator<<() for Rcomplex #define dplyr_tools_complex_H inline std::ostream & operator<<(std::ostream &os, const Rcomplex& cplx) { return os << cplx.r << "+" << cplx.i << "i" ; } #endif Rcpp/inst/include/Rcpp/Lighter0000644000176200001440000000174514154713250016014 0ustar liggesusers// Rcpp/Lighter: R/C++ interface class library -- without Rcpp Modules + RTTI // // Copyright (C) 2008 - 2021 Dirk Eddelbuettel // Copyright (C) 2009 - 2021 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 . // no RTTI (actually implies no Modules) -- solid gain #define RCPP_NO_RTTI // include Rcpp/Light which includes Rcpp #include Rcpp/inst/include/Rcpp/lang.h0000644000176200001440000002367113744301365015573 0ustar liggesusers // lang.h: Rcpp R/C++ interface class library -- extra lang_* functions // // Copyright (C) 2011 - 2020 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 . #ifndef Rcpp__lang_h #define Rcpp__lang_h #define Rcpp_list1 Rf_list1 #define Rcpp_lang1 Rf_lang1 #define Rcpp_lang2 Rf_lang2 #define Rcpp_lang3 Rf_lang3 #define Rcpp_lang4 Rf_lang4 #define Rcpp_lang5 Rf_lang5 #define Rcpp_lang6 Rf_lang6 #define Rcpp_lcons Rf_lcons namespace Rcpp { inline SEXP Rcpp_list2(SEXP x0, SEXP x1) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list1(x1)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list3(SEXP x0, SEXP x1, SEXP x2) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list2(x1, x2)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list4(SEXP x0, SEXP x1, SEXP x2, SEXP x3) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list3(x1, x2, x3)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list5(SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list4(x1, x2, x3, x4)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list6(SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list5(x1, x2, x3, x4, x5)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list7( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list6(x1, x2, x3, x4, x5, x6)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang7( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list6(x1, x2, x3, x4, x5, x6)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list8( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list7(x1, x2, x3, x4, x5, x6, x7)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang8( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list7(x1, x2, x3, x4, x5, x6, x7)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list9( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list8(x1, x2, x3, x4, x5, x6, x7, x8)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang9( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list8(x1, x2, x3, x4, x5, x6, x7, x8)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list10( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list9(x1, x2, x3, x4, x5, x6, x7, x8, x9)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang10( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list9(x1, x2, x3, x4, x5, x6, x7, x8, x9)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list11( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang11( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list12( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang12( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list13( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang13( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list14( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang14( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list15( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang15( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list16( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang16( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list17( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang17( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list18( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang18( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list19( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17, SEXP x18 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang19( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17, SEXP x18 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)); UNPROTECT(1); return x0; } inline SEXP Rcpp_list20( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17, SEXP x18, SEXP x19 ) { PROTECT(x0); x0 = Rf_cons(x0, Rcpp_list19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)); UNPROTECT(1); return x0; } inline SEXP Rcpp_lang20( SEXP x0, SEXP x1, SEXP x2, SEXP x3, SEXP x4, SEXP x5, SEXP x6, SEXP x7, SEXP x8, SEXP x9, SEXP x10, SEXP x11, SEXP x12, SEXP x13, SEXP x14, SEXP x15, SEXP x16, SEXP x17, SEXP x18, SEXP x19 ) { PROTECT(x0); x0 = Rf_lcons(x0, Rcpp_list19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)); UNPROTECT(1); return x0; } } #endif Rcpp/inst/include/Rcpp/algo.h0000644000176200001440000000761512336231761015572 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // algo.h: Rcpp R/C++ interface class library -- STL-style algorithms // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__algo_h #define Rcpp__algo_h #include #include namespace Rcpp{ /* generic implementation for the input iterator case */ template inline bool __any( InputIterator first, InputIterator last, const T& value, std::input_iterator_tag ){ for ( ;first!=last; first++) if ( *first==value ) return true; return false; } /* RAI case */ template inline bool __any( RandomAccessIterator __first, RandomAccessIterator __last, const T& __val, std::random_access_iterator_tag ){ typename std::iterator_traits::difference_type __trip_count = (__last - __first) >> 2; for ( ; __trip_count > 0 ; --__trip_count) { if (*__first == __val) return true; ++__first; if (*__first == __val) return true; ++__first; if (*__first == __val) return true; ++__first; if (*__first == __val) return true; ++__first; } switch (__last - __first) { case 3: if (*__first == __val) return true; ++__first; case 2: if (*__first == __val) return true; ++__first; case 1: if (*__first == __val) return true; ++__first; case 0: default: return false; } } /** * stl like algorithm to identify if any of the objects in the range * is equal to the value */ template inline bool any( InputIterator first, InputIterator last, const T& value){ return __any( first, last, value, typename std::iterator_traits::iterator_category() ) ; } /* generic implementation for the input iterator case */ template inline bool __any_if( InputIterator first, InputIterator last, Predicate pred, std::input_iterator_tag ){ for ( ; first!=last ; first++ ) if ( pred(*first) ) return true ; return false; } /* RAI case */ template inline bool __any_if( RandomAccessIterator __first, RandomAccessIterator __last, Predicate __pred, std::random_access_iterator_tag ){ typename std::iterator_traits::difference_type __trip_count = (__last - __first) >> 2; for ( ; __trip_count > 0 ; --__trip_count) { if (__pred(*__first)) return true; ++__first; if (__pred(*__first)) return true; ++__first; if (__pred(*__first)) return true; ++__first; if (__pred(*__first)) return true; ++__first; } switch (__last - __first) { case 3: if (__pred(*__first)) return true; ++__first; case 2: if (__pred(*__first)) return true; ++__first; case 1: if (__pred(*__first)) return true; ++__first; case 0: default: return false; } } /** * stl-like algorithm to identify if the predicate is true for any * of the objects in the range */ template inline bool any_if( InputIterator first, InputIterator last, Predicate pred){ return __any_if( first, last, pred, typename std::iterator_traits::iterator_category() ) ; } } #endif Rcpp/inst/include/Rcpp/S4.h0000644000176200001440000000434715126566764015153 0ustar liggesusers // S4.h: Rcpp R/C++ interface class library -- S4 objects // // 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 . #ifndef Rcpp_S4_h #define Rcpp_S4_h namespace Rcpp{ /** * S4 object */ RCPP_API_CLASS(S4_Impl) { public: RCPP_GENERATE_CTOR_ASSIGN(S4_Impl) S4_Impl(){} ; /** * checks that x is an S4 object and wrap it. * * @param x must be an S4 object */ S4_Impl(SEXP x) { // #nocov start if( ! ::Rf_isS4(x) ) throw not_s4() ; Storage::set__(x) ; } // #nocov end S4_Impl& operator=( SEXP other ){ Storage::set__( other ) ; return *this ; } /** * Creates an S4 object of the requested class. * * @param klass name of the target S4 class * @throw S4_creation_error if klass does not map to a known S4 class */ S4_Impl( const std::string& klass ){ Shield x( R_do_new_object(R_do_MAKE_CLASS(klass.c_str())) ); if (!Rf_inherits(x, klass.c_str())) throw S4_creation_error( klass ) ; // #nocov Storage::set__(x) ; } /** * Indicates if this object is an instance of the given S4 class */ bool is( const std::string& clazz) const ; /** * @throw not_s4 if x is not an S4 class */ void update(SEXP x){ if( ! ::Rf_isS4(x) ) throw not_s4() ; } } ; typedef S4_Impl S4 ; } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/InternalFunction.h0000644000176200001440000000431414767256403020135 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // InternalFunction.h: Rcpp R/C++ interface class library -- exposing C++ functions // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp_InternalFunction_h #define Rcpp_InternalFunction_h #include #include #include namespace Rcpp{ RCPP_API_CLASS(InternalFunction_Impl) { public: RCPP_GENERATE_CTOR_ASSIGN(InternalFunction_Impl) template InternalFunction_Impl(const std::function &fun) { set( XPtr >( new Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction(fun), false ) ); } template InternalFunction_Impl(RESULT_TYPE (*fun)(T...)) { set(XPtr >(new CppFunctionN(fun), true)); } void update(SEXP){} private: inline void set( SEXP xp){ Environment RCPP = Environment::Rcpp_namespace() ; Function intf = RCPP["internal_function"] ; Storage::set__( intf( xp ) ) ; } }; typedef InternalFunction_Impl InternalFunction ; } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/Symbol.h0000644000176200001440000000520615121245673016111 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Symbol.h: Rcpp R/C++ interface class library -- access R environments // // Copyright (C) 2013 - 2015 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 . #ifndef Rcpp_Symbol_h #define Rcpp_Symbol_h namespace Rcpp{ RCPP_API_CLASS(Symbol_Impl) { public: RCPP_GENERATE_CTOR_ASSIGN(Symbol_Impl) /** * wraps the SEXP into a Symbol object. * * @param x Accepted SEXP types are SYMSXP, CHARSXP and STRSXP * in the last case, the first element of the character vector * is silently used */ Symbol_Impl(SEXP x){ int type = TYPEOF(x) ; switch( type ){ case SYMSXP: Storage::set__( x ) ; break; /* nothing to do */ case CHARSXP: { SEXP charSym = Rf_installChar(x); // R 3.2.0 or later have Rf_installChar Storage::set__( charSym ) ; break ; } case STRSXP: { /* FIXME: check that there is at least one element */ SEXP charSym = Rf_installChar(STRING_ELT(x, 0 )); // R 3.2.0 or later have Rf_installChar Storage::set__( charSym ); break ; } default: const char* fmt = "Cannot convert object to a symbol: " "[type=%s; target=SYMSXP]."; throw not_compatible(fmt, Rf_type2char(TYPEOF(x))); } } Symbol_Impl(const std::string& symbol){ Storage::set__( Rf_install(symbol.c_str()) ); } inline const char* c_str() const { return CHAR(PRINTNAME(Storage::get__())) ; } inline bool operator==(const char* other) const { return ! strcmp(other, c_str() ); } void update(SEXP){} }; typedef Symbol_Impl Symbol; } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/StretchyList.h0000644000176200001440000000542012316773510017302 0ustar liggesusers// StretchyList.h: Rcpp R/C++ interface class library -- stretchy lists // // Copyright (C) 2013 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 . #ifndef Rcpp_StretchyList_h #define Rcpp_StretchyList_h namespace Rcpp{ /** * StretchyList uses a special pairlist to provide efficient insertion * at the front and the end of a pairlist. * * This is a C++ abstraction of the functions NewList, GrowList and Insert * that are found in places where a pair list has to grow efficiently, e.g. * in the R parser (gram.y) */ RCPP_API_CLASS(StretchyList_Impl), public DottedPairProxyPolicy > { public: RCPP_GENERATE_CTOR_ASSIGN(StretchyList_Impl) typedef typename DottedPairProxyPolicy::DottedPairProxy Proxy ; typedef typename DottedPairProxyPolicy::const_DottedPairProxy const_Proxy ; StretchyList_Impl(){ SEXP s = Rf_cons(R_NilValue, R_NilValue); SETCAR(s, s); Storage::set__(s) ; } StretchyList_Impl(SEXP x){ Storage::set__(r_cast(x)) ; } void update(SEXP x){} inline operator SEXP() const{ return CDR(Storage::get__() ); } template inline StretchyList_Impl& push_back(const T& obj ){ return push_back__impl( obj, typename traits::is_named::type() ) ; } template inline StretchyList_Impl& push_front(const T& obj ){ return push_front__impl( obj, typename traits::is_named::type() ) ; } private: template StretchyList_Impl& push_back__impl(const T& obj, traits::true_type ) ; template StretchyList_Impl& push_back__impl(const T& obj, traits::false_type ) ; template StretchyList_Impl& push_front__impl(const T& obj, traits::true_type ) ; template StretchyList_Impl& push_front__impl(const T& obj, traits::false_type ) ; } ; typedef StretchyList_Impl StretchyList ; } #endif Rcpp/inst/include/Rcpp/sugar/0000755000176200001440000000000015121245304015600 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/functions/0000755000176200001440000000000015101441041017602 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/functions/is_infinite.h0000644000176200001440000000307112535036334022271 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is_infinite.h: Rcpp R/C++ interface class library -- is_infinite // // Copyright (C) 2013 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 . #ifndef Rcpp__sugar__is_infinite_h #define Rcpp__sugar__is_infinite_h namespace Rcpp{ namespace sugar{ template class IsInfinite : public ::Rcpp::VectorBase< LGLSXP, false, IsInfinite > { public: IsInfinite( const VEC_TYPE& obj_) : obj(obj_){} inline int operator[]( R_xlen_t i ) const { return ::Rcpp::traits::is_infinite( obj[i] ) ; } inline R_xlen_t size() const { return obj.size() ; } private: const VEC_TYPE& obj ; } ; } // sugar template inline sugar::IsInfinite is_infinite( const Rcpp::VectorBase& t){ return sugar::IsInfinite( t.get_ref() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/is_na.h0000644000176200001440000000641313216720243021061 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is_na.h: Rcpp R/C++ interface class library -- is_na // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__sugar__is_na_h #define Rcpp__sugar__is_na_h namespace Rcpp{ namespace sugar{ template class IsNa : public ::Rcpp::VectorBase< LGLSXP, false, IsNa > { public: typedef typename traits::storage_type::type STORAGE ; typedef Rcpp::VectorBase BASE ; IsNa( const BASE& obj_) : obj(obj_){} inline int operator[]( R_xlen_t i ) const { return ::Rcpp::traits::is_na( obj[i] ) ; } inline R_xlen_t size() const { return obj.size() ; } private: const BASE& obj ; } ; // specialization for the case where we already know // the result (FALSE) because it is embedded in the type // (the second template parameter of VectorBase) template class IsNa : public ::Rcpp::VectorBase< LGLSXP, false, IsNa > { public: typedef typename traits::storage_type::type STORAGE ; typedef Rcpp::VectorBase BASE ; IsNa( const BASE& obj_) : obj(obj_){} inline int operator[]( R_xlen_t i ) const { return FALSE ; } inline R_xlen_t size() const { return obj.size() ; } private: const BASE& obj ; } ; template class IsNa_Vector_is_na : public Rcpp::VectorBase >{ public: IsNa_Vector_is_na( const T& x) : ref(x){} inline int operator[]( R_xlen_t i) const { #if defined(RCPP_NEW_DATE_DATETIME_VECTORS) return ::Rcpp::traits::is_na(ref[i]); #else return ref[i].is_na() ; #endif } inline R_xlen_t size() const { return ref.size() ; } private: const T& ref ; } ; } // sugar template inline sugar::IsNa is_na( const Rcpp::VectorBase& t) { return sugar::IsNa(t); } inline sugar::IsNa_Vector_is_na is_na(const oldDatetimeVector& x) { return sugar::IsNa_Vector_is_na( x ) ; } inline sugar::IsNa_Vector_is_na is_na(const oldDateVector& x) { return sugar::IsNa_Vector_is_na(x); } inline sugar::IsNa_Vector_is_na is_na(newDatetimeVector& x) { return sugar::IsNa_Vector_is_na(x); } inline sugar::IsNa_Vector_is_na is_na(newDateVector& x) { return sugar::IsNa_Vector_is_na(x); } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/sign.h0000644000176200001440000000453712535036334020741 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // sign.h: Rcpp R/C++ interface class library -- sign // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__sign_h #define Rcpp__sugar__sign_h namespace Rcpp{ namespace sugar{ template class sign__impl{ public: typedef typename Rcpp::traits::storage_type::type STORAGE ; static inline int get( STORAGE x){ return Rcpp::traits::is_na(x) ? NA_INTEGER : ( x > 0 ? 1 : (x==0 ? 0 : -1) ) ; } } ; template class sign__impl{ public: typedef typename Rcpp::traits::storage_type::type STORAGE ; static inline int get( STORAGE x){ return ( x > 0 ? 1 : (x==0 ? 0 : -1) ) ; } } ; template class Sign : public Rcpp::VectorBase< INTSXP,NA, Sign > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef int r_import_type ; Sign( const VEC_TYPE& object_ ) : object(object_){} inline int operator[]( R_xlen_t i ) const { return get(i) ; } inline R_xlen_t size() const { return object.size() ; } operator SEXP() const { return wrap( *this ); } inline int get(R_xlen_t i) const { return sign__impl::get( object[i] ); } private: const VEC_TYPE& object ; } ; } // sugar template inline sugar::Sign sign( const VectorBase& t){ return sugar::Sign( t ) ; } template inline sugar::Sign sign( const VectorBase& t){ return sugar::Sign( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/complex.h0000644000176200001440000001557613247357554021470 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // complex.h: Rcpp R/C++ interface class library -- complex // // Copyright (C) 2010 - 2018 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 . #ifndef Rcpp__sugar__complex_h #define Rcpp__sugar__complex_h namespace Rcpp{ namespace sugar{ template class SugarComplex : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarComplex > { public: typedef Rcpp::VectorBase VEC_TYPE ; SugarComplex( FunPtr ptr_, const VEC_TYPE & vec_) : ptr(ptr_), vec(vec_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { Rcomplex x = vec[i] ; if( Rcpp::traits::is_na( x ) ) return Rcpp::traits::get_na< Rcpp::traits::r_sexptype_traits::rtype >() ; return ptr( x ); } inline R_xlen_t size() const { return vec.size() ; } private: FunPtr ptr ; const VEC_TYPE& vec ; }; } // sugar namespace internal{ inline double complex__Re( Rcomplex x){ return x.r ; } inline double complex__Im( Rcomplex x){ return x.i ; } inline double complex__Mod( Rcomplex x){ return ::sqrt( x.i * x.i + x.r * x.r) ; } inline Rcomplex complex__Conj( Rcomplex x){ Rcomplex y ; y.r = x.r; y.i = -x.i ; return y ; } inline double complex__Arg( Rcomplex x ){ return ::atan2(x.i, x.r); } // TODO: this does not use HAVE_C99_COMPLEX as in R, perhaps it should inline Rcomplex complex__exp( Rcomplex x){ Rcomplex y ; double expx = ::exp(x.r); y.r = expx * ::cos(x.i); y.i = expx * ::sin(x.i); return y ; } inline Rcomplex complex__log( Rcomplex x){ Rcomplex y ; y.i = ::atan2(x.i, x.r); y.r = ::log(::hypot(x.r, x.i)); return y ; } inline Rcomplex complex__sqrt(Rcomplex z){ Rcomplex r ; double mag; if( (mag = ::hypot(z.r, z.i)) == 0.0) r.r = r.i = 0.0; else if(z.r > 0) { r.r = ::sqrt(0.5 * (mag + z.r) ); r.i = z.i / r.r / 2; } else { r.i = ::sqrt(0.5 * (mag - z.r) ); if(z.i < 0) r.i = - r.i; r.r = z.i / r.i / 2; } return r ; } inline Rcomplex complex__cos(Rcomplex z){ Rcomplex r ; r.r = ::cos(z.r) * ::cosh(z.i); r.i = - ::sin(z.r) * ::sinh(z.i); return r ; } inline Rcomplex complex__cosh(Rcomplex z){ Rcomplex r; r.r = ::cos(-z.i) * ::cosh( z.r); r.i = - ::sin(-z.i) * ::sinh(z.r); return r ; } inline Rcomplex complex__sin(Rcomplex z){ Rcomplex r ; r.r = ::sin(z.r) * ::cosh(z.i); r.i = ::cos(z.r) * ::sinh(z.i); return r; } inline Rcomplex complex__tan(Rcomplex z){ Rcomplex r ; double x2, y2, den; x2 = 2.0 * z.r; y2 = 2.0 * z.i; den = ::cos(x2) + ::cosh(y2); r.r = ::sin(x2)/den; /* any threshold between -log(DBL_EPSILON) and log(DBL_XMAX) will do*/ if (ISNAN(y2) || ::fabs(y2) < 50.0) r.i = ::sinh(y2)/den; else r.i = (y2 <0 ? -1.0 : 1.0); return r ; } inline Rcomplex complex__asin(Rcomplex z) { Rcomplex r ; double alpha, bet, t1, t2, x, y; x = z.r; y = z.i; t1 = 0.5 * ::hypot(x + 1, y); t2 = 0.5 * ::hypot(x - 1, y); alpha = t1 + t2; bet = t1 - t2; r.r = ::asin(bet); r.i = ::log(alpha + ::sqrt(alpha*alpha - 1)); if(y < 0 || (y == 0 && x > 1)) r.i *= -1; return r ; } inline Rcomplex complex__acos(Rcomplex z) { Rcomplex r, Asin = complex__asin(z); r.r = M_PI_2 - Asin.r; r.i = - Asin.i; return r ; } /* Complex Arctangent Function */ /* Equation (4.4.39) Abramowitz and Stegun */ /* with additional terms to force the branch cuts */ /* to agree with figure 4.4, p79. Continuity */ /* on the branch cuts (pure imaginary axis; x==0, |y|>1) */ /* is standard: z_asin() is continuous from the right */ /* if y >= 1, and continuous from the left if y <= -1. */ inline Rcomplex complex__atan(Rcomplex z) { Rcomplex r; double x, y; x = z.r; y = z.i; r.r = 0.5 * ::atan(2 * x / ( 1 - x * x - y * y)); r.i = 0.25 * ::log((x * x + (y + 1) * (y + 1)) / (x * x + (y - 1) * (y - 1))); if(x*x + y*y > 1) { r.r += M_PI_2; if(x < 0 || (x == 0 && y < 0)) r.r -= M_PI; } return r ; } inline Rcomplex complex__acosh(Rcomplex z){ Rcomplex r, a = complex__acos(z); r.r = -a.i; r.i = a.r; return r ; } inline Rcomplex complex__asinh(Rcomplex z){ Rcomplex r, b; b.r = -z.i; b.i = z.r; Rcomplex a = complex__asin(b); r.r = a.i; r.i = -a.r; return r ; } inline Rcomplex complex__atanh(Rcomplex z){ Rcomplex r, b; b.r = -z.i; b.i = z.r; Rcomplex a = complex__atan(b); r.r = a.i; r.i = -a.r; return r ; } inline Rcomplex complex__sinh(Rcomplex z) { Rcomplex r, b; b.r = -z.i; b.i = z.r; Rcomplex a = complex__sin(b); r.r = a.i; r.i = -a.r; return r ; } inline Rcomplex complex__tanh(Rcomplex z) { Rcomplex r, b; b.r = -z.i; b.i = z.r; Rcomplex a = complex__tan(b); r.r = a.i; r.i = -a.r; return r ; } } // internal #define RCPP_SUGAR_COMPLEX(__NAME__,__OUT__) \ template \ inline sugar::SugarComplex \ __NAME__(const VectorBase& t) { \ return sugar::SugarComplex( \ internal::complex__##__NAME__, t); \ } RCPP_SUGAR_COMPLEX( Re, double ) RCPP_SUGAR_COMPLEX( Im, double ) RCPP_SUGAR_COMPLEX( Mod, double ) RCPP_SUGAR_COMPLEX( Arg, double ) RCPP_SUGAR_COMPLEX( Conj, Rcomplex ) RCPP_SUGAR_COMPLEX( exp, Rcomplex ) RCPP_SUGAR_COMPLEX( log, Rcomplex ) RCPP_SUGAR_COMPLEX( sqrt, Rcomplex ) RCPP_SUGAR_COMPLEX( cos, Rcomplex ) RCPP_SUGAR_COMPLEX( sin, Rcomplex ) RCPP_SUGAR_COMPLEX( tan, Rcomplex ) RCPP_SUGAR_COMPLEX( acos, Rcomplex ) RCPP_SUGAR_COMPLEX( asin, Rcomplex ) RCPP_SUGAR_COMPLEX( atan, Rcomplex ) RCPP_SUGAR_COMPLEX( acosh, Rcomplex ) RCPP_SUGAR_COMPLEX( asinh, Rcomplex ) RCPP_SUGAR_COMPLEX( atanh, Rcomplex ) RCPP_SUGAR_COMPLEX( cosh, Rcomplex ) RCPP_SUGAR_COMPLEX( sinh, Rcomplex ) RCPP_SUGAR_COMPLEX( tanh, Rcomplex ) #undef RCPP_SUGAR_COMPLEX } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/sample.h0000644000176200001440000002653714574051400021262 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // sample.h: Rcpp R/C++ interface class library -- sample // // Copyright (C) 2016 Nathan Russell // // 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 sample() in RcppArmadillo came first, but is opt-in. In case someone did // in fact load it, we need to skip the declarations here to avoid a conflict #ifndef RCPPARMADILLO__EXTENSIONS__SAMPLE_H #ifndef Rcpp__sugar__sample_h #define Rcpp__sugar__sample_h #include // In order to mirror the behavior of `base::sample` // as closely as possible, this file contains adaptations // of several functions in R/src/main/random.c: // // * do_sample - general logic as well as the empirical sampling routine. // // * FixupProb - an auxiliary function. // // * walker_ProbSampleReplace, ProbSampleReplace, and ProbSampleNoReplace - // algorithms for sampling according to a supplied probability vector. // // For each of the sampling routines, two signatures are provided: // // * A version that returns an integer vector, which can be used to // generate 0-based indices (one_based = false) or 1-based indices // (one_based = true) -- where the latter corresponds to the // bahavior of `base::sample.int`. // // * A version which takes an input Vector<> (rather than an integer 'n'), // and samples its elements -- this corresponds to `base::sample`. namespace Rcpp { namespace sugar { // Adapted from `FixupProb` // Normalizes a probability vector 'p' S.T. sum(p) == 1 inline void Normalize(Vector& p, int require_k, bool replace) { double sum = 0.0; R_xlen_t npos = 0, i = 0, n = p.size(); for ( ; i < n; i++) { if (!R_FINITE(p[i]) || (p[i] < 0)) { stop("Probabilities must be finite and non-negative!"); } npos += (p[i] > 0.0); sum += p[i]; } if ((!npos) || (!replace && (require_k > npos))) { stop("Too few positive probabilities!"); } for (i = 0; i < n; i++) { p[i] /= sum; } } // Adapted from `ProbSampleReplace` // Index version inline Vector SampleReplace(Vector& p, int n, int k, bool one_based) { Vector perm = no_init(n), ans = no_init(k); double rU = 0.0; int i = 0, j = 0, nm1 = n - 1; int adj = one_based ? 0 : 1; for ( ; i < n; i++) { perm[i] = i + 1; } Rf_revsort(p.begin(), perm.begin(), n); for (i = 1; i < n; i++) { p[i] += p[i - 1]; } for (i = 0; i < k; i++) { rU = unif_rand(); for (j = 0; j < nm1; j++) { if (rU <= p[j]) { break; } } ans[i] = perm[j] - adj; } return ans; } // Element version template inline Vector SampleReplace(Vector& p, int k, const Vector& ref) { int n = ref.size(); Vector perm = no_init(n); Vector ans = no_init(k); double rU = 0.0; int i = 0, j = 0, nm1 = n - 1; for ( ; i < n; i++) { perm[i] = i + 1; } Rf_revsort(p.begin(), perm.begin(), n); for (i = 1; i < n; i++) { p[i] += p[i - 1]; } for (i = 0; i < k; i++) { rU = unif_rand(); for (j = 0; j < nm1; j++) { if (rU <= p[j]) { break; } } ans[i] = ref[perm[j] - 1]; } return ans; } // Adapted from `walker_ProbSampleReplace` // Index version inline Vector WalkerSample(const Vector& p, int n, int nans, bool one_based) { Vector a = no_init(n), ans = no_init(nans); int i, j, k; std::vector q(n); double rU; std::vector HL(n); std::vector::iterator H, L; int adj = one_based ? 1 : 0; H = HL.begin() - 1; L = HL.begin() + n; for (i = 0; i < n; i++) { q[i] = p[i] * n; if (q[i] < 1.0) { *++H = i; } else { *--L = i; } } if (H >= HL.begin() && L < HL.begin() + n) { for (k = 0; k < n - 1; k++) { i = HL[k]; j = *L; a[i] = j; q[j] += q[i] - 1; L += (q[j] < 1.0); if (L >= HL.begin() + n) { break; } } } for (i = 0; i < n; i++) { q[i] += i; } for (i = 0; i < nans; i++) { rU = unif_rand() * n; k = static_cast(rU); ans[i] = (rU < q[k]) ? k + adj : a[k] + adj; } return ans; } // Element version template inline Vector WalkerSample(const Vector& p, int nans, const Vector& ref) { int n = ref.size(); Vector a = no_init(n); Vector ans = no_init(nans); int i, j, k; std::vector q(n); double rU; std::vector HL(n); std::vector::iterator H, L; H = HL.begin() - 1; L = HL.begin() + n; for (i = 0; i < n; i++) { q[i] = p[i] * n; if (q[i] < 1.0) { *++H = i; } else { *--L = i; } } if (H >= HL.begin() && L < HL.begin() + n) { for (k = 0; k < n - 1; k++) { i = HL[k]; j = *L; a[i] = j; q[j] += q[i] - 1; L += (q[j] < 1.0); if (L >= HL.begin() + n) { break; } } } for (i = 0; i < n; i++) { q[i] += i; } for (i = 0; i < nans; i++) { rU = unif_rand() * n; k = static_cast(rU); ans[i] = (rU < q[k]) ? ref[k] : ref[a[k]]; } return ans; } // Adapted from `ProbSampleNoReplace` // Index version inline Vector SampleNoReplace(Vector& p, int n, int nans, bool one_based) { Vector perm = no_init(n), ans = no_init(nans); double rT, mass, totalmass; int i, j, k, n1; int adj = one_based ? 0 : 1; for (i = 0; i < n; i++) { perm[i] = i + 1; } Rf_revsort(p.begin(), perm.begin(), n); totalmass = 1.0; for (i = 0, n1 = n - 1; i < nans; i++, n1--) { rT = totalmass * unif_rand(); mass = 0.0; for (j = 0; j < n1; j++) { mass += p[j]; if (rT <= mass) { break; } } ans[i] = perm[j] - adj; totalmass -= p[j]; for (k = j; k < n1; k++) { p[k] = p[k + 1]; perm[k] = perm[k + 1]; } } return ans; } // Element version template inline Vector SampleNoReplace(Vector& p, int nans, const Vector& ref) { int n = ref.size(); Vector perm = no_init(n); Vector ans = no_init(nans); double rT, mass, totalmass; int i, j, k, n1; for (i = 0; i < n; i++) { perm[i] = i + 1; } Rf_revsort(p.begin(), perm.begin(), n); totalmass = 1.0; for (i = 0, n1 = n - 1; i < nans; i++, n1--) { rT = totalmass * unif_rand(); mass = 0.0; for (j = 0; j < n1; j++) { mass += p[j]; if (rT <= mass) { break; } } ans[i] = ref[perm[j] - 1]; totalmass -= p[j]; for (k = j; k < n1; k++) { p[k] = p[k + 1]; perm[k] = perm[k + 1]; } } return ans; } // Adapted from segment of `do_sample` // Index version inline Vector EmpiricalSample(int n, int size, bool replace, bool one_based) { Vector ans = no_init(size); Vector::iterator ians = ans.begin(), eans = ans.end(); int adj = one_based ? 1 : 0; if (replace || size < 2) { for ( ; ians != eans; ++ians) { *ians = static_cast(n * unif_rand() + adj); } return ans; } IntegerVector x = no_init(n); for (int i = 0; i < n; i++) { x[i] = i; } for ( ; ians != eans; ++ians) { int j = static_cast(n * unif_rand()); *ians = x[j] + adj; x[j] = x[--n]; } return ans; } // Element version template inline Vector EmpiricalSample(int size, bool replace, const Vector& ref) { int n = ref.size(); Vector ans = no_init(size); typename Vector::iterator ians = ans.begin(), eans = ans.end(); if (replace || size < 2) { for ( ; ians != eans; ++ians) { *ians = ref[static_cast(n * unif_rand())]; } return ans; } IntegerVector x = no_init(n); for (int i = 0; i < n; i++) { x[i] = i; } for ( ; ians != eans; ++ians) { int j = static_cast(n * unif_rand()); *ians = ref[x[j]]; x[j] = x[--n]; } return ans; } typedef Nullable< Vector > probs_t; } // sugar // Adapted from `do_sample` inline Vector sample(int n, int size, bool replace = false, sugar::probs_t probs = R_NilValue, bool one_based = true) { if (probs.isNotNull()) { Vector p = clone(probs.get()); if (static_cast(p.size()) != n) { stop("probs.size() != n!"); } sugar::Normalize(p, size, replace); if (replace) { int i = 0, nc = 0; for ( ; i < n; i++) { nc += (n * p[i] > 0.1); } return nc > 200 ? sugar::WalkerSample(p, n, size, one_based) : sugar::SampleReplace(p, n, size, one_based); } if (size > n) { stop("Sample size must be <= n when not using replacement!"); } return sugar::SampleNoReplace(p, n, size, one_based); } if (!replace && size > n) { stop("Sample size must be <= n when not using replacement!"); } return sugar::EmpiricalSample(n, size, replace, one_based); } template inline Vector sample(const Vector& x, int size, bool replace = false, sugar::probs_t probs = R_NilValue) { int n = x.size(); if (probs.isNotNull()) { Vector p = clone(probs.get()); if (static_cast(p.size()) != n) { stop("probs.size() != n!"); } sugar::Normalize(p, size, replace); if (replace) { int i = 0, nc = 0; for ( ; i < n; i++) { nc += (n * p[i] > 0.1); } return nc > 200 ? sugar::WalkerSample(p, size, x) : sugar::SampleReplace(p, size, x); } if (size > n) { stop("Sample size must be <= n when not using replacement!"); } return sugar::SampleNoReplace(p, size, x); } if (!replace && size > n) { stop("Sample size must be <= n when not using replacement!"); } return sugar::EmpiricalSample(size, replace, x); } } // Rcpp #endif // Rcpp__sugar__sample_h #endif // RCPPARMADILLO__EXTENSIONS__SAMPLE_H Rcpp/inst/include/Rcpp/sugar/functions/clamp.h0000644000176200001440000000507112535036334021067 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // clamp.h: Rcpp R/C++ interface class library -- clamp // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__clamp_h #define Rcpp__sugar__clamp_h namespace Rcpp{ namespace sugar{ template struct clamp_operator{ typedef typename Rcpp::traits::storage_type::type STORAGE ; clamp_operator(STORAGE lhs_, STORAGE rhs_ ) : lhs(lhs_), rhs(rhs_){} inline STORAGE operator()(STORAGE x) const { return x < lhs ? lhs : (x > rhs ? rhs : x ) ; } STORAGE lhs, rhs ; } ; // need to write this special version template <> struct clamp_operator { clamp_operator(double lhs_, double rhs_ ) : lhs(lhs_), rhs(rhs_){} inline double operator()(double x) const { if( Rcpp::traits::is_na(x) ) return x ; return x < lhs ? lhs : (x > rhs ? rhs : x ) ; } double lhs, rhs ; } ; template < int RTYPE, bool NA, typename T > class Clamp_Primitive_Vector_Primitive : public VectorBase< RTYPE , NA , Clamp_Primitive_Vector_Primitive > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef clamp_operator OPERATOR ; Clamp_Primitive_Vector_Primitive( STORAGE lhs_, const T& vec_, STORAGE rhs_) : vec(vec_), op(lhs_,rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { return op( vec[i] ) ; } inline R_xlen_t size() const { return vec.size() ; } private: const T& vec ; OPERATOR op ; } ; } // sugar template inline sugar::Clamp_Primitive_Vector_Primitive clamp( typename Rcpp::traits::storage_type::type lhs, const Rcpp::VectorBase& vec, typename Rcpp::traits::storage_type::type rhs ){ return sugar::Clamp_Primitive_Vector_Primitive( lhs, vec.get_ref(), rhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/cumprod.h0000644000176200001440000000454612615210414021442 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // cumsum.h: Rcpp R/C++ interface class library -- cumsum // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__cumprod_h #define Rcpp__sugar__cumprod_h namespace Rcpp{ namespace sugar{ template class Cumprod : public Lazy< Rcpp::Vector, Cumprod > { public: typedef typename Rcpp::VectorBase VEC_TYPE; typedef typename Rcpp::traits::storage_type::type STORAGE; typedef Rcpp::Vector VECTOR; Cumprod(const VEC_TYPE& object_) : object(object_) {} VECTOR get() const { R_xlen_t n = object.size(); VECTOR result(n, Rcpp::traits::get_na()); STORAGE current = object[0]; if (Rcpp::traits::is_na(current)) return result; result[0] = current; for (R_xlen_t i = 1; i < n; i++) { current = object[i]; if (Rcpp::traits::is_na(current)) return result; result[i] = result[i-1] * current; } return result ; } private: const VEC_TYPE& object; }; } // sugar template inline sugar::Cumprod cumprod(const VectorBase& t) { return sugar::Cumprod(t); } template inline sugar::Cumprod cumprod(const VectorBase& t) { return sugar::Cumprod(t); } template inline sugar::Cumprod cumprod(const VectorBase& t) { return sugar::Cumprod(t); } } // Rcpp #endif // Rcpp__sugar__cumprod_h Rcpp/inst/include/Rcpp/sugar/functions/mapply/0000755000176200001440000000000015130420312021104 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/functions/mapply/mapply_2.h0000644000176200001440000001050114772603376023025 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // mapply_2.h: Rcpp R/C++ interface class library -- mapply_2 // // Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__mapply_2_h #define Rcpp__sugar__mapply_2_h namespace Rcpp{ namespace sugar{ template class Mapply_2 : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Mapply_2 > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; Mapply_2( const T_1& vec_1_, const T_2& vec_2_, Function fun_ ) : vec_1(vec_1_), vec_2(vec_2_), fun(fun_){} inline result_type operator[]( R_xlen_t i ) const { return fun( vec_1[i], vec_2[i] ); } inline R_xlen_t size() const { return vec_1.size() ; } private: const T_1& vec_1 ; const T_2& vec_2 ; Function fun ; } ; template class Mapply_2_Vector_Primitive : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Mapply_2_Vector_Primitive > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; Mapply_2_Vector_Primitive( const T_1& vec_1_, PRIM_2 prim_2_, Function fun_ ) : vec_1(vec_1_), prim_2(prim_2_), fun(fun_){} inline result_type operator[]( R_xlen_t i ) const { return fun( vec_1[i], prim_2 ); } inline R_xlen_t size() const { return vec_1.size() ; } private: const T_1& vec_1 ; PRIM_2 prim_2 ; Function fun ; } ; template class Mapply_2_Primitive_Vector : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Mapply_2_Primitive_Vector > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; Mapply_2_Primitive_Vector( PRIM_1 prim_1_, const T_2& vec_2_, Function fun_ ) : prim_1(prim_1_), vec_2(vec_2_), fun(fun_){} inline result_type operator[]( R_xlen_t i ) const { return fun( prim_1, vec_2[i] ); } inline R_xlen_t size() const { return vec_2.size() ; } private: PRIM_1 prim_1 ; const T_2& vec_2 ; Function fun ; } ; } // sugar template inline sugar::Mapply_2 mapply( const Rcpp::VectorBase& t1, const Rcpp::VectorBase& t2, Function fun ){ return sugar::Mapply_2( t1.get_ref(), t2.get_ref(), fun ) ; } template inline sugar::Mapply_2_Vector_Primitive mapply( const Rcpp::VectorBase& t1, double t2, Function fun ){ return sugar::Mapply_2_Vector_Primitive( t1.get_ref(), t2, fun ) ; } template inline sugar::Mapply_2_Primitive_Vector mapply( double t1, const Rcpp::VectorBase& t2, Function fun ){ return sugar::Mapply_2_Primitive_Vector( t1, t2.get_ref(), fun ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/mapply/mapply_3.h0000644000176200001440000000557314772603376023043 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // mapply_3.h: Rcpp R/C++ interface class library -- mapply_3 // // Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__mapply_3_h #define Rcpp__sugar__mapply_3_h namespace Rcpp{ namespace sugar{ template < int RTYPE_1, bool NA_1, typename T_1, int RTYPE_2, bool NA_2, typename T_2, int RTYPE_3, bool NA_3, typename T_3, typename Function > class Mapply_3 : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Mapply_3 > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; typedef Rcpp::VectorBase VEC_1 ; typedef Rcpp::VectorBase VEC_2 ; typedef Rcpp::VectorBase VEC_3 ; typedef typename Rcpp::traits::Extractor::type EXT_1 ; typedef typename Rcpp::traits::Extractor::type EXT_2 ; typedef typename Rcpp::traits::Extractor::type EXT_3 ; Mapply_3( const VEC_1& vec_1_, const VEC_2& vec_2_, const VEC_3& vec_3_, Function fun_ ) : vec_1(vec_1_.get_ref()), vec_2(vec_2_.get_ref()), vec_3(vec_3_.get_ref()), fun(fun_){} inline result_type operator[]( R_xlen_t i ) const { return fun( vec_1[i], vec_2[i], vec_3[i] ); } inline R_xlen_t size() const { return vec_1.size() ; } private: const EXT_1& vec_1 ; const EXT_2& vec_2 ; const EXT_3& vec_3 ; Function fun ; } ; } // sugar template < int RTYPE_1, bool NA_1, typename T_1, int RTYPE_2, bool NA_2, typename T_2, int RTYPE_3, bool NA_3, typename T_3, typename Function > inline sugar::Mapply_3 mapply( const Rcpp::VectorBase& t1, const Rcpp::VectorBase& t2, const Rcpp::VectorBase& t3, Function fun ){ return sugar::Mapply_3( t1, t2, t3, fun ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/cummin.h0000644000176200001440000000432112615210414021250 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // cumsum.h: Rcpp R/C++ interface class library -- cumsum // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__cummin_h #define Rcpp__sugar__cummin_h namespace Rcpp{ namespace sugar{ template class Cummin : public Lazy< Rcpp::Vector, Cummin > { public: typedef typename Rcpp::VectorBase VEC_TYPE; typedef typename Rcpp::traits::storage_type::type STORAGE; typedef Rcpp::Vector VECTOR; Cummin(const VEC_TYPE& object_) : object(object_) {} VECTOR get() const { R_xlen_t n = object.size(); VECTOR result(n, Rcpp::traits::get_na()); STORAGE current = object[0]; if (Rcpp::traits::is_na(current)) return result; result[0] = current; for (R_xlen_t i = 1; i < n; i++) { current = object[i]; if (Rcpp::traits::is_na(current)) return result; result[i] = result[i-1] < current ? result[i-1] : current; } return result ; } private: const VEC_TYPE& object; }; } // sugar template inline sugar::Cummin cummin(const VectorBase& t) { return sugar::Cummin(t); } template inline sugar::Cummin cummin(const VectorBase& t) { return sugar::Cummin(t); } } // Rcpp #endif // Rcpp__sugar__cummin_h Rcpp/inst/include/Rcpp/sugar/functions/mean.h0000644000176200001440000001110214357035450020705 0ustar liggesusers// mean.h: Rcpp R/C++ interface class library -- mean // // Copyright (C) 2011 - 2023 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 . #ifndef Rcpp__sugar__mean_h #define Rcpp__sugar__mean_h namespace Rcpp{ namespace sugar{ template class Mean : public Lazy > { public: typedef typename Rcpp::VectorBase VEC_TYPE; typedef Rcpp::Vector VECTOR; Mean(const VEC_TYPE& object_) : object(object_) {} double get() const { VECTOR input = object; R_xlen_t n = input.size(); // double pass (as in summary.c) long double s = std::accumulate(input.begin(), input.end(), 0.0L); s /= n; if (R_FINITE((double)s)) { long double t = 0.0; for (R_xlen_t i = 0; i < n; i++) { t += input[i] - s; } s += t/n; } return (double)s ; } private: const VEC_TYPE& object ; }; template class Mean : public Lazy > { public: typedef typename Rcpp::VectorBase VEC_TYPE; Mean(const VEC_TYPE& object_) : object(object_) {} Rcomplex get() const { ComplexVector input = object; R_xlen_t n = input.size(); // double pass (as in summary.c) long double s = 0.0, si = 0.0; for (R_xlen_t i=0; i(s); z.i = static_cast(si); return z; } private: const VEC_TYPE& object ; }; template class Mean : public Lazy > { public: typedef typename Rcpp::VectorBase VEC_TYPE; Mean(const VEC_TYPE& object_) : object(object_) {} double get() const { LogicalVector input = object; R_xlen_t n = input.size(); long double s = 0.0; for (R_xlen_t i=0; i class Mean : public Lazy > { public: typedef typename Rcpp::VectorBase VEC_TYPE; Mean(const VEC_TYPE& object_) : object(object_) {} double get() const { IntegerVector input = object; R_xlen_t n = input.size(); // double pass (as in summary.c) long double s = std::accumulate(input.begin(), input.end(), 0.0L); s /= n; long double t = 0.0; for (R_xlen_t i = 0; i < n; i++) { if (input[i] == NA_INTEGER) return NA_REAL; t += input[i] - s; } s += t/n; return (double)s ; } private: const VEC_TYPE& object ; }; } // sugar template inline sugar::Mean mean(const VectorBase& t) { return sugar::Mean(t); } template inline sugar::Mean mean(const VectorBase& t) { return sugar::Mean(t); } template inline sugar::Mean mean(const VectorBase& t) { return sugar::Mean(t); } template inline sugar::Mean mean(const VectorBase& t) { return sugar::Mean(t); } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/cbind.h0000644000176200001440000023237513432127317021062 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // cbind.h: Rcpp R/C++ interface class library -- cbind // // Copyright (C) 2016 Nathan Russell // // 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 . #ifndef Rcpp__sugar__cbind_h #define Rcpp__sugar__cbind_h namespace Rcpp { namespace sugar { namespace cbind_impl { // override r_sexptype_traits for STRSXP template struct cbind_sexptype_traits : public Rcpp::traits::r_sexptype_traits {}; template <> struct cbind_sexptype_traits { enum { rtype = STRSXP }; }; // override storage_type (int) template struct cbind_storage_type : public Rcpp::traits::storage_type {}; template <> struct cbind_storage_type { typedef bool type; }; // CRTP base template class BindableExpression { public: typedef typename cbind_storage_type::type stored_type; inline stored_type operator[](R_xlen_t i) const { return static_cast(*this)[i]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { return static_cast(*this)(i, j); } inline R_xlen_t size() const { return static_cast(*this).size(); } inline R_xlen_t nrow() const { return static_cast(*this).nrow(); } inline R_xlen_t ncol() const { return static_cast(*this).ncol(); } operator E&() { return static_cast(*this); } operator const E&() const { return static_cast(*this); } }; // Matrix, Vector interface to BindableExpression template class ContainerBindable : public BindableExpression > { public: typedef typename cbind_storage_type::type stored_type; private: T vec; R_xlen_t len, nr, nc; public: ContainerBindable(const Rcpp::Matrix& vec_) : vec(vec_), len(vec.ncol() * vec.nrow()), nr(vec.nrow()), nc(vec.ncol()) {} ContainerBindable(const Rcpp::Vector& vec_) : vec(vec_), len(vec.size()), nr(vec.size()), nc(1) {} template ContainerBindable(const BindableExpression& e) : vec(e.size()), len(e.size()), nr(e.nrow()), nc(e.ncol()) { for (R_xlen_t i = 0; i < len; i++) { vec[i] = e[i]; } } inline R_xlen_t size() const { return len; } inline R_xlen_t nrow() const { return nr; } inline R_xlen_t ncol() const { return nc; } inline stored_type operator[](R_xlen_t i) const { return vec[i]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { return vec[i + nr * j]; } }; template struct scalar { typedef typename cbind_storage_type::type type; }; // scalar interface to BindableExpression template class ScalarBindable : public BindableExpression< cbind_sexptype_traits::rtype, ScalarBindable > { public: typedef T stored_type; enum { RTYPE = cbind_sexptype_traits::rtype }; private: T t; public: ScalarBindable(const T& t_) : t(t_) {} inline R_xlen_t size() const { return 1; } inline R_xlen_t nrow() const { return 1; } inline R_xlen_t ncol() const { return 1; } inline stored_type operator[](R_xlen_t i) const { return t; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { return t; } }; // binding logic; non-scalar operands template class JoinOp : public BindableExpression >, public Rcpp::MatrixBase > { public: typedef typename cbind_storage_type::type stored_type; private: const E1& e1; const E2& e2; public: JoinOp(const BindableExpression& e1_, const BindableExpression& e2_) : e1(e1_), e2(e2_) { if (e1.nrow() != e2.nrow()) { std::string msg = "Error in cbind: " "Matrix and Vector operands " "must have equal " "number of rows (length)."; Rcpp::stop(msg); } } inline R_xlen_t size() const { return e1.size() + e2.size(); } inline R_xlen_t nrow() const { return e1.nrow(); } inline R_xlen_t ncol() const { return e1.ncol() + e2.ncol(); } inline stored_type operator[](R_xlen_t i) const { return (i < e1.size()) ? e1[i] : e2[i - e1.size()]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { R_xlen_t index = i + nrow() * j; return (*this)[index]; } }; // binding logic; rhs scalar template class JoinOp::type> > : public BindableExpression::type> > >, public Rcpp::MatrixBase::type> > > { public: typedef typename cbind_storage_type::type stored_type; typedef ScalarBindable::type> E2; private: const E1& e1; const E2& e2; public: JoinOp(const BindableExpression& e1_, const BindableExpression& e2_) : e1(e1_), e2(e2_) {} inline R_xlen_t size() const { return e1.size() + e1.nrow(); } inline R_xlen_t nrow() const { return e1.nrow(); } inline R_xlen_t ncol() const { return e1.ncol() + 1; } inline stored_type operator[](R_xlen_t i) const { return (i < e1.size()) ? e1[i] : e2[i]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { R_xlen_t index = i + nrow() * j; return (*this)[index]; } }; // binding logic; lhs scalar template class JoinOp::type>, E2> : public BindableExpression::type>, E2> >, public Rcpp::MatrixBase::type>, E2> > { public: typedef typename cbind_storage_type::type stored_type; typedef ScalarBindable::type> E1; private: const E1& e1; const E2& e2; public: JoinOp(const BindableExpression& e1_, const BindableExpression& e2_) : e1(e1_), e2(e2_) {} inline R_xlen_t size() const { return e2.size() + e2.nrow(); } inline R_xlen_t nrow() const { return e2.nrow(); } inline R_xlen_t ncol() const { return e2.ncol() + 1; } inline stored_type operator[](R_xlen_t i) const { return (i < e2.nrow()) ? e1[i] : e2[i - e2.nrow()]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { R_xlen_t index = i + nrow() * j; return (*this)[index]; } }; // binding logic; both scalar template class JoinOp::type>, ScalarBindable::type> > : public BindableExpression::type>, ScalarBindable::type> > >, public Rcpp::MatrixBase::type>, ScalarBindable::type> > > { public: typedef typename cbind_storage_type::type stored_type; typedef ScalarBindable::type> E1; typedef ScalarBindable::type> E2; private: const E1& e1; const E2& e2; public: JoinOp(const BindableExpression& e1_, const BindableExpression& e2_) : e1(e1_), e2(e2_) {} inline R_xlen_t size() const { return e2.size() + e2.nrow(); } inline R_xlen_t nrow() const { return e2.nrow(); } inline R_xlen_t ncol() const { return e2.ncol() + 1; } inline stored_type operator[](R_xlen_t i) const { return (i < e2.nrow()) ? e1[i] : e2[i]; } inline stored_type operator()(R_xlen_t i, R_xlen_t j) const { R_xlen_t index = i + nrow() * j; return (*this)[index]; } }; // for template argument deduction template inline ContainerBindable > MakeContainerBindable(const Rcpp::Matrix& x) { return ContainerBindable >(x); } template inline ContainerBindable > MakeContainerBindable(const Rcpp::Vector& x) { return ContainerBindable >(x); } template <> inline ContainerBindable > MakeContainerBindable(const Rcpp::Matrix& x) { return ContainerBindable >(x); } template <> inline ContainerBindable > MakeContainerBindable(const Rcpp::Vector& x) { return ContainerBindable >(x); } template inline ScalarBindable MakeScalarBindable(const T& t) { return ScalarBindable(t); } // for expressions of arbitrary length template inline JoinOp operator,( const BindableExpression& e1, const BindableExpression& e2) { return JoinOp(e1, e2); } // helpers namespace detail { // distinguish Matrix/Vector from scalar template class has_stored_type { private: typedef char yes; typedef struct { char array[2]; } no; template static yes test(typename C::stored_type*); template static no test(...); public: static const bool value = sizeof(test(0)) == sizeof(yes); }; // functor to dispatch appropriate Make*Bindable() call template ::value> struct MakeBindableCall {}; template struct MakeBindableCall { typedef typename cbind_storage_type< cbind_sexptype_traits::rtype >::type stored_type; enum { RTYPE = cbind_sexptype_traits::rtype }; ContainerBindable operator()(const T& t) const { return MakeContainerBindable(t); } }; // specialize for LGLSXP template <> struct MakeBindableCall, true> { typedef Rcpp::Matrix T; typedef bool stored_type; enum { RTYPE = cbind_sexptype_traits::rtype }; ContainerBindable operator()(const T& t) const { return MakeContainerBindable(t); } }; template <> struct MakeBindableCall, true> { typedef Rcpp::Vector T; typedef bool stored_type; enum { RTYPE = cbind_sexptype_traits::rtype }; ContainerBindable operator()(const T& t) const { return MakeContainerBindable(t); } }; template struct MakeBindableCall { enum { RTYPE = cbind_sexptype_traits::rtype }; ScalarBindable operator()(const T& t) const { return MakeScalarBindable(t); } }; template inline typename Rcpp::traits::enable_if< has_stored_type::value, MakeBindableCall >::type MakeBindable(const T& t) { return MakeBindableCall(); } template inline typename Rcpp::traits::enable_if< !has_stored_type::value, MakeBindableCall >::type MakeBindable(const T& t) { return MakeBindableCall(); } // determine cbind return type from first template // parameter, agnostic of Matrix/Vector/scalar template ::value> struct matrix_return {}; template struct matrix_return { typedef typename cbind_storage_type< cbind_sexptype_traits::rtype >::type stored_type; enum { RTYPE = cbind_sexptype_traits::rtype }; typedef Rcpp::Matrix type; }; // specialize for LGLSXP // normally would default to IntegerMatrix template <> struct matrix_return, true> { typedef Rcpp::Matrix type; }; template <> struct matrix_return, true> { typedef Rcpp::Matrix type; }; template <> struct matrix_return { typedef Rcpp::Matrix type; }; template struct matrix_return { enum { RTYPE = cbind_sexptype_traits::rtype }; typedef Rcpp::Matrix type; }; } // detail template ::value> struct matrix_return : public detail::matrix_return {}; template struct matrix_return : public detail::matrix_return {}; } // cbind_impl #define MakeBindable(x) (cbind_impl::detail::MakeBindable(x)(x)) // begin cbind overloads template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2) { return (MakeBindable(t1), MakeBindable(t2)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4)); } // 5 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9)); } // 10 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14)); } // 15 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19)); } // 20 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24)); } // 25 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29)); } // 30 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34)); } // 35 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39)); } // 40 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44)); } // 45 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45, const T46& t46) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45), MakeBindable(t46)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45, const T46& t46, const T47& t47) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45), MakeBindable(t46), MakeBindable(t47)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45, const T46& t46, const T47& t47, const T48& t48) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45), MakeBindable(t46), MakeBindable(t47), MakeBindable(t48)); } template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45, const T46& t46, const T47& t47, const T48& t48, const T49& t49) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45), MakeBindable(t46), MakeBindable(t47), MakeBindable(t48), MakeBindable(t49)); } // 50 template inline typename cbind_impl::matrix_return::type cbind(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10, const T11& t11, const T12& t12, const T13& t13, const T14& t14, const T15& t15, const T16& t16, const T17& t17, const T18& t18, const T19& t19, const T20& t20, const T21& t21, const T22& t22, const T23& t23, const T24& t24, const T25& t25, const T26& t26, const T27& t27, const T28& t28, const T29& t29, const T30& t30, const T31& t31, const T32& t32, const T33& t33, const T34& t34, const T35& t35, const T36& t36, const T37& t37, const T38& t38, const T39& t39, const T40& t40, const T41& t41, const T42& t42, const T43& t43, const T44& t44, const T45& t45, const T46& t46, const T47& t47, const T48& t48, const T49& t49, const T50& t50) { return (MakeBindable(t1), MakeBindable(t2), MakeBindable(t3), MakeBindable(t4), MakeBindable(t5), MakeBindable(t6), MakeBindable(t7), MakeBindable(t8), MakeBindable(t9), MakeBindable(t10), MakeBindable(t11), MakeBindable(t12), MakeBindable(t13), MakeBindable(t14), MakeBindable(t15), MakeBindable(t16), MakeBindable(t17), MakeBindable(t18), MakeBindable(t19), MakeBindable(t20), MakeBindable(t21), MakeBindable(t22), MakeBindable(t23), MakeBindable(t24), MakeBindable(t25), MakeBindable(t26), MakeBindable(t27), MakeBindable(t28), MakeBindable(t29), MakeBindable(t30), MakeBindable(t31), MakeBindable(t32), MakeBindable(t33), MakeBindable(t34), MakeBindable(t35), MakeBindable(t36), MakeBindable(t37), MakeBindable(t38), MakeBindable(t39), MakeBindable(t40), MakeBindable(t41), MakeBindable(t42), MakeBindable(t43), MakeBindable(t44), MakeBindable(t45), MakeBindable(t46), MakeBindable(t47), MakeBindable(t48), MakeBindable(t49), MakeBindable(t50)); } // end cbind overloads #undef MakeBindable } // sugar namespace { using sugar::cbind; } } // Rcpp #endif // Rcpp__sugar__cbind_h Rcpp/inst/include/Rcpp/sugar/functions/is_nan.h0000644000176200001440000000302012535036334021232 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is_nan.h: Rcpp R/C++ interface class library -- is_nan // // Copyright (C) 2013 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 . #ifndef Rcpp__sugar__is_nan_h #define Rcpp__sugar__is_nan_h namespace Rcpp{ namespace sugar{ template class IsNaN : public ::Rcpp::VectorBase< LGLSXP, false, IsNaN > { public: IsNaN( const VEC_TYPE& obj_) : obj(obj_){} inline int operator[]( R_xlen_t i ) const { return ::Rcpp::traits::is_nan( obj[i] ) ; } inline R_xlen_t size() const { return obj.size() ; } private: const VEC_TYPE& obj ; } ; } // sugar template inline sugar::IsNaN is_nan( const Rcpp::VectorBase& t){ return sugar::IsNaN( t.get_ref() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/ifelse.h0000644000176200001440000002622112535036334021242 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // ifelse.h: Rcpp R/C++ interface class library -- ifelse // // Copyright (C) 2010 - 2014 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 . #ifndef Rcpp__sugar__ifelse_h #define Rcpp__sugar__ifelse_h namespace Rcpp{ namespace sugar{ template < int RTYPE, bool COND_NA, typename COND_T, bool LHS_NA , typename LHS_T, bool RHS_NA , typename RHS_T > class IfElse : public VectorBase< RTYPE, ( COND_NA || LHS_NA || RHS_NA ) , IfElse > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase LHS_TYPE ; typedef Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; // typedef typename Rcpp::traits::Extractor::type LHS_EXT ; // typedef typename Rcpp::traits::Extractor::type RHS_EXT ; IfElse( const COND_TYPE& cond_, const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : cond(cond_), lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) { /* FIXME : cond, lhs and rhs must all have the same size */ RCPP_DEBUG( DEMANGLE(IfElse) ) ; } inline STORAGE operator[]( R_xlen_t i ) const { int x = cond[i] ; if( Rcpp::traits::is_na(x) ) return Rcpp::traits::get_na() ; if( x ) return lhs[i] ; return rhs[i] ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; const LHS_T& lhs ; const RHS_T& rhs ; } ; template < int RTYPE, typename COND_T, bool LHS_NA , typename LHS_T, bool RHS_NA , typename RHS_T > class IfElse : public VectorBase< RTYPE, ( LHS_NA || RHS_NA ) , IfElse > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase LHS_TYPE ; typedef Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; IfElse( const COND_TYPE& cond_, const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : cond(cond_), lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) { /* FIXME : cond, lhs and rhs must all have the same size */ } inline STORAGE operator[]( R_xlen_t i ) const { if( cond[i] ) return lhs[i] ; return rhs[i] ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; /* ifelse( cond, primitive, Vector ) */ template < int RTYPE, bool COND_NA, typename COND_T, bool RHS_NA , typename RHS_T > class IfElse_Primitive_Vector : public VectorBase< RTYPE, true , IfElse_Primitive_Vector > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; IfElse_Primitive_Vector( const COND_TYPE& cond_, STORAGE lhs_, const RHS_TYPE& rhs_ ) : cond(cond_), lhs(lhs_), rhs(rhs_.get_ref()) { /* FIXME : cond, lhs and rhs must all have the sale size */ } inline STORAGE operator[]( R_xlen_t i ) const { int x = cond[i] ; if( Rcpp::traits::is_na(x) ) return x ; if( x ) return lhs ; return rhs[i] ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; STORAGE lhs ; const RHS_EXT& rhs ; } ; template < int RTYPE, typename COND_T, bool RHS_NA , typename RHS_T > class IfElse_Primitive_Vector : public VectorBase< RTYPE, true, IfElse_Primitive_Vector > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; IfElse_Primitive_Vector( const COND_TYPE& cond_, STORAGE lhs_, const RHS_TYPE& rhs_ ) : cond(cond_), lhs(lhs_), rhs(rhs_.get_ref()) { /* FIXME : cond, lhs and rhs must all have the same size */ } inline STORAGE operator[]( R_xlen_t i ) const { if( cond[i] ) return lhs ; return rhs[i] ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; STORAGE lhs ; const RHS_EXT& rhs ; } ; /* ifelse( cond, Vector, primitive ) */ template < int RTYPE, bool COND_NA, typename COND_T, bool LHS_NA , typename LHS_T > class IfElse_Vector_Primitive : public VectorBase< RTYPE, true , IfElse_Vector_Primitive > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase LHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; IfElse_Vector_Primitive( const COND_TYPE& cond_, const LHS_TYPE& lhs_, STORAGE rhs_ ) : cond(cond_), lhs(lhs_.get_ref()), rhs(rhs_) { /* FIXME : cond, lhs and rhs must all have the same size */ } inline STORAGE operator[]( R_xlen_t i ) const { int x = cond[i] ; if( Rcpp::traits::is_na(x) ) return Rcpp::traits::get_na() ; if( x ) return lhs[i] ; return rhs ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; const LHS_EXT& lhs ; const STORAGE rhs ; } ; template < int RTYPE, typename COND_T, bool LHS_NA , typename LHS_T > class IfElse_Vector_Primitive : public VectorBase< RTYPE, true , IfElse_Vector_Primitive > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef Rcpp::VectorBase LHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; IfElse_Vector_Primitive( const COND_TYPE& cond_, const LHS_TYPE& lhs_, STORAGE rhs_ ) : cond(cond_), lhs(lhs_.get_ref()), rhs(rhs_) { /* FIXME : cond, lhs and rhs must all have the sale size */ } inline STORAGE operator[]( R_xlen_t i ) const { if( cond[i] ) return lhs[i] ; return rhs ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; const LHS_EXT& lhs ; const STORAGE rhs ; } ; /* ifelse( cond, primitive, primitive ) */ template < int RTYPE, bool COND_NA, typename COND_T > class IfElse_Primitive_Primitive : public VectorBase< RTYPE, true , IfElse_Primitive_Primitive > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef typename traits::storage_type::type STORAGE ; IfElse_Primitive_Primitive( const COND_TYPE& cond_, STORAGE lhs_, STORAGE rhs_ ) : cond(cond_), lhs(lhs_), rhs(rhs_) { /* FIXME : cond, lhs and rhs must all have the same size */ } inline STORAGE operator[]( R_xlen_t i ) const { int x = cond[i] ; if( Rcpp::traits::is_na(x) ) return Rcpp::traits::get_na() ; return x ? lhs : rhs ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; STORAGE lhs ; STORAGE rhs ; STORAGE na ; } ; template < int RTYPE, typename COND_T > class IfElse_Primitive_Primitive : public VectorBase< RTYPE, true , IfElse_Primitive_Primitive > { public: typedef Rcpp::VectorBase COND_TYPE ; typedef typename traits::storage_type::type STORAGE ; IfElse_Primitive_Primitive( const COND_TYPE& cond_, STORAGE lhs_, STORAGE rhs_ ) : cond(cond_), lhs(lhs_), rhs(rhs_) { /* FIXME : cond, lhs and rhs must all have the same size */ } inline STORAGE operator[]( R_xlen_t i ) const { return cond[i] ? lhs : rhs ; } inline R_xlen_t size() const { return cond.size() ; } private: const COND_TYPE& cond ; STORAGE lhs ; STORAGE rhs ; } ; } // sugar template < int RTYPE, bool COND_NA, typename COND_T, bool LHS_NA , typename LHS_T, bool RHS_NA , typename RHS_T > inline sugar::IfElse< RTYPE,COND_NA,COND_T,LHS_NA,LHS_T,RHS_NA,RHS_T > ifelse( const Rcpp::VectorBase& cond, const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs ){ return sugar::IfElse( cond, lhs, rhs ) ; } template < int RTYPE, bool COND_NA, typename COND_T, bool RHS_NA , typename RHS_T > inline sugar::IfElse_Primitive_Vector< RTYPE,COND_NA,COND_T,RHS_NA,RHS_T > ifelse( const Rcpp::VectorBase& cond, typename traits::storage_type::type lhs, const Rcpp::VectorBase& rhs ){ return sugar::IfElse_Primitive_Vector( cond, lhs, rhs ) ; } template < int RTYPE, bool COND_NA, typename COND_T, bool RHS_NA , typename RHS_T > inline sugar::IfElse_Vector_Primitive< RTYPE,COND_NA,COND_T,RHS_NA,RHS_T > ifelse( const Rcpp::VectorBase& cond, const Rcpp::VectorBase& lhs, typename traits::storage_type::type rhs ){ return sugar::IfElse_Vector_Primitive( cond, lhs, rhs ) ; } template< bool COND_NA, typename COND_T > inline sugar::IfElse_Primitive_Primitive< REALSXP,COND_NA,COND_T > ifelse( const Rcpp::VectorBase& cond, double lhs, double rhs ){ return sugar::IfElse_Primitive_Primitive( cond, lhs, rhs ) ; } template< bool COND_NA, typename COND_T > inline sugar::IfElse_Primitive_Primitive< INTSXP,COND_NA,COND_T > ifelse( const Rcpp::VectorBase& cond, int lhs, int rhs ){ return sugar::IfElse_Primitive_Primitive( cond, lhs, rhs ) ; } template< bool COND_NA, typename COND_T > inline sugar::IfElse_Primitive_Primitive< CPLXSXP,COND_NA,COND_T > ifelse( const Rcpp::VectorBase& cond, Rcomplex lhs, Rcomplex rhs ){ return sugar::IfElse_Primitive_Primitive( cond, lhs, rhs ) ; } template< bool COND_NA, typename COND_T > inline sugar::IfElse_Primitive_Primitive< LGLSXP,COND_NA,COND_T > ifelse( const Rcpp::VectorBase& cond, bool lhs, bool rhs ){ return sugar::IfElse_Primitive_Primitive( cond, lhs, rhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/min.h0000644000176200001440000000461613324633757020573 0ustar liggesusers // Min.h: Rcpp R/C++ interface class library -- min // // Copyright (C) 2012 - 2018 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 . #ifndef Rcpp__sugar__min_h #define Rcpp__sugar__min_h namespace Rcpp{ namespace sugar{ template class Min { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Min( const T& obj_) : obj(obj_) {} operator STORAGE() const { R_xlen_t n = obj.size(); if (n == 0) return(static_cast(R_PosInf)); STORAGE min, current ; min = obj[0] ; if( Rcpp::traits::is_na( min ) ) return min ; for( R_xlen_t i=1; i( current ) ) return current; if( current < min ) min = current ; } return min ; } const T& obj ; } ; // version for NA = false template class Min { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Min( const T& obj_) : obj(obj_) {} operator STORAGE() const { R_xlen_t n = obj.size(); if (n == 0) return(static_cast(R_PosInf)); STORAGE min, current ; min = obj[0] ; for( R_xlen_t i=1; i sugar::Min min( const VectorBase& x){ return sugar::Min(x.get_ref()) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/head.h0000644000176200001440000000323412535036334020673 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // head.h: Rcpp R/C++ interface class library -- head // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__head_h #define Rcpp__sugar__head_h namespace Rcpp{ namespace sugar{ template class Head : public Rcpp::VectorBase< RTYPE ,NA, Head > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Head( const VEC_TYPE& object_, R_xlen_t n_ ) : object(object_), n(n_) { if( n < 0 ){ n = object.size() + n ; } } inline STORAGE operator[]( R_xlen_t i ) const { return object[ i ] ; } inline R_xlen_t size() const { return n; } private: const VEC_TYPE& object ; int n ; } ; } // sugar template inline sugar::Head head( const VectorBase& t, R_xlen_t n ){ return sugar::Head( t, n ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/sum.h0000644000176200001440000000636212535036334020603 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // sum.h: Rcpp R/C++ interface class library -- sum // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__sum_h #define Rcpp__sugar__sum_h namespace Rcpp{ namespace sugar{ template class Sum : public Lazy< typename Rcpp::traits::storage_type::type , Sum > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type VEC_EXT ; Sum( const VEC_TYPE& object_ ) : object(object_.get_ref()){} STORAGE get() const { STORAGE result = 0 ; R_xlen_t n = object.size() ; STORAGE current ; for( R_xlen_t i=0; i(current) ) return Rcpp::traits::get_na() ; result += current ; } return result ; } private: const VEC_EXT& object ; } ; // RTYPE = REALSXP template class Sum : public Lazy< double , Sum > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor< REALSXP, NA, T>::type VEC_EXT ; Sum( const VEC_TYPE& object_ ) : object(object_.get_ref()){} double get() const { double result = 0 ; R_xlen_t n = object.size() ; for( R_xlen_t i=0; i class Sum : public Lazy< typename Rcpp::traits::storage_type::type , Sum > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, T>::type VEC_EXT ; Sum( const VEC_TYPE& object_ ) : object(object_.get_ref()){} STORAGE get() const { STORAGE result = 0 ; R_xlen_t n = object.size() ; for( R_xlen_t i=0; i inline sugar::Sum sum( const VectorBase& t){ return sugar::Sum( t ) ; } template inline sugar::Sum sum( const VectorBase& t){ return sugar::Sum( t ) ; } template inline sugar::Sum sum( const VectorBase& t){ return sugar::Sum( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/sd.h0000644000176200001440000000301112336231761020371 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // mean.h: Rcpp R/C++ interface class library -- mean // // Copyright (C) 2011 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 . #ifndef Rcpp__sugar__sd_h #define Rcpp__sugar__sd_h namespace Rcpp{ namespace sugar{ template class Sd : public Lazy< typename Rcpp::traits::storage_type::type , Sd > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Sd( const VEC_TYPE& object_ ) : object(object_){} STORAGE get() const { return ::sqrt( var(object).get() ) ; } private: const VEC_TYPE& object ; } ; } // sugar template inline sugar::Sd sd( const VectorBase& t){ return sugar::Sd( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/match.h0000644000176200001440000000233312316773510021066 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // match.h: Rcpp R/C++ interface class library -- match // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__match_h #define Rcpp__sugar__match_h namespace Rcpp{ template inline IntegerVector match( const VectorBase& x, const VectorBase& table_ ){ Vector table = table_ ; return sugar::IndexHash( table ).fill().lookup( x.get_ref() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/pmax.h0000644000176200001440000001165312535036334020743 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // pmax.h: Rcpp R/C++ interface class library -- pmax // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__pmax_h #define Rcpp__sugar__pmax_h namespace Rcpp{ namespace sugar{ template struct pmax_op ; // specializations for double. // we use the fact that NA < x is false template <> struct pmax_op{ inline double operator()( double left, double right ) const { return ( Rcpp::traits::is_na( left ) || (left > right) ) ? left : right ; } } ; template <> struct pmax_op { inline double operator()( double left, double right ) const { return right > left ? right : left ; } } ; template <> struct pmax_op { inline double operator()( double left, double right ) const { return right > left ? right : left ; } } ; template <> struct pmax_op { inline double operator()( double left, double right ) const { return left > right ? left : right ; } } ; // specializations for INTSXP. Since NA is represented as the smallest // int, NA is always the smallest, so it is safe to return NA template struct pmax_op { inline int operator()(int left, int right) const { return left > right ? left : right ; } } ; // general case template class pmax_op_Vector_Primitive { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; pmax_op_Vector_Primitive( STORAGE right_ ) : right(right_) {} inline STORAGE operator()( STORAGE left ) const { return left > right ? left : right ; } private: STORAGE right ; } ; // only special case we need to take care of template <> class pmax_op_Vector_Primitive { public: pmax_op_Vector_Primitive( double right_ ) : right(right_) {} inline double operator()( double left ) const { return ( Rcpp::traits::is_na( left ) || (left > right) ) ? left : right ; } private: double right ; } ; template < int RTYPE, bool LHS_NA, typename LHS_T, bool RHS_NA, typename RHS_T > class Pmax_Vector_Vector : public VectorBase< RTYPE , ( LHS_NA || RHS_NA ) , Pmax_Vector_Vector > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef pmax_op OPERATOR ; Pmax_Vector_Vector( const LHS_T& lhs_, const RHS_T& rhs_ ) : lhs(lhs_), rhs(rhs_), op() {} inline STORAGE operator[]( R_xlen_t i ) const { return op( lhs[i], rhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_T& lhs ; const RHS_T& rhs ; OPERATOR op ; } ; template < int RTYPE, bool LHS_NA, typename LHS_T > class Pmax_Vector_Primitive : public VectorBase< RTYPE , true , Pmax_Vector_Primitive > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef pmax_op_Vector_Primitive OPERATOR ; Pmax_Vector_Primitive( const LHS_T& lhs_, STORAGE rhs_ ) : lhs(lhs_), op(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { return op( lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_T& lhs ; OPERATOR op ; } ; } // sugar template < int RTYPE, bool LHS_NA, typename LHS_T, bool RHS_NA, typename RHS_T > inline sugar::Pmax_Vector_Vector pmax( const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs ){ return sugar::Pmax_Vector_Vector( lhs.get_ref(), rhs.get_ref() ) ; } template < int RTYPE, bool LHS_NA, typename LHS_T > inline sugar::Pmax_Vector_Primitive pmax( const Rcpp::VectorBase& lhs, typename Rcpp::traits::storage_type::type rhs ){ return sugar::Pmax_Vector_Primitive( lhs.get_ref(), rhs ) ; } template < int RTYPE, bool RHS_NA, typename RHS_T > inline sugar::Pmax_Vector_Primitive pmax( typename Rcpp::traits::storage_type::type lhs, const Rcpp::VectorBase& rhs ){ return sugar::Pmax_Vector_Primitive( rhs.get_ref(), lhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/pow.h0000644000176200001440000000526612535036334020606 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // pow.h: Rcpp R/C++ interface class library -- pow // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__pow_h #define Rcpp__sugar__pow_h namespace Rcpp{ namespace sugar{ template class Pow : public Rcpp::VectorBase< REALSXP ,NA, Pow > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Pow( const T& object_, EXPONENT_TYPE exponent ) : object(object_), op(exponent) {} inline double operator[]( R_xlen_t i ) const { return ::pow( object[i], op ); } inline R_xlen_t size() const { return object.size() ; } private: const T& object ; EXPONENT_TYPE op ; } ; template class Pow : public Rcpp::VectorBase< REALSXP ,NA, Pow > { public: Pow( const T& object_, EXPONENT_TYPE exponent ) : object(object_), op(exponent) {} inline double operator[]( R_xlen_t i ) const { int x = object[i] ; return x == NA_INTEGER ? NA_INTEGER : ::pow( x, op ); } inline R_xlen_t size() const { return object.size() ; } private: const T& object ; EXPONENT_TYPE op ; } ; template class Pow : public Rcpp::VectorBase< REALSXP ,false, Pow > { public: Pow( const T& object_, EXPONENT_TYPE exponent ) : object(object_), op(exponent) {} inline double operator[]( R_xlen_t i ) const { return ::pow( object[i], op ); } inline R_xlen_t size() const { return object.size() ; } private: const T& object ; EXPONENT_TYPE op ; } ; } // sugar template inline sugar::Pow pow( const VectorBase& t, EXPONENT_TYPE exponent ){ return sugar::Pow( t.get_ref() , exponent ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/var.h0000644000176200001440000000565012550266611020566 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // var.h: Rcpp R/C++ interface class library -- var // // Copyright (C) 2011 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2015 Wush Wu // // 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 . #ifndef Rcpp__sugar__var_h #define Rcpp__sugar__var_h namespace Rcpp{ namespace sugar{ template class Var : public Lazy< double , Var > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; Var( const VEC_TYPE& object_ ) : object(object_){} double get() const{ const double average = mean(object).get(); const R_xlen_t sample_size = object.size(); double sum_squared_deviations = 0.0; for (R_xlen_t i = 0; i != sample_size; ++i) sum_squared_deviations += std::pow(object[i] - average, 2.0); return sum_squared_deviations / (sample_size - 1); } private: const VEC_TYPE& object ; } ; template class Var : public Lazy< double , Var > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; Var( const VEC_TYPE& object_ ) : object(object_){} double get() const{ const Rcomplex average = mean(object).get(); const R_xlen_t sample_size = object.size(); double sum_squared_deviations_magnitudes = 0.0; for (R_xlen_t i = 0; i != sample_size; ++i) { const Rcomplex deviation = object[i] - average; sum_squared_deviations_magnitudes += deviation.r * deviation.r + deviation.i * deviation.i; } return sum_squared_deviations_magnitudes / (sample_size - 1); } private: const VEC_TYPE& object ; } ; } // sugar template inline sugar::Var var( const VectorBase& t){ return sugar::Var( t ) ; } template inline sugar::Var var( const VectorBase& t){ return sugar::Var( t ) ; } template inline sugar::Var var( const VectorBase& t){ return sugar::Var( t ) ; } template inline sugar::Var var( const VectorBase& t){ return sugar::Var( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/mapply.h0000644000176200001440000000200112253723677021275 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // mapply.h: Rcpp R/C++ interface class library -- mapply // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__mapply_h #define Rcpp__sugar__mapply_h #include #include #endif Rcpp/inst/include/Rcpp/sugar/functions/table.h0000644000176200001440000000540014771655440021067 0ustar liggesusers// table.h: Rcpp R/C++ interface class library -- table match // // Copyright (C) 2012 - 2025 Dirk Eddelbuettel, Romain Francois, and Kevin Ushey // Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Kevin Ushey 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 . #ifndef Rcpp__sugar__table_h #define Rcpp__sugar__table_h namespace Rcpp{ namespace sugar{ template class CountInserter { public: CountInserter( HASH& hash_ ) : hash(hash_) {} inline void operator()( STORAGE value ){ hash[value]++ ; } private: HASH& hash ; } ; template class Grabber{ public: Grabber( IntegerVector& res_, CharacterVector& names_ ) : res(res_), names(names_), index(0){} template inline void operator()( T pair){ res[index] = pair.second ; names[index++] = internal::r_coerce(pair.first) ; } private: IntegerVector& res ; CharacterVector& names ; R_xlen_t index ; } ; template class Table { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Table( const TABLE_T& table ): hash(), map() { // populate the initial hash std::for_each( table.begin(), table.end(), Inserter(hash) ) ; // populate the map, sorted by keys map.insert( hash.begin(), hash.end() ) ; } inline operator IntegerVector() const { // fill the result R_xlen_t n = map.size() ; IntegerVector result = no_init(n) ; CharacterVector names = no_init(n) ; std::for_each( map.begin(), map.end(), Grabber(result, names) ) ; result.names() = names ; return result ; } private: typedef std::unordered_map HASH ; typedef CountInserter Inserter ; HASH hash ; typedef std::map > SORTED_MAP ; SORTED_MAP map ; }; } // sugar template inline IntegerVector table( const VectorBase& x ){ return sugar::Table(x.get_ref()) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/rep_len.h0000644000176200001440000000332412535036334021416 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // rep_len.h: Rcpp R/C++ interface class library -- rep_len // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__rep_len_h #define Rcpp__sugar__rep_len_h namespace Rcpp{ namespace sugar{ template class Rep_len : public Rcpp::VectorBase< RTYPE ,NA, Rep_len > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Rep_len( const VEC_TYPE& object_, R_xlen_t len_ ) : object(object_), len(len_), n(object_.size()){} inline STORAGE operator[]( R_xlen_t i ) const { return object[ i % n ] ; } inline R_xlen_t size() const { return len ; } private: const VEC_TYPE& object ; R_xlen_t len, n ; } ; } // sugar template inline sugar::Rep_len rep_len( const VectorBase& t, R_xlen_t len ){ return sugar::Rep_len( t, len ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/rowSums.h0000644000176200001440000014641713103613705021457 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // rowSums.h: Rcpp R/C++ interface class library -- rowSums, colSums, rowMeans, colMeans // // Copyright (C) 2016 Nathan Russell // // 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 . #ifndef Rcpp__sugar__rowSums_h #define Rcpp__sugar__rowSums_h namespace Rcpp { namespace sugar { namespace detail { inline bool check_na(double x) { return ISNAN(x); } inline bool check_na(int x) { return x == NA_INTEGER; } inline bool check_na(Rboolean x) { return x == NA_LOGICAL; } inline bool check_na(SEXP x) { return x == NA_STRING; } inline bool check_na(Rcomplex x) { return ISNAN(x.r) || ISNAN(x.i); } inline void incr(double* lhs, double rhs) { *lhs += rhs; } inline void incr(int* lhs, int rhs) { *lhs += rhs; } inline void incr(Rcomplex* lhs, const Rcomplex& rhs) { lhs->r += rhs.r; lhs->i += rhs.i; } inline void div(double* lhs, R_xlen_t rhs) { *lhs /= static_cast(rhs); } inline void div(Rcomplex* lhs, R_xlen_t rhs) { lhs->r /= static_cast(rhs); lhs->i /= static_cast(rhs); } inline void set_nan(double* x) { *x = R_NaN; } inline void set_nan(Rcomplex* x) { x->r = R_NaN; x->i = R_NaN; } template struct RowSumsReturn { typedef Vector type; enum { rtype = RTYPE }; }; template <> struct RowSumsReturn { typedef Vector type; enum { rtype = INTSXP }; }; template struct ColSumsReturn : public RowSumsReturn {}; template struct RowMeansReturn { typedef Vector type; enum { rtype = REALSXP }; }; template <> struct RowMeansReturn { typedef Vector type; enum { rtype = CPLXSXP }; }; template struct ColMeansReturn : public RowMeansReturn {}; } // detail // RowSums // na.rm = FALSE // default input // default output // template class RowSumsImpl : public Lazy::type, RowSumsImpl > { private: const MatrixBase& ref; typedef detail::RowSumsReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: RowSumsImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nr); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { detail::incr(&res[i], ref(i, j)); } } return res; } }; // RowSums // na.rm = FALSE // LGLSXP / INTSXP input // INTSXP output // // int + NA_LOGICAL (NA_INTEGER) != NA_INTEGER, as is the // case with NA_REAL, so we specialize for these two SEXPTYPES // and do explicit accounting of NAs. // // The two specializations, while necessary, are redundant, hence // the macro. The same applies to the 'na.rm = TRUE' variant, and // likewise for colSums, rowMeans, and colMeans. // #define ROW_SUMS_IMPL_KEEPNA(__RTYPE__) \ \ template \ class RowSumsImpl<__RTYPE__, NA, T, NA_RM> : \ public Lazy::type, RowSumsImpl<__RTYPE__, NA, T, NA_RM> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::RowSumsReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ struct bit { \ unsigned char x : 1; \ }; \ \ public: \ RowSumsImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nr); \ \ std::vector na_flags(nr); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (detail::check_na(ref(i, j))) { \ na_flags[i].x |= 0x1; \ } \ detail::incr(&res[i], ref(i, j)); \ } \ } \ \ for (i = 0; i < nr; i++) { \ if (na_flags[i].x) { \ res[i] = NA_INTEGER; \ } \ } \ \ return res; \ } \ }; ROW_SUMS_IMPL_KEEPNA(LGLSXP) ROW_SUMS_IMPL_KEEPNA(INTSXP) #undef ROW_SUMS_IMPL_KEEPNA // RowSums // na.rm = TRUE // default input // default output // template class RowSumsImpl : public Lazy::type, RowSumsImpl > { private: const MatrixBase& ref; typedef detail::RowSumsReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: RowSumsImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nr); stored_type current = stored_type(); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { current = ref(i, j); if (!detail::check_na(current)) { detail::incr(&res[i], current); } } } return res; } }; // RowSums // na.rm = TRUE // LGLSXP / INTSXP input // INTSXP output // #define ROW_SUMS_IMPL_RMNA(__RTYPE__) \ \ template \ class RowSumsImpl<__RTYPE__, NA, T, true> : \ public Lazy::type, RowSumsImpl<__RTYPE__, NA, T, true> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::RowSumsReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ public: \ RowSumsImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nr); \ \ stored_type current = stored_type(); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ current = ref(i, j); \ if (!detail::check_na(current)) { \ detail::incr(&res[i], current); \ } \ } \ } \ \ return res; \ } \ }; ROW_SUMS_IMPL_RMNA(LGLSXP) ROW_SUMS_IMPL_RMNA(INTSXP) #undef ROW_SUMS_IMPL_RMNA // RowSums // Input with template parameter NA = false // RowSumsImpl<..., NA_RM = false> // template class RowSumsImpl : public RowSumsImpl {}; // ColSums // na.rm = FALSE // default input // default output // template class ColSumsImpl : public Lazy::type, ColSumsImpl > { private: const MatrixBase& ref; typedef detail::ColSumsReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: ColSumsImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nc); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { detail::incr(&res[j], ref(i, j)); } } return res; } }; // ColSums // na.rm = FALSE // LGLSXP / INTSXP input // INTSXP output // #define COL_SUMS_IMPL_KEEPNA(__RTYPE__) \ \ template \ class ColSumsImpl<__RTYPE__, NA, T, NA_RM> : \ public Lazy::type, ColSumsImpl<__RTYPE__, NA, T, NA_RM> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::ColSumsReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ struct bit { \ unsigned char x : 1; \ }; \ \ public: \ ColSumsImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nc); \ \ std::vector na_flags(nc); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (detail::check_na(ref(i, j))) { \ na_flags[j].x |= 0x1; \ } \ detail::incr(&res[j], ref(i, j)); \ } \ } \ \ for (j = 0; j < nc; j++) { \ if (na_flags[j].x) { \ res[j] = NA_INTEGER; \ } \ } \ \ return res; \ } \ }; COL_SUMS_IMPL_KEEPNA(LGLSXP) COL_SUMS_IMPL_KEEPNA(INTSXP) #undef COL_SUMS_IMPL_KEEPNA // ColSums // na.rm = TRUE // default input // default output // template class ColSumsImpl : public Lazy::type, ColSumsImpl > { private: const MatrixBase& ref; typedef detail::ColSumsReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: ColSumsImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nc); stored_type current = stored_type(); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { current = ref(i, j); if (!detail::check_na(current)) { detail::incr(&res[j], current); } } } return res; } }; // ColSums // na.rm = TRUE // LGLSXP / INTSXP input // INTSXP output // #define COL_SUMS_IMPL_RMNA(__RTYPE__) \ \ template \ class ColSumsImpl<__RTYPE__, NA, T, true> : \ public Lazy::type, ColSumsImpl<__RTYPE__, NA, T, true> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::ColSumsReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ public: \ ColSumsImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nc); \ \ stored_type current = stored_type(); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ current = ref(i, j); \ if (!detail::check_na(current)) { \ detail::incr(&res[j], current); \ } \ } \ } \ \ return res; \ } \ }; COL_SUMS_IMPL_RMNA(LGLSXP) COL_SUMS_IMPL_RMNA(INTSXP) #undef COL_SUMS_IMPL_RMNA // ColSums // Input with template parameter NA = false // ColSumsImpl<..., NA_RM = false> // template class ColSumsImpl : public ColSumsImpl {}; // RowMeans // na.rm = FALSE // default input // default output // // All RowMeans and ColMeans variants use a single-pass // mean calculation as in array.c // template class RowMeansImpl : public Lazy::type, RowMeansImpl > { private: const MatrixBase& ref; typedef detail::RowMeansReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: RowMeansImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nr); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { detail::incr(&res[i], ref(i, j)); } } for (i = 0; i < nr; i++) { detail::div(&res[i], nc); } return res; } }; // RowMeans // na.rm = FALSE // LGLSXP / INTSXP input // REALSXP output // #define ROW_MEANS_IMPL_KEEPNA(__RTYPE__) \ \ template \ class RowMeansImpl<__RTYPE__, NA, T, NA_RM> : \ public Lazy::type, RowMeansImpl<__RTYPE__, NA, T, NA_RM> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::RowMeansReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ struct bit { \ unsigned char x : 1; \ }; \ \ public: \ RowMeansImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nr); \ \ std::vector na_flags(nc); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (detail::check_na(ref(i, j))) { \ na_flags[i].x |= 0x1; \ } \ detail::incr(&res[i], ref(i, j)); \ } \ } \ \ for (i = 0; i < nr; i++) { \ if (!na_flags[i].x) { \ detail::div(&res[i], nc); \ } else { \ res[i] = NA_REAL; \ } \ } \ \ return res; \ } \ }; ROW_MEANS_IMPL_KEEPNA(LGLSXP) ROW_MEANS_IMPL_KEEPNA(INTSXP) #undef ROW_MEANS_IMPL_KEEPNA // RowMeans // na.rm = TRUE // default input // default output // template class RowMeansImpl : public Lazy::type, RowMeansImpl > { private: const MatrixBase& ref; typedef detail::RowMeansReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: RowMeansImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nr); std::vector n_ok(nr, 0); stored_type current = stored_type(); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { current = ref(i, j); if (!detail::check_na(current)) { detail::incr(&res[i], ref(i, j)); ++n_ok[i]; } } } for (i = 0; i < nr; i++) { if (n_ok[i]) { detail::div(&res[i], n_ok[i]); } else { detail::set_nan(&res[i]); } } return res; } }; // RowMeans // na.rm = TRUE // LGLSXP / INTSXP input // REALSXP output // #define ROW_MEANS_IMPL_RMNA(__RTYPE__) \ \ template \ class RowMeansImpl<__RTYPE__, NA, T, true> : \ public Lazy::type, RowMeansImpl<__RTYPE__, NA, T, true> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::RowMeansReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ public: \ RowMeansImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nr); \ \ std::vector n_ok(nr, 0); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (!detail::check_na(ref(i, j))) { \ detail::incr(&res[i], ref(i, j)); \ ++n_ok[i]; \ } \ } \ } \ \ for (i = 0; i < nr; i++) { \ if (n_ok[i]) { \ detail::div(&res[i], n_ok[i]); \ } else { \ detail::set_nan(&res[i]); \ } \ } \ \ return res; \ } \ }; ROW_MEANS_IMPL_RMNA(LGLSXP) ROW_MEANS_IMPL_RMNA(INTSXP) #undef ROW_MEANS_IMPL_RMNA // RowMeans // Input with template parameter NA = false // RowMeansImpl<..., NA_RM = false> // template class RowMeansImpl : public RowMeansImpl {}; // ColMeans // na.rm = FALSE // default input // default output // template class ColMeansImpl : public Lazy::type, ColMeansImpl > { private: const MatrixBase& ref; typedef detail::ColMeansReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: ColMeansImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nc); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { detail::incr(&res[j], ref(i, j)); } } for (j = 0; j < nc; j++) { detail::div(&res[j], nr); } return res; } }; // ColMeans // na.rm = FALSE // LGLSXP / INTSXP input // REALSXP output // #define COL_MEANS_IMPL_KEEPNA(__RTYPE__) \ \ template \ class ColMeansImpl<__RTYPE__, NA, T, NA_RM> : \ public Lazy::type, ColMeansImpl<__RTYPE__, NA, T, NA_RM> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::ColMeansReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ struct bit { \ unsigned char x : 1; \ }; \ \ public: \ ColMeansImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nc); \ \ std::vector na_flags(nc); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (detail::check_na(ref(i, j))) { \ na_flags[j].x |= 0x1; \ } \ detail::incr(&res[j], ref(i, j)); \ } \ } \ \ for (j = 0; j < nc; j++) { \ if (!na_flags[j].x) { \ detail::div(&res[j], nr); \ } else { \ res[j] = NA_REAL; \ } \ } \ \ return res; \ } \ }; COL_MEANS_IMPL_KEEPNA(LGLSXP) COL_MEANS_IMPL_KEEPNA(INTSXP) #undef COL_MEANS_IMPL_KEEPNA // ColMeans // na.rm = TRUE // default input // default output // template class ColMeansImpl : public Lazy::type, ColMeansImpl > { private: const MatrixBase& ref; typedef detail::ColMeansReturn return_traits; typedef typename return_traits::type return_vector; typedef typename traits::storage_type::type stored_type; public: ColMeansImpl(const MatrixBase& ref_) : ref(ref_) {} return_vector get() const { R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); return_vector res(nc); std::vector n_ok(nc, 0); stored_type current = stored_type(); for (j = 0; j < nc; j++) { for (i = 0; i < nr; i++) { current = ref(i, j); if (!detail::check_na(current)) { detail::incr(&res[j], ref(i, j)); ++n_ok[j]; } } } for (j = 0; j < nc; j++) { if (n_ok[j]) { detail::div(&res[j], n_ok[j]); } else { detail::set_nan(&res[j]); } } return res; } }; // ColMeans // na.rm = TRUE // LGLSXP / INTSXP input // REALSXP output // #define COL_MEANS_IMPL_RMNA(__RTYPE__) \ \ template \ class ColMeansImpl<__RTYPE__, NA, T, true> : \ public Lazy::type, ColMeansImpl<__RTYPE__, NA, T, true> > { \ private: \ const MatrixBase<__RTYPE__, NA, T>& ref; \ \ typedef detail::ColMeansReturn<__RTYPE__> return_traits; \ typedef typename return_traits::type return_vector; \ typedef typename traits::storage_type::type stored_type; \ \ public: \ ColMeansImpl(const MatrixBase<__RTYPE__, NA, T>& ref_) \ : ref(ref_) \ {} \ \ return_vector get() const { \ R_xlen_t i, j, nr = ref.nrow(), nc = ref.ncol(); \ return_vector res(nc); \ \ std::vector n_ok(nc, 0); \ \ for (j = 0; j < nc; j++) { \ for (i = 0; i < nr; i++) { \ if (!detail::check_na(ref(i, j))) { \ detail::incr(&res[j], ref(i, j)); \ ++n_ok[j]; \ } \ } \ } \ \ for (j = 0; j < nc; j++) { \ if (n_ok[j]) { \ detail::div(&res[j], n_ok[j]); \ } else { \ detail::set_nan(&res[j]); \ } \ } \ \ return res; \ } \ }; COL_MEANS_IMPL_RMNA(LGLSXP) COL_MEANS_IMPL_RMNA(INTSXP) #undef COL_MEANS_IMPL_RMNA // ColMeans // Input with template parameter NA = false // ColMeansImpl<..., NA_RM = false> // template class ColMeansImpl : public ColMeansImpl {}; } // sugar template inline typename sugar::detail::RowSumsReturn::type rowSums(const MatrixBase& x, bool na_rm = false) { if (!na_rm) { return sugar::RowSumsImpl(x); } return sugar::RowSumsImpl(x); } template inline typename sugar::detail::ColSumsReturn::type colSums(const MatrixBase& x, bool na_rm = false) { if (!na_rm) { return sugar::ColSumsImpl(x); } return sugar::ColSumsImpl(x); } template inline typename sugar::detail::RowMeansReturn::type rowMeans(const MatrixBase& x, bool na_rm = false) { if (!na_rm) { return sugar::RowMeansImpl(x); } return sugar::RowMeansImpl(x); } template inline typename sugar::detail::ColMeansReturn::type colMeans(const MatrixBase& x, bool na_rm = false) { if (!na_rm) { return sugar::ColMeansImpl(x); } return sugar::ColMeansImpl(x); } } // Rcpp #endif // Rcpp__sugar__rowSums_h Rcpp/inst/include/Rcpp/sugar/functions/Lazy.h0000644000176200001440000000211712336231761020710 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // Lazy.h: Rcpp R/C++ interface class library -- Lazy // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__Lazy_h #define Rcpp__sugar__Lazy_h namespace Rcpp{ namespace sugar{ template class Lazy { public: inline operator T() const { return static_cast(*this).get() ; } } ; } } #endif Rcpp/inst/include/Rcpp/sugar/functions/strings/0000755000176200001440000000000013103613705021303 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/functions/strings/trimws.h0000644000176200001440000001271113103613705023003 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // trimws.h: Rcpp R/C++ interface class library -- trimws // // Copyright (C) 2017 Nathan Russell // // 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 . #ifndef Rcpp__sugar__trimws_h #define Rcpp__sugar__trimws_h #include #include namespace Rcpp { namespace sugar { namespace detail { /* NB: std::isspace is not used because it also counts '\f' and '\v' as whitespace, whereas base::trimws only checks for ' ', '\t', '\r', and '\n' */ inline bool isws(const char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } inline const char* trim_left(const char* str) { if (!str) { return ""; } while (isws(*str)) { ++str; } return str; } inline const char* trim_right(const char* str, R_len_t sz, std::string* buff) { if (!str) { return ""; } buff->clear(); const char* ptr = str + sz - 1; for (; ptr > str && isws(*ptr); --sz, --ptr); buff->append(str, sz - isws(*ptr)); return buff->c_str(); } inline const char* trim_both(const char* str, R_len_t sz, std::string* buff) { if (!str) { return ""; } buff->clear(); while (isws(*str)) { ++str; --sz; } const char* ptr = str + sz - 1; for (; ptr > str && isws(*ptr); --sz, --ptr); buff->append(str, sz); return buff->c_str(); } } // detail } // sugar inline Vector trimws(const Vector& x, const char* which = "both") { R_xlen_t i = 0, sz = x.size(); Vector res = no_init(sz); std::string buffer; if (*which == 'b') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_both( x[i], LENGTH(x[i]), &buffer ); } } } else if (*which == 'l') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_left(x[i]); } } } else if (*which == 'r') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_right( x[i], LENGTH(x[i]), &buffer ); } } } else { stop("Invalid `which` argument '%s'!", which); return Vector::create("Unreachable"); } return res; } inline Matrix trimws(const Matrix& x, const char* which = "both") { R_xlen_t i = 0, sz = x.size(); int nr = x.nrow(), nc = x.ncol(); Matrix res = no_init(nr, nc); std::string buffer; if (*which == 'b') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_both( x[i], LENGTH(x[i]), &buffer ); } } } else if (*which == 'l') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_left(x[i]); } } } else if (*which == 'r') { for (; i < sz; i++) { if (traits::is_na(x[i])) { res[i] = x[i]; } else { res[i] = sugar::detail::trim_right( x[i], LENGTH(x[i]), &buffer ); } } } else { stop("Invalid `which` argument '%s'!", which); return Matrix(); } return res; } inline String trimws(const String& str, const char* which = "both") { std::string buffer; if (*which == 'b') { if (traits::is_na(str.get_sexp())) { return String(str.get_sexp()); } return sugar::detail::trim_both( str.get_cstring(), LENGTH(str.get_sexp()), &buffer ); } if (*which == 'l') { if (traits::is_na(str.get_sexp())) { return String(str.get_sexp()); } return sugar::detail::trim_left(str.get_cstring()); } if (*which == 'r') { if (traits::is_na(str.get_sexp())) { return String(str.get_sexp()); } return sugar::detail::trim_right( str.get_cstring(), LENGTH(str.get_sexp()), &buffer ); } stop("Invalid `which` argument '%s'!", which); return String("Unreachable"); } } // Rcpp #endif // Rcpp__sugar__trimws_h Rcpp/inst/include/Rcpp/sugar/functions/strings/strings.h0000644000176200001440000000204413077226144023154 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // strings.h: Rcpp R/C++ interface class library -- string sugar functions // // Copyright (C) 2012 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 . #ifndef RCPP_SUGAR_FUNCTIONS_STRINGS_H #define RCPP_SUGAR_FUNCTIONS_STRINGS_H #include #include #endif Rcpp/inst/include/Rcpp/sugar/functions/strings/collapse.h0000644000176200001440000000273012535036334023265 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // collapse.h: Rcpp R/C++ interface class library -- string sugar functions // // Copyright (C) 2012 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 . #ifndef RCPP_SUGAR_FUNCTIONS_COLLAPSE_H #define RCPP_SUGAR_FUNCTIONS_COLLAPSE_H namespace Rcpp{ namespace sugar { template inline String collapse__impl( Iterator it, R_xlen_t n ){ static String buffer ; buffer = "" ; for( R_xlen_t i=0; i inline String collapse( const VectorBase& vec ){ return sugar::collapse__impl( vec.get_ref().begin(), vec.size() ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/functions/setdiff.h0000644000176200001440000001411514771655440021427 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // setdiff.h: Rcpp R/C++ interface class library -- setdiff // // Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__setdiff_h #define Rcpp__sugar__setdiff_h namespace Rcpp{ namespace sugar{ template class RemoveFromSet { public: RemoveFromSet( SET& set_) : set(set_){} template void operator()(T value){ set.erase( value ); } private: SET& set ; } ; template class SetDiff { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; SetDiff( const LHS_T& lhs, const RHS_T& rhs) : lhs_set( get_const_begin(lhs), get_const_end(lhs) ), rhs_set( get_const_begin(rhs), get_const_end(rhs) ) { std::for_each( rhs_set.begin(), rhs_set.end(), RemoveFromSet(lhs_set) ) ; } Vector get() const { R_xlen_t n = lhs_set.size() ; Vector out = no_init(n) ; std::copy( lhs_set.begin(), lhs_set.end(), out.begin() ) ; return out ; } private: typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET lhs_set ; SET rhs_set ; } ; template class SetEqual { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; SetEqual( const LHS_T& lhs, const RHS_T& rhs) : lhs_set( get_const_begin(lhs), get_const_end(lhs) ), rhs_set( get_const_begin(rhs), get_const_end(rhs) ) { } bool get() const { if( lhs_set.size() != rhs_set.size() ) return false ; ITERATOR it = lhs_set.begin(), end = lhs_set.end(), rhs_end = rhs_set.end() ; for( ; it != end; ){ if( rhs_set.find(*it++) == rhs_end ) return false ; } return true ; } private: typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET lhs_set ; SET rhs_set ; } ; template class Intersect { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Intersect( const LHS_T& lhs, const RHS_T& rhs) : intersect() { SET lhs_set( get_const_begin(lhs), get_const_end(lhs) ) ; SET rhs_set( get_const_begin(rhs), get_const_end(rhs) ) ; ITERATOR end = lhs_set.end() ; ITERATOR rhs_end = rhs_set.end() ; for( ITERATOR it=lhs_set.begin(); it != end; it++){ if( rhs_set.find(*it) != rhs_end ) intersect.insert(*it) ; } } Vector get() const { R_xlen_t n = intersect.size() ; Vector out = no_init(n) ; std::copy( intersect.begin(), intersect.end(), out.begin() ) ; return out ; } private: typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET intersect ; } ; template class Union { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Union( const LHS_T& lhs, const RHS_T& rhs) : result( get_const_begin(lhs), get_const_end(lhs) ) { result.insert( get_const_begin(rhs), get_const_end(rhs) ) ; } Vector get() const { R_xlen_t n = result.size() ; Vector out = no_init(n) ; std::copy( result.begin(), result.end(), out.begin() ) ; return out ; } private: typedef std::unordered_set SET ; typedef typename SET::const_iterator ITERATOR ; SET result ; } ; } // sugar template inline Vector setdiff( const VectorBase& lhs, const VectorBase& rhs ){ return sugar::SetDiff( lhs.get_ref(), rhs.get_ref() ).get() ; } template inline bool setequal( const VectorBase& lhs, const VectorBase& rhs ){ return sugar::SetEqual( lhs.get_ref(), rhs.get_ref() ).get() ; } template inline Vector intersect( const VectorBase& lhs, const VectorBase& rhs ){ return sugar::Intersect( lhs.get_ref(), rhs.get_ref() ).get() ; } // we cannot use "union" because it is a keyword template inline Vector union_( const VectorBase& lhs, const VectorBase& rhs ){ return sugar::Union( lhs.get_ref(), rhs.get_ref() ).get() ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/median.h0000644000176200001440000001670312650522242021230 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // median.h: Rcpp R/C++ interface class library -- median // // Copyright (C) 2016 Dirk Eddelbuettel, Romain Francois, and Nathan Russell // // 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 . #ifndef Rcpp__sugar__median_h #define Rcpp__sugar__median_h namespace Rcpp { namespace sugar { namespace median_detail { // need to return double for integer vectors // (in case of even-length input vector) // and Rcpp::String for STRSXP // also need to return NA_REAL for // integer vector yielding NA result template struct result { typedef typename Rcpp::traits::storage_type::type type; enum { rtype = RTYPE }; }; template <> struct result { typedef double type; enum { rtype = REALSXP }; }; template <> struct result { typedef Rcpp::String type; enum { rtype = STRSXP }; }; // std::nth_element and std::max_element don't // know how to compare Rcomplex values template inline bool less(T lhs, T rhs) { return lhs < rhs; } template<> inline bool less(Rcomplex lhs, Rcomplex rhs) { if (lhs.r < rhs.r) return true; if (lhs.i < rhs.i) return true; return false; } // compiler does not know how to handle // Rcomplex numerator / double denominator // and need explicit cast for INTSXP case inline double half(double lhs) { return lhs / 2.0; } inline double half(int lhs) { return static_cast(lhs) / 2.0; } inline Rcomplex half(Rcomplex lhs) { lhs.r /= 2.0; lhs.i /= 2.0; return lhs; } } // median_detail // base case template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; enum { RESULT_RTYPE = median_detail::result::rtype }; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::clone(xx)) {} operator result_type() { if (x.size() < 1) { return Rcpp::traits::get_na(); } if (Rcpp::any(Rcpp::is_na(x))) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; std::nth_element( x.begin(), x.begin() + n, x.end(), median_detail::less); if (x.size() % 2) return x[n]; return median_detail::half( x[n] + *std::max_element( x.begin(), x.begin() + n, median_detail::less)); } }; // na.rm = TRUE template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; enum { RESULT_RTYPE = median_detail::result::rtype }; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::na_omit(Rcpp::clone(xx))) {} operator result_type() { if (!x.size()) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; std::nth_element( x.begin(), x.begin() + n, x.end(), median_detail::less); if (x.size() % 2) return x[n]; return median_detail::half( x[n] + *std::max_element( x.begin(), x.begin() + n, median_detail::less)); } }; // NA = false template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; enum { RESULT_RTYPE = median_detail::result::rtype }; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::clone(xx)) {} operator result_type() { if (x.size() < 1) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; std::nth_element( x.begin(), x.begin() + n, x.end(), median_detail::less); if (x.size() % 2) return x[n]; return median_detail::half( x[n] + *std::max_element( x.begin(), x.begin() + n, median_detail::less)); } }; // specialize for character vector // due to string_proxy's incompatibility // with certain std:: algorithms; // need to return NA for even-length vectors template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::clone(xx)) {} operator result_type() { if (!(x.size() % 2)) { return Rcpp::traits::get_na(); } if (Rcpp::any(Rcpp::is_na(x))) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; x.sort(); return x[n]; } }; // na.rm = TRUE template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::na_omit(Rcpp::clone(xx))) {} operator result_type() { if (!(x.size() % 2)) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; x.sort(); return x[n]; } }; // NA = false template class Median { public: typedef typename median_detail::result::type result_type; typedef typename Rcpp::traits::storage_type::type stored_type; typedef T VECTOR; private: VECTOR x; public: Median(const VECTOR& xx) : x(Rcpp::clone(xx)) {} operator result_type() { if (!(x.size() % 2)) { return Rcpp::traits::get_na(); } R_xlen_t n = x.size() / 2; x.sort(); return x[n]; } }; } // sugar template inline typename sugar::median_detail::result::type median(const Rcpp::VectorBase& x, bool na_rm = false) { if (!na_rm) return sugar::Median(x); return sugar::Median(x); } } // Rcpp #endif // Rcpp__sugar__median_h Rcpp/inst/include/Rcpp/sugar/functions/rep.h0000644000176200001440000000513513074145201020553 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // rep.h: Rcpp R/C++ interface class library -- rep // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__rep_h #define Rcpp__sugar__rep_h namespace Rcpp{ namespace sugar{ template class Rep : public Rcpp::VectorBase< RTYPE ,NA, Rep > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Rep( const VEC_TYPE& object_, R_xlen_t times_ ) : object(object_), times(times_), n(object_.size()){} inline STORAGE operator[]( R_xlen_t i ) const { return object[ i % n ] ; } inline R_xlen_t size() const { return times * n ; } private: const VEC_TYPE& object ; R_xlen_t times, n ; } ; template class Rep_Single : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype, true, Rep_Single > { public: Rep_Single( const T& x_, R_xlen_t n_) : x(x_), n(n_){} inline T operator[]( R_xlen_t ) const { return x; } inline R_xlen_t size() const { return n ; } private: const T& x ; R_xlen_t n; } ; } // sugar template inline sugar::Rep rep( const VectorBase& t, R_xlen_t n ){ return sugar::Rep( t, n ) ; } inline sugar::Rep_Single rep( const double& x, R_xlen_t n ){ return sugar::Rep_Single( x, n ) ; } inline sugar::Rep_Single rep( const int& x, R_xlen_t n ){ return sugar::Rep_Single( x, n ) ; } inline sugar::Rep_Single rep( const Rbyte& x, R_xlen_t n ){ return sugar::Rep_Single( x, n ) ; } inline sugar::Rep_Single rep( const Rcomplex& x, R_xlen_t n ){ return sugar::Rep_Single( x, n ) ; } inline sugar::Rep_Single rep( const bool& x, R_xlen_t n ){ return sugar::Rep_Single( x, n ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/max.h0000644000176200001440000000464613324633757020600 0ustar liggesusers // max.h: Rcpp R/C++ interface class library -- max // // Copyright (C) 2012 - 2018 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 . #ifndef Rcpp__sugar__max_h #define Rcpp__sugar__max_h namespace Rcpp{ namespace sugar{ template class Max { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Max( const T& obj_) : obj(obj_) {} operator STORAGE() const { R_xlen_t n = obj.size(); if (n == 0) return(static_cast(R_NegInf)); STORAGE max, current ; max = obj[0] ; if( Rcpp::traits::is_na( max ) ) return max ; for( R_xlen_t i=1; i( current ) ) return current; if( current > max ) max = current ; } return max ; } private: const T& obj ; } ; // version for NA = false template class Max { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Max( const T& obj_) : obj(obj_) {} operator STORAGE() const { R_xlen_t n = obj.size(); if (n == 0) return(static_cast(R_NegInf)); STORAGE max, current ; max = obj[0] ; for( R_xlen_t i=1; i max ) max = current ; } return max ; } private: const T& obj ; } ; } // sugar template sugar::Max max( const VectorBase& x){ return sugar::Max(x.get_ref()) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/unique.h0000644000176200001440000000442215101441041021263 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // unique.h: Rcpp R/C++ interface class library -- unique // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__unique_h #define Rcpp__sugar__unique_h namespace Rcpp{ namespace sugar{ template class InSet { typedef typename HASH::STORAGE STORAGE ; public: InSet( const HASH& hash_ ) : hash(hash_){} inline int operator()(STORAGE value){ return hash.contains(value) ; } private: const HASH& hash ; } ; template class In { Vector vec ; typedef sugar::IndexHash HASH ; HASH hash ; public: In( const TABLE_T& table) : vec(table), hash(vec){ hash.fill() ; } template LogicalVector get( const T& x) const { return LogicalVector( x.begin(), x.end(), InSet(hash) ) ; } } ; } // sugar template inline Vector unique( const VectorBase& t ){ Vector vec(t) ; sugar::IndexHash hash(vec) ; hash.fill() ; return hash.keys() ; } template inline Vector sort_unique( const VectorBase& t , bool decreasing = false){ return unique( t ).sort(decreasing) ; } template inline LogicalVector in( const VectorBase& x, const VectorBase& table ){ typedef VectorBase TABLE_T ; return sugar::In(table).get( x.get_ref() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/is_finite.h0000644000176200001440000000304312535036334021741 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is_finite.h: Rcpp R/C++ interface class library -- is_finite // // Copyright (C) 2013 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 . #ifndef Rcpp__sugar__is_finite_h #define Rcpp__sugar__is_finite_h namespace Rcpp{ namespace sugar{ template class IsFinite : public ::Rcpp::VectorBase< LGLSXP, false, IsFinite > { public: IsFinite( const VEC_TYPE& obj_) : obj(obj_){} inline int operator[]( R_xlen_t i ) const { return ::Rcpp::traits::is_finite( obj[i] ) ; } inline R_xlen_t size() const { return obj.size() ; } private: const VEC_TYPE& obj ; } ; } // sugar template inline sugar::IsFinite is_finite( const Rcpp::VectorBase& t){ return sugar::IsFinite( t.get_ref() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/tail.h0000644000176200001440000000342412535036334020724 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // tail.h: Rcpp R/C++ interface class library -- tail // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__tail_h #define Rcpp__sugar__tail_h namespace Rcpp{ namespace sugar{ template class Tail : public Rcpp::VectorBase< RTYPE ,NA, Tail > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Tail( const VEC_TYPE& object_, R_xlen_t n_ ) : object(object_), start(0), n(n_) { if( n > 0 ){ start = object.size() - n ; } else { start = -n ; n = object.size() - start ; } } inline STORAGE operator[]( R_xlen_t i ) const { return object[ start + i ] ; } inline R_xlen_t size() const { return n; } private: const VEC_TYPE& object ; R_xlen_t start, n ; } ; } // sugar template inline sugar::Tail tail( const VectorBase& t, R_xlen_t n ){ return sugar::Tail( t, n ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/diff.h0000644000176200001440000001015112535036334020676 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // diff.h: Rcpp R/C++ interface class library -- diff // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__sugar__diff_h #define Rcpp__sugar__diff_h namespace Rcpp{ namespace sugar{ // NOTE: caching the previous value so that we only have to fetch the // value once only works because we process the object from left to // right template class Diff : public Rcpp::VectorBase< RTYPE, LHS_NA , Diff > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs_[0]), previous_index(0), was_na(traits::is_na(previous)) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE y = lhs[i+1] ; if( previous_index != i ){ // we don't know the previous value, we need to get it. set_previous(i, lhs[i] ) ; // record the current value } if( was_na || traits::is_na(y) ) { set_previous(i+1, y ) ; return traits::get_na() ; // NA } STORAGE res = y - previous ; set_previous( i+1, y) ; return res ; } inline void set_previous(R_xlen_t i, STORAGE value) const { previous = value ; was_na = traits::is_na(previous) ; previous_index = i ; } inline R_xlen_t size() const { return lhs.size() - 1 ; } private: const LHS_TYPE& lhs ; mutable STORAGE previous ; mutable R_xlen_t previous_index ; mutable bool was_na ; } ; template class Diff : public Rcpp::VectorBase< REALSXP, LHS_NA, Diff >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs_[0]), previous_index(0) {} inline double operator[]( R_xlen_t i ) const { double y = lhs[i+1] ; if( previous_index != i ) previous = lhs[i] ; double res = y - previous ; previous = y ; previous_index = i+1 ; return res ; } inline R_xlen_t size() const { return lhs.size() - 1 ; } private: const LHS_TYPE& lhs ; mutable double previous ; mutable R_xlen_t previous_index ; } ; template class Diff : public Rcpp::VectorBase< RTYPE, false , Diff > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Diff( const LHS_TYPE& lhs_ ) : lhs(lhs_), previous(lhs[0]), previous_index(0) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE y = lhs[i+1] ; if( previous_index != i ) previous = lhs[i] ; STORAGE diff = y - previous ; previous = y ; previous_index = i+1 ; return y - previous ; } inline R_xlen_t size() const { return lhs.size() - 1 ; } private: const LHS_TYPE& lhs ; mutable STORAGE previous ; mutable R_xlen_t previous_index ; } ; } // sugar template inline sugar::Diff diff( const VectorBase& lhs ){ return sugar::Diff( lhs ) ; } template inline sugar::Diff diff( const VectorBase& lhs ){ return sugar::Diff( lhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/all.h0000644000176200001440000000435512535036334020547 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // all.h: Rcpp R/C++ interface class library -- all // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__sugar__all_h #define Rcpp__sugar__all_h namespace Rcpp{ namespace sugar{ template class All : public SingleLogicalResult< true, All >{ public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef SingleLogicalResult< true, All > PARENT ; All( const VEC_TYPE& t ) : PARENT() , object(t) {} void apply(){ R_xlen_t n = object.size() ; int current = 0 ; PARENT::reset() ; for( R_xlen_t i=0 ; i(current) ) { PARENT::set_na(); } } if( PARENT::is_unresolved() ){ PARENT::set_true() ; } } private: const VEC_TYPE& object ; } ; template class All : public SingleLogicalResult< false, All >{ public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef SingleLogicalResult< false, All > PARENT ; All( const VEC_TYPE& t ) : PARENT() , object(t) {} void apply(){ R_xlen_t n = object.size() ; PARENT::set_true() ; for( R_xlen_t i=0 ; i inline sugar::All all( const Rcpp::VectorBase& t){ return sugar::All( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/cumsum.h0000644000176200001440000000410312535036334021277 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // cumsum.h: Rcpp R/C++ interface class library -- cumsum // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__cumsum_h #define Rcpp__sugar__cumsum_h namespace Rcpp{ namespace sugar{ template class Cumsum : public Lazy< Rcpp::Vector , Cumsum > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef Rcpp::Vector VECTOR ; Cumsum( const VEC_TYPE& object_ ) : object(object_){} VECTOR get() const { R_xlen_t n = object.size() ; VECTOR result( n, Rcpp::traits::get_na() ) ; STORAGE current = object[0] ; if( Rcpp::traits::is_na(current) ) return result ; result[0] = current ; for( R_xlen_t i=1; i(current) ) return result ; result[i] = result[i-1] + current ; } return result ; } private: const VEC_TYPE& object ; } ; } // sugar template inline sugar::Cumsum cumsum( const VectorBase& t){ return sugar::Cumsum( t ) ; } template inline sugar::Cumsum cumsum( const VectorBase& t){ return sugar::Cumsum( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/pmin.h0000644000176200001440000001165012535036334020736 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // pmin.h: Rcpp R/C++ interface class library -- pmin // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__pmin_h #define Rcpp__sugar__pmin_h namespace Rcpp{ namespace sugar{ template struct pmin_op ; // specializations for double. // we use the fact that NA < x is false template <> struct pmin_op{ inline double operator()( double left, double right ) const { return ( Rcpp::traits::is_na( left ) || (left < right) ) ? left : right ; } } ; template <> struct pmin_op { inline double operator()( double left, double right ) const { return right < left ? right : left ; } } ; template <> struct pmin_op { inline double operator()( double left, double right ) const { return right < left ? right : left ; } } ; template <> struct pmin_op { inline double operator()( double left, double right ) const { return left < right ? left : right ; } } ; // specializations for INTSXP. Since NA is represented as the smallest // int, NA is always the smallest, so it is safe to return NA template struct pmin_op { inline int operator()(int left, int right) const { return left < right ? left : right ; } } ; // general case template class pmin_op_Vector_Primitive { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; pmin_op_Vector_Primitive( STORAGE right_ ) : right(right_) {} inline STORAGE operator()( STORAGE left ) const { return left < right ? left : right ; } private: STORAGE right ; } ; // only special case we need to take care of template <> class pmin_op_Vector_Primitive { public: pmin_op_Vector_Primitive( double right_ ) : right(right_) {} inline double operator()( double left ) const { return ( Rcpp::traits::is_na( left ) || (left < right) ) ? left : right ; } private: double right ; } ; template < int RTYPE, bool LHS_NA, typename LHS_T, bool RHS_NA, typename RHS_T > class Pmin_Vector_Vector : public VectorBase< RTYPE , ( LHS_NA || RHS_NA ) , Pmin_Vector_Vector > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef pmin_op OPERATOR ; Pmin_Vector_Vector( const LHS_T& lhs_, const RHS_T& rhs_ ) : lhs(lhs_), rhs(rhs_), op() {} inline STORAGE operator[]( R_xlen_t i ) const { return op( lhs[i], rhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_T& lhs ; const RHS_T& rhs ; OPERATOR op ; } ; template < int RTYPE, bool LHS_NA, typename LHS_T > class Pmin_Vector_Primitive : public VectorBase< RTYPE , true , Pmin_Vector_Primitive > { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef pmin_op_Vector_Primitive OPERATOR ; Pmin_Vector_Primitive( const LHS_T& lhs_, STORAGE rhs_ ) : lhs(lhs_), op(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { return op( lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_T& lhs ; OPERATOR op ; } ; } // sugar template < int RTYPE, bool LHS_NA, typename LHS_T, bool RHS_NA, typename RHS_T > inline sugar::Pmin_Vector_Vector pmin( const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs ){ return sugar::Pmin_Vector_Vector( lhs.get_ref(), rhs.get_ref() ) ; } template < int RTYPE, bool LHS_NA, typename LHS_T > inline sugar::Pmin_Vector_Primitive pmin( const Rcpp::VectorBase& lhs, typename Rcpp::traits::storage_type::type rhs ){ return sugar::Pmin_Vector_Primitive( lhs.get_ref(), rhs ) ; } template < int RTYPE, bool RHS_NA, typename RHS_T > inline sugar::Pmin_Vector_Primitive pmin( typename Rcpp::traits::storage_type::type lhs, const Rcpp::VectorBase& rhs ){ return sugar::Pmin_Vector_Primitive( rhs.get_ref(), lhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/seq_along.h0000644000176200001440000000306712535036334021746 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // seq_along.h: Rcpp R/C++ interface class library -- any // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__seq_along_h #define Rcpp__sugar__seq_along_h namespace Rcpp{ namespace sugar{ class SeqLen : public VectorBase< INTSXP,false,SeqLen > { public: SeqLen( R_xlen_t len_ ) : len(len_){} inline R_xlen_t operator[]( R_xlen_t i ) const { return 1 + i ; } inline R_xlen_t size() const { return len ; } private: R_xlen_t len ; } ; } // sugar template inline sugar::SeqLen seq_along( const Rcpp::VectorBase& t){ return sugar::SeqLen( t.size() ) ; } inline sugar::SeqLen seq_len( const size_t& n){ return sugar::SeqLen( n ) ; } inline Range seq(R_xlen_t start, R_xlen_t end){ return Range( start, end ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/cummax.h0000644000176200001440000000432112615210414021252 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // cumsum.h: Rcpp R/C++ interface class library -- cumsum // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__cummax_h #define Rcpp__sugar__cummax_h namespace Rcpp{ namespace sugar{ template class Cummax : public Lazy< Rcpp::Vector, Cummax > { public: typedef typename Rcpp::VectorBase VEC_TYPE; typedef typename Rcpp::traits::storage_type::type STORAGE; typedef Rcpp::Vector VECTOR; Cummax(const VEC_TYPE& object_) : object(object_) {} VECTOR get() const { R_xlen_t n = object.size(); VECTOR result(n, Rcpp::traits::get_na()); STORAGE current = object[0]; if (Rcpp::traits::is_na(current)) return result; result[0] = current; for (R_xlen_t i = 1; i < n; i++) { current = object[i]; if (Rcpp::traits::is_na(current)) return result; result[i] = result[i-1] > current ? result[i-1] : current; } return result ; } private: const VEC_TYPE& object; }; } // sugar template inline sugar::Cummax cummax(const VectorBase& t) { return sugar::Cummax(t); } template inline sugar::Cummax cummax(const VectorBase& t) { return sugar::Cummax(t); } } // Rcpp #endif // Rcpp__sugar__cummax_h Rcpp/inst/include/Rcpp/sugar/functions/range.h0000644000176200001440000000521512535036334021067 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // range.h: Rcpp R/C++ interface class library -- range // // Copyright (C) 2012 - 2013 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 . #ifndef Rcpp__sugar__range_h #define Rcpp__sugar__range_h namespace Rcpp{ namespace sugar{ template class Range { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Range( const T& obj_) : obj(obj_) {} operator Vector(){ min_ = max_ = obj[0] ; if( Rcpp::traits::is_na( min_ ) ) return Vector::create( min_, max_ ) ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i( current ) ) return Vector::create( min_, max_ ) ; if( current < min_ ) min_ = current ; if( current > max_ ) max_ = current ; } return Vector::create( min_, max_ ) ; } private: const T& obj ; STORAGE min_, max_, current ; } ; // version for NA = false template class Range { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; Range( const T& obj_) : obj(obj_) {} operator Vector(){ min_ = max_ = obj[0] ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i max_ ) max_ = current ; } return Vector::create( min_, max_ ) ; } private: const T& obj ; STORAGE min_, max_, current ; } ; } // sugar template sugar::Range range( const VectorBase& x){ return sugar::Range(x.get_ref()) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/which_min.h0000644000176200001440000000470312535036334021741 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // which_min.h: Rcpp R/C++ interface class library -- which.min // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__which_min_h #define Rcpp__sugar__which_min_h namespace Rcpp{ namespace sugar{ template class WhichMin { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; WhichMin(const VEC_TYPE& obj_ ) : obj(obj_){} R_xlen_t get() const { STORAGE current = obj[0] ; STORAGE min = current ; R_xlen_t index = 0 ; if( Rcpp::traits::is_na(current) ) return NA_INTEGER ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i(current) ) return NA_INTEGER ; if( current < min ){ min = current ; index = i ; } } return index ; } private: const VEC_TYPE& obj ; } ; template class WhichMin { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; WhichMin(const VEC_TYPE& obj_ ) : obj(obj_){} R_xlen_t get() const { STORAGE current = obj[0] ; STORAGE min = current ; R_xlen_t index = 0 ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i R_xlen_t which_min( const VectorBase& t ){ return sugar::WhichMin(t).get() ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/self_match.h0000644000176200001440000000435714771655440022117 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // self_match.h: Rcpp R/C++ interface class library -- self match // // Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__self_match_h #define Rcpp__sugar__self_match_h namespace Rcpp{ namespace sugar{ template class SelfInserter { public: SelfInserter( HASH& hash_ ) : hash(hash_), index(0) {} inline R_xlen_t operator()( STORAGE value ){ typename HASH::iterator it = hash.find( value ) ; if( it == hash.end() ){ hash.insert( std::make_pair(value, ++index) ) ; return index ; } else { return it->second ; } } private: HASH& hash ; R_xlen_t index; } ; template class SelfMatch { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; SelfMatch( const TABLE_T& table ): hash(), result(table.size()) { std::transform( table.begin(), table.end(), result.begin(), Inserter(hash) ) ; } inline operator IntegerVector() const { return result ; } private: typedef std::unordered_map HASH ; typedef SelfInserter Inserter ; HASH hash ; IntegerVector result ; }; } // sugar template inline IntegerVector self_match( const VectorBase& x ){ Vector vec(x) ; return sugar::SelfHash(vec).fill_and_self_match() ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/duplicated.h0000644000176200001440000000225312316773510022111 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // duplicated.h: Rcpp R/C++ interface class library -- duplicated // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__duplicated_h #define Rcpp__sugar__duplicated_h namespace Rcpp{ template inline LogicalVector duplicated( const VectorBase& x ){ Vector vec(x) ; sugar::IndexHash hash(vec) ; return hash.fill_and_get_duplicated() ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/math.h0000644000176200001440000000534012445015064020720 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_MATH_H #define RCPP_SUGAR_MATH_H VECTORIZED_MATH_1(exp,::exp) VECTORIZED_MATH_1(acos,::acos) VECTORIZED_MATH_1(asin,::asin) VECTORIZED_MATH_1(atan,::atan) VECTORIZED_MATH_1(ceil,::ceil) VECTORIZED_MATH_1(ceiling,::ceil) VECTORIZED_MATH_1(cos,::cos) VECTORIZED_MATH_1(cosh,::cosh) VECTORIZED_MATH_1(floor,::floor) VECTORIZED_MATH_1(log,::log) VECTORIZED_MATH_1(log10,::log10) VECTORIZED_MATH_1(sqrt,::sqrt) VECTORIZED_MATH_1(sin,::sin) VECTORIZED_MATH_1(sinh,::sinh) VECTORIZED_MATH_1(tan,::tan) VECTORIZED_MATH_1(tanh,::tanh) VECTORIZED_MATH_1(abs,::fabs) VECTORIZED_MATH_1(gamma , ::Rf_gammafn ) VECTORIZED_MATH_1(lgamma , ::Rf_lgammafn ) VECTORIZED_MATH_1(digamma , ::Rf_digamma ) VECTORIZED_MATH_1(trigamma , ::Rf_trigamma ) VECTORIZED_MATH_1(tetragamma , ::Rf_tetragamma ) VECTORIZED_MATH_1(pentagamma , ::Rf_pentagamma ) VECTORIZED_MATH_1(expm1 , ::expm1 ) VECTORIZED_MATH_1(log1p , ::log1p ) namespace Rcpp{ namespace internal{ extern "C" inline double factorial( double x ){ return ::Rf_gammafn( x + 1.0 ) ; } extern "C" inline double lfactorial( double x ){ return ::Rf_lgammafn( x + 1.0 ) ; } } } VECTORIZED_MATH_1(factorial , ::Rcpp::internal::factorial ) VECTORIZED_MATH_1(lfactorial , ::Rcpp::internal::lfactorial ) SUGAR_BLOCK_2(choose , ::Rf_choose ) SUGAR_BLOCK_2(lchoose , ::Rf_lchoose ) SUGAR_BLOCK_2(beta , ::Rf_beta ) SUGAR_BLOCK_2(lbeta , ::Rf_lbeta ) SUGAR_BLOCK_2(psigamma , ::Rf_psigamma ) VECTORIZED_MATH_1(trunc, ::Rf_ftrunc) // truncates to zero (cf Writing R Extension, 6.7.3 Numerical Utilities) SUGAR_BLOCK_2(round, ::Rf_fround) // rounds 'x' to 'digits' decimals digits (used by R's round()) SUGAR_BLOCK_2(signif, ::Rf_fprec) // rounds 'x' to 'digits' significant digits (used by R's signif()) #endif Rcpp/inst/include/Rcpp/sugar/functions/any.h0000644000176200001440000000433012535036334020557 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // any.h: Rcpp R/C++ interface class library -- any // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__any_h #define Rcpp__sugar__any_h namespace Rcpp{ namespace sugar{ template class Any : public SingleLogicalResult< true, Any >{ public: typedef Rcpp::VectorBase VEC_TYPE ; typedef SingleLogicalResult< true , Any > PARENT ; Any( const VEC_TYPE& t ) : PARENT() , object(t) {} void apply(){ R_xlen_t n = object.size() ; int current = 0 ; PARENT::reset() ; for( R_xlen_t i=0 ; i(current) ) { PARENT::set_na(); } } if( PARENT::is_unresolved() ){ PARENT::set_false() ; } } private: const VEC_TYPE& object ; } ; template class Any : public SingleLogicalResult< false, Any >{ public: typedef Rcpp::VectorBase VEC_TYPE ; typedef SingleLogicalResult< false , Any > PARENT ; Any( const VEC_TYPE& t ) : PARENT() , object(t) {} void apply(){ R_xlen_t n = object.size() ; PARENT::set_false() ; for( R_xlen_t i=0 ; i inline sugar::Any any( const Rcpp::VectorBase& t){ return sugar::Any( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/rep_each.h0000644000176200001440000000336412535036334021544 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // rep_each.h: Rcpp R/C++ interface class library -- rep_each // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__rep_each_h #define Rcpp__sugar__rep_each_h namespace Rcpp{ namespace sugar{ template class Rep_each : public Rcpp::VectorBase< RTYPE ,NA, Rep_each > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Rep_each( const VEC_TYPE& object_, R_xlen_t times_ ) : object(object_), times(times_), n(object.size()) {} inline STORAGE operator[]( R_xlen_t i ) const { return object[ i / times ] ; } inline R_xlen_t size() const { return n * times ; } private: const VEC_TYPE& object ; R_xlen_t times, n ; } ; } // sugar template inline sugar::Rep_each rep_each( const VectorBase& t, R_xlen_t times ){ return sugar::Rep_each( t, times ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/na_omit.h0000644000176200001440000000502112730355576021425 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // na_omit.h: Rcpp R/C++ interface class library -- na_omit // // Copyright (C) 2013 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 . #ifndef Rcpp__sugar__na_omit_h #define Rcpp__sugar__na_omit_h namespace Rcpp{ namespace sugar{ template Vector na_omit_impl(const T& x, Rcpp::traits::false_type ) { R_xlen_t n = x.size() ; R_xlen_t n_out = n - sum( is_na(x) ) ; if( n_out == n ) return x ; Vector out = no_init(n_out) ; for( R_xlen_t i=0, j=0; i::is_na( x[i] ) ) continue ; out[j++] = x[i]; } return out ; } template Vector na_omit_impl(const T& x, Rcpp::traits::true_type ) { R_xlen_t n = x.size() ; R_xlen_t n_out = n - sum( is_na(x) ) ; if( n_out == n ) return x; Vector out = no_init(n_out) ; bool has_name = x.attr("names") != R_NilValue ; if( has_name ){ CharacterVector names = x.attr("names") ; CharacterVector onames( n_out ) ; for( R_xlen_t i=0, j=0; i::is_na( x[i] ) ) continue ; onames[j] = names[i] ; out[j++] = x[i]; } out.attr("names") = onames ; } else { for( R_xlen_t i=0, j=0; i::is_na( x[i] ) ) continue ; out[j++] = x[i]; } } return out ; } } // sugar template inline Vector na_omit( const VectorBase& t){ return sugar::na_omit_impl( t.get_ref(), typename Rcpp::traits::same_type >::type() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/functions.h0000644000176200001440000000600614356652371022012 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // functions.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2013 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 . #ifndef RCPP_SUGAR_FUNCTIONS_H #define RCPP_SUGAR_FUNCTIONS_H /* for exp( double ) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif Rcpp/inst/include/Rcpp/sugar/functions/sapply.h0000644000176200001440000000740314772603376021317 0ustar liggesusers // sapply.h: Rcpp R/C++ interface class library -- sapply // // Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__sapply_h #define Rcpp__sugar__sapply_h namespace Rcpp{ namespace sugar{ template class Sapply : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Sapply > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; const static int RESULT_R_TYPE = Rcpp::traits::r_sexptype_traits::rtype ; typedef Rcpp::VectorBase VEC ; typedef typename Rcpp::traits::r_vector_element_converter::type converter_type ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Sapply( const VEC& vec_, Function fun_ ) : vec(vec_.get_ref()), fun(fun_){ RCPP_DEBUG_1( "Sapply With Converter = %s", DEMANGLE(Sapply) ) RCPP_DEBUG_1( "Sapply Converter = %s", DEMANGLE(converter_type) ) } inline STORAGE operator[]( R_xlen_t i ) const { STORAGE res = converter_type::get( fun( vec[i] ) ); return res ; } inline R_xlen_t size() const { return vec.size() ; } private: const EXT& vec ; Function fun ; } ; template class Sapply : public VectorBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Sapply > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; const static int RESULT_R_TYPE = Rcpp::traits::r_sexptype_traits::rtype ; typedef Rcpp::VectorBase VEC ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Sapply( const VEC& vec_, Function fun_ ) : vec(vec_.get_ref()), fun(fun_){ RCPP_DEBUG_1( "Sapply = %s", DEMANGLE(Sapply) ) } inline STORAGE operator[]( R_xlen_t i ) const { return fun( vec[i] ) ; } inline R_xlen_t size() const { return vec.size() ; } private: const EXT& vec ; Function fun ; } ; } // sugar template inline sugar::Sapply< RTYPE,NA,T,Function, traits::same_type< typename ::Rcpp::traits::result_of::type , typename Rcpp::traits::storage_type< traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype >::type >::value > sapply( const Rcpp::VectorBase& t, Function fun ){ return sugar::Sapply::type , typename Rcpp::traits::storage_type< traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype >::type >::value >( t, fun ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/which_max.h0000644000176200001440000000470312535036334021743 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // which_max.h: Rcpp R/C++ interface class library -- which.max // // Copyright (C) 2012 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 . #ifndef Rcpp__sugar__which_max_h #define Rcpp__sugar__which_max_h namespace Rcpp{ namespace sugar{ template class WhichMax { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; WhichMax(const VEC_TYPE& obj_ ) : obj(obj_){} R_xlen_t get() const { STORAGE current = obj[0] ; STORAGE min = current ; R_xlen_t index = 0 ; if( Rcpp::traits::is_na(current) ) return NA_INTEGER ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i(current) ) return NA_INTEGER ; if( current > min ){ min = current ; index = i ; } } return index ; } private: const VEC_TYPE& obj ; } ; template class WhichMax { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; WhichMax(const VEC_TYPE& obj_ ) : obj(obj_){} R_xlen_t get() const { STORAGE current = obj[0] ; STORAGE min = current ; R_xlen_t index = 0 ; R_xlen_t n = obj.size() ; for( R_xlen_t i=1; i min ){ min = current ; index = i ; } } return index ; } private: const VEC_TYPE& obj ; } ; } // sugar template R_xlen_t which_max( const VectorBase& t ){ return sugar::WhichMax(t).get() ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/rev.h0000644000176200001440000000316412535036334020570 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // rev.h: Rcpp R/C++ interface class library -- rev // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__rev_h #define Rcpp__sugar__rev_h namespace Rcpp{ namespace sugar{ template class Rev : public Rcpp::VectorBase< RTYPE ,NA, Rev > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Rev( const VEC_TYPE& object_ ) : object(object_), n(object_.size() - 1) {} inline STORAGE operator[]( R_xlen_t i ) const { return object[n - i] ; } inline R_xlen_t size() const { return n + 1; } private: const VEC_TYPE& object ; R_xlen_t n ; } ; } // sugar template inline sugar::Rev rev( const VectorBase& t){ return sugar::Rev( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/functions/lapply.h0000644000176200001440000000346314772603376021312 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // lapply.h: Rcpp R/C++ interface class library -- lapply // // Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__lapply_h #define Rcpp__sugar__lapply_h namespace Rcpp{ namespace sugar{ template class Lapply : public VectorBase< VECSXP , true , Lapply > { public: typedef Rcpp::VectorBase VEC ; typedef typename ::Rcpp::traits::result_of::type result_type ; Lapply( const VEC& vec_, Function fun_ ) : vec(vec_), fun(fun_){} inline SEXP operator[]( R_xlen_t i ) const { return Rcpp::wrap( fun( vec[i] ) ); } inline R_xlen_t size() const { return vec.size() ; } private: const VEC& vec ; Function fun ; } ; } // sugar template inline sugar::Lapply lapply( const Rcpp::VectorBase& t, Function fun ){ return sugar::Lapply( t, fun ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/operators/0000755000176200001440000000000012716501067017626 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/operators/logical_operators__Vector__Vector.h0000644000176200001440000000730712316773510026660 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // logical_operators__Vector__Vector.h: Rcpp R/C++ interface class library -- // logical operators for Vector to Vector comparisons // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__logical_operators__Vector__Vector_h #define Rcpp__sugar__logical_operators__Vector__Vector_h /* Vector < Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::less, LHS_NA, LHS_T, RHS_NA, RHS_T > operator<( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::less, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } /* Vector > Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::greater, LHS_NA, LHS_T, RHS_NA, RHS_T > operator>( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::greater, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } /* Vector <= Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::less_or_equal, LHS_NA, LHS_T, RHS_NA, RHS_T > operator<=( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::less_or_equal, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } /* Vector >= Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::greater_or_equal, LHS_NA, LHS_T, RHS_NA, RHS_T > operator>=( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::greater_or_equal, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } /* Vector == Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::equal, LHS_NA, LHS_T, RHS_NA, RHS_T > operator==( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::equal, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } /* Vector != Vector */ template inline Rcpp::sugar::Comparator< RTYPE , Rcpp::sugar::not_equal, LHS_NA, LHS_T, RHS_NA, RHS_T > operator!=( const Rcpp::VectorBase& lhs , const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Comparator< RTYPE, Rcpp::sugar::not_equal, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } #endif Rcpp/inst/include/Rcpp/sugar/operators/operators.h0000644000176200001440000000271412316773510022021 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // any.h: Rcpp R/C++ interface class library -- any // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__operators__operators_h #define Rcpp__sugar__operators__operators_h // binary operators #include #include #include #include #include #include #include #include // unary operators #include #include #endif Rcpp/inst/include/Rcpp/sugar/operators/minus.h0000644000176200001440000003521712716501067021142 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // minus.h: Rcpp R/C++ interface class library -- operator- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__minus_h #define Rcpp__sugar__minus_h namespace Rcpp{ namespace sugar{ template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; if( Rcpp::traits::is_na( x ) ) return x ; STORAGE y = rhs[i] ; return Rcpp::traits::is_na( y ) ? y : ( x - y ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE y = rhs[i] ; if( Rcpp::traits::is_na( y ) ) return y ; return lhs[i] - y ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; if( Rcpp::traits::is_na( x ) ) return x ; return x - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { return lhs[i] - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Minus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Minus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Minus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( rhs_na ) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x - rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; template class Minus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_){} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; double rhs ; } ; template class Minus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( rhs_na ) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x - rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; template class Minus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_){} inline double operator[]( R_xlen_t i ) const { return lhs[i] - rhs ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; double rhs ; } ; template class Minus_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Primitive_Vector( STORAGE lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()), lhs_na( Rcpp::traits::is_na(lhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( lhs_na ) return lhs ; return lhs - rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: STORAGE lhs ; const VEC_EXT& rhs ; bool lhs_na ; } ; template class Minus_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Primitive_Vector( double lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs - rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: double lhs ; const VEC_EXT& rhs ; } ; template class Minus_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Primitive_Vector( STORAGE lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()), lhs_na( Rcpp::traits::is_na(lhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( lhs_na ) return lhs ; return lhs - rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: STORAGE lhs ; const VEC_EXT& rhs ; bool lhs_na ; } ; template class Minus_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Minus_Primitive_Vector( double lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs - rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: double lhs ; const VEC_EXT& rhs ; } ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Minus_Vector_Primitive< RTYPE , NA, T > >::type operator-( const VectorBase& lhs, const U &rhs ) { return sugar::Minus_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Minus_Primitive_Vector< RTYPE , NA,T> >::type operator-( const U &lhs, const VectorBase& rhs ) { return sugar::Minus_Primitive_Vector( lhs, rhs ) ; } template inline sugar::Minus_Vector_Vector< RTYPE , LHS_NA, LHS_T, RHS_NA, RHS_T > operator-( const VectorBase& lhs, const VectorBase& rhs ) { return sugar::Minus_Vector_Vector< RTYPE, LHS_NA,LHS_T, RHS_NA,RHS_T >( lhs, rhs ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/operators/divides.h0000644000176200001440000003562312716501067021437 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // divides.h: Rcpp R/C++ interface class library -- operator- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__divides_h #define Rcpp__sugar__divides_h namespace Rcpp{ namespace sugar{ template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; if( Rcpp::traits::is_na( x ) ) return x ; STORAGE y = rhs[i] ; return Rcpp::traits::is_na( y ) ? y : ( x / y ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE y = rhs[i] ; if( Rcpp::traits::is_na( y ) ) return y ; return lhs[i] / y ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, false, RHS_T>::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; if( Rcpp::traits::is_na( x ) ) return x ; return x / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { return lhs[i] / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE : REALSXP template class Divides_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Divides_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Divides_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) { } inline STORAGE operator[]( R_xlen_t i ) const { if(rhs_na) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x / rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE : REALSXP template class Divides_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) { } inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; double rhs ; } ; template class Divides_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( rhs_na ) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x / rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE = REALSXP template class Divides_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_), rhs(rhs_){} inline double operator[]( R_xlen_t i ) const { return lhs[i] / rhs ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_EXT& lhs ; double rhs ; } ; template class Divides_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; typedef typename traits::storage_type::type STORAGE ; Divides_Primitive_Vector( STORAGE lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()), lhs_na( Rcpp::traits::is_na(lhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( lhs_na ) return lhs ; STORAGE x = rhs[i] ; return Rcpp::traits::is_na(x) ? x : (lhs / x) ; } inline R_xlen_t size() const { return rhs.size() ; } private: STORAGE lhs ; const VEC_EXT& rhs ; bool lhs_na ; } ; // RTYPE = REALSXP template class Divides_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Primitive_Vector( double lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs / rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: double lhs ; const VEC_EXT& rhs ; } ; template class Divides_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Primitive_Vector( STORAGE lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()), lhs_na( Rcpp::traits::is_na(lhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( lhs_na ) return lhs ; return lhs / rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: STORAGE lhs ; const VEC_EXT& rhs ; bool lhs_na ; } ; // RTYPE = REALSXP template class Divides_Primitive_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Divides_Primitive_Vector( double lhs_, const VEC_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs / rhs[i] ; } inline R_xlen_t size() const { return rhs.size() ; } private: double lhs ; const VEC_EXT& rhs ; } ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Divides_Vector_Primitive< RTYPE , NA, T > >::type operator/( const VectorBase& lhs, const U &rhs ) { return sugar::Divides_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if< traits::is_convertible< typename traits::remove_const_and_reference::type, typename traits::storage_type::type>::value, sugar::Divides_Primitive_Vector< RTYPE , NA,T> >::type operator/( const U &lhs, const VectorBase& rhs ) { return sugar::Divides_Primitive_Vector( lhs, rhs ) ; } template inline sugar::Divides_Vector_Vector< RTYPE , LHS_NA, LHS_T, RHS_NA, RHS_T > operator/( const VectorBase& lhs, const VectorBase& rhs ) { return sugar::Divides_Vector_Vector< RTYPE, LHS_NA,LHS_T, RHS_NA,RHS_T >( lhs, rhs ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/operators/Comparator_With_One_Value.h0000644000176200001440000000573012535036334025042 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // LessThan.h: Rcpp R/C++ interface class library -- vector operators // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__Comparator_With_One_Value_h #define Rcpp__sugar__Comparator_With_One_Value_h namespace Rcpp{ namespace sugar{ template class Comparator_With_One_Value : public ::Rcpp::VectorBase< LGLSXP, true, Comparator_With_One_Value > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef int (Comparator_With_One_Value::*METHOD)(int) const ; Comparator_With_One_Value( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_), rhs(rhs_), m(), op() { m = Rcpp::traits::is_na(rhs) ? &Comparator_With_One_Value::rhs_is_na : &Comparator_With_One_Value::rhs_is_not_na ; } inline int operator[]( R_xlen_t i ) const { return (this->*m)(i) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_TYPE& lhs ; STORAGE rhs ; METHOD m ; Operator op ; inline int rhs_is_na(int i) const { return rhs ; } inline int rhs_is_not_na(int i) const { STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : op( x, rhs ) ; } } ; template class Comparator_With_One_Value : public ::Rcpp::VectorBase< RTYPE, true, Comparator_With_One_Value > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef int (Comparator_With_One_Value::*METHOD)(int) const ; Comparator_With_One_Value( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_), rhs(rhs_), m(), op() { m = Rcpp::traits::is_na(rhs) ? &Comparator_With_One_Value::rhs_is_na : &Comparator_With_One_Value::rhs_is_not_na ; } inline int operator[]( R_xlen_t i ) const { return (this->*m)(i) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_TYPE& lhs ; STORAGE rhs ; METHOD m ; Operator op ; inline int rhs_is_na(int i) const { return rhs ; } inline int rhs_is_not_na(int i) const { return op( lhs[i], rhs ) ; } } ; } // sugar } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/operators/Comparator.h0000644000176200001440000000655512535036334022120 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // LessThan.h: Rcpp R/C++ interface class library -- vector operators // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__Comparator_h #define Rcpp__sugar__Comparator_h namespace Rcpp{ namespace sugar{ template class Comparator : public ::Rcpp::VectorBase< LGLSXP, true, Comparator > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; Comparator( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_), op() {} inline int operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; if( Rcpp::traits::is_na( x ) ) return NA_LOGICAL ; STORAGE y = rhs[i] ; if( Rcpp::traits::is_na( y ) ) return NA_LOGICAL ; return op( x, y ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; Operator op ; } ; template class Comparator : public ::Rcpp::VectorBase< LGLSXP, true, Comparator > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; Comparator( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_), op() {} inline int operator[]( R_xlen_t i ) const { STORAGE y = rhs[i] ; if( Rcpp::traits::is_na( y ) ) return NA_LOGICAL ; return op( lhs[i], y ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; Operator op ; } ; template class Comparator : public ::Rcpp::VectorBase< LGLSXP, true, Comparator > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename traits::storage_type::type STORAGE ; Comparator( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_), op() {} inline int operator[]( R_xlen_t i ) const { return op( lhs[i], rhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; Operator op ; } ; } } #endif Rcpp/inst/include/Rcpp/sugar/operators/not.h0000644000176200001440000000546712535036334020612 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // not.h: Rcpp R/C++ interface class library -- unary operator! // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__not_h #define Rcpp__sugar__not_h namespace Rcpp{ namespace sugar{ template class not_ { public: typedef typename traits::storage_type::type STORAGE ; inline int apply( STORAGE x ) const { return Rcpp::traits::is_na(x) ? NA_LOGICAL : (x ? FALSE : TRUE) ; } } ; template class not_ { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; inline int apply( STORAGE x ) const { return x ? FALSE : TRUE ; } } ; template class not_{ public: inline int apply( double x ) const { return Rcpp::traits::is_na( x ) ? NA_LOGICAL : ( (x == 0) ? FALSE : TRUE ) ; } } ; template <> class not_{ public: inline int apply( double x ) const { return ( x == 0.0 ? FALSE : TRUE ) ; } } ; template class not_{ public: inline int apply( Rcomplex x ) const { return Rcpp::traits::is_na( x ) ? NA_LOGICAL : ( (x.r == 0.0 & x.i == 0.0 ) ? FALSE : TRUE ) ; } } ; template <> class not_{ public: inline int apply( Rcomplex x ) const { return ((x.r == 0.0) & (x.i == 0.0) ) ? FALSE : TRUE ; } } ; template class Not_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef not_ OPERATOR ; Not_Vector( const VEC_TYPE& lhs_ ) : lhs(lhs_), op() {} inline STORAGE operator[]( R_xlen_t i ) const { return op.apply( lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_TYPE& lhs ; OPERATOR op ; } ; } } template inline Rcpp::sugar::Not_Vector< RTYPE , NA , T > operator!( const Rcpp::VectorBase& x ) { return Rcpp::sugar::Not_Vector( x ) ; } #endif Rcpp/inst/include/Rcpp/sugar/operators/logical_operators__Vector__primitive.h0000644000176200001440000001323012316773510027416 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // logical_operators__Vector__primitive.h: Rcpp R/C++ interface class library -- // logical operators for Vector to primitive comparisons // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__logical_operators__Vector__primitive_h #define Rcpp__sugar__logical_operators__Vector__primitive_h /* Vector < primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::less, NA, T > operator<( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::less, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::less, NA, T > operator>( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::less, NA, T >( lhs, rhs ) ; } /* Vector > primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::greater, NA, T > operator>( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::greater, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::greater, NA, T > operator<( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::greater, NA, T >( lhs, rhs ) ; } /* Vector <= primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::less_or_equal, NA, T > operator<=( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::less_or_equal, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::less_or_equal, NA, T > operator>=( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::less_or_equal, NA, T >( lhs, rhs ) ; } /* Vector >= primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::greater_or_equal, NA, T > operator>=( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::greater_or_equal, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::greater_or_equal, NA, T > operator<=( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::greater_or_equal, NA, T >( lhs, rhs ) ; } /* Vector == primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::equal, NA, T > operator==( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::equal, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::equal, NA, T > operator==( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::equal, NA, T >( lhs, rhs ) ; } /* Vector != primitive */ template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::not_equal, NA, T > operator!=( const Rcpp::VectorBase& lhs , typename Rcpp::traits::storage_type::type rhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::not_equal, NA, T >( lhs, rhs ) ; } template inline Rcpp::sugar::Comparator_With_One_Value< RTYPE , Rcpp::sugar::not_equal, NA, T > operator!=( typename Rcpp::traits::storage_type::type rhs, const Rcpp::VectorBase& lhs ){ return Rcpp::sugar::Comparator_With_One_Value< RTYPE, Rcpp::sugar::not_equal, NA, T >( lhs, rhs ) ; } #endif Rcpp/inst/include/Rcpp/sugar/operators/plus.h0000644000176200001440000003744212716501067020774 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // plus.h: Rcpp R/C++ interface class library -- operator+ // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__plus_h #define Rcpp__sugar__plus_h namespace Rcpp{ namespace sugar{ template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE lhs_ = lhs[i] ; if( traits::is_na(lhs_) ) return lhs_ ; STORAGE rhs_ = rhs[i] ; return traits::is_na(rhs_) ? rhs_ : (lhs_ + rhs_) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization of the above for REALSXP because : // NA_REAL + NA_REAL = NA_REAL // NA_REAL + x = NA_REAL // x + NA_REAL = NA_REAL template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization LHS_NA = false template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE rhs_ = rhs[i] ; if( traits::is_na(rhs_) ) return rhs_ ; return lhs[i] + rhs_ ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // LHS_NA = false & RTYPE = REALSXP template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization for RHS_NA = false template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, false, RHS_T>::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE lhs_ = lhs[i] ; if( traits::is_na(lhs_) ) return lhs_ ; return lhs_ + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RHS_NA = false, RTYPE = REALSXP template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization for RHS_NA = false and LHS_NA = false template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, false, RHS_T>::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { return lhs[i] + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization for RHS_NA = false and LHS_NA = false, RTYPE = REALSXP template class Plus_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Plus_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] + rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Plus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Plus_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( rhs_na ) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x + rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE = REALSXP template class Plus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor< REALSXP, NA, T>::type EXT ; Plus_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs + lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; template class Plus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, T>::type EXT ; Plus_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { return rhs_na ? rhs : (rhs + lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE = REALSXP template class Plus_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor< REALSXP, false, T>::type EXT ; Plus_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs + lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; // Vector * nona(primitive) template class Plus_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Plus_Vector_Primitive_nona( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x + rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; } ; template class Plus_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type EXT ; Plus_Vector_Primitive_nona( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs + lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; template class Plus_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, T>::type EXT ; Plus_Vector_Primitive_nona( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { return rhs + lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; } ; // RTYPE = REALSXP template class Plus_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor< REALSXP, false, T>::type EXT ; Plus_Vector_Primitive_nona( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs + lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, typename sugar::Plus_Vector_Primitive >::type operator+( const VectorBase& lhs, const U &rhs ) { return sugar::Plus_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, typename sugar::Plus_Vector_Primitive< RTYPE , NA , T> >::type operator+( const U &rhs, const VectorBase& lhs ) { return sugar::Plus_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Plus_Vector_Primitive_nona >::type operator+( const VectorBase& lhs, const typename sugar::NonaPrimitive< U > &rhs ) { return sugar::Plus_Vector_Primitive_nona( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Plus_Vector_Primitive_nona< RTYPE , NA , T> >::type operator+( const typename sugar::NonaPrimitive< U > &rhs, const VectorBase& lhs ) { return sugar::Plus_Vector_Primitive_nona( lhs, rhs ) ; } template inline sugar::Plus_Vector_Vector< RTYPE , LHS_NA, LHS_T, RHS_NA, RHS_T > operator+( const VectorBase& lhs, const VectorBase& rhs ) { return sugar::Plus_Vector_Vector< RTYPE, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/operators/r_binary_op.h0000644000176200001440000000326412316773510022307 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // LessThan.h: Rcpp R/C++ interface class library -- vector operators // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__r_binary_op_h #define Rcpp__sugar__r_binary_op_h namespace Rcpp{ namespace sugar{ #undef RCPP_OP #define RCPP_OP(NAME,OP) \ template \ class NAME { \ public: \ typedef typename traits::storage_type::type STORAGE ; \ inline int operator()( STORAGE lhs, STORAGE rhs) const { \ return lhs OP rhs ; \ } \ } ; RCPP_OP(less,<) RCPP_OP(greater,>) RCPP_OP(less_or_equal,<=) RCPP_OP(greater_or_equal,>=) RCPP_OP(equal,==) RCPP_OP(not_equal,!=) #undef RCPP_OP } // sugar } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/operators/unary_minus.h0000644000176200001440000000616712535036334022361 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // unary_minus.h: Rcpp R/C++ interface class library -- unary operator- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__unary_minus_h #define Rcpp__sugar__unary_minus_h namespace Rcpp{ namespace sugar{ template struct unary_minus_result_type{ typedef typename traits::storage_type::type type ; enum{ value = RTYPE } ; } ; template <> struct unary_minus_result_type{ typedef traits::storage_type::type type ; enum{ value = INTSXP } ; } ; template class unary_minus { public: typedef typename traits::storage_type::type STORAGE ; typedef typename unary_minus_result_type::type RESULT ; inline RESULT apply( STORAGE x ) const { return Rcpp::traits::is_na(x) ? x : ( -x ) ; } } ; template class unary_minus { public: typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename unary_minus_result_type::type RESULT ; inline RESULT apply( STORAGE x ) const { return -x ; } } ; template class unary_minus{ public: inline Rcomplex apply( Rcomplex x ) const { if (Rcpp::traits::is_na( x ) ) return x; Rcomplex cx ; cx.r = -x.r; cx.i = -x.i ; return cx ; } } ; template <> class unary_minus{ public: inline Rcomplex apply( Rcomplex x ) const { Rcomplex cx ; cx.r = -x.r; cx.i = -x.i ; return cx ; } } ; template class UnaryMinus_Vector : public Rcpp::VectorBase< unary_minus_result_type::value , NA, UnaryMinus_Vector< unary_minus_result_type::value ,NA,T> > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename unary_minus_result_type::type RESULT ; typedef unary_minus OPERATOR ; UnaryMinus_Vector( const VEC_TYPE& lhs_ ) : lhs(lhs_), op() {} inline RESULT operator[]( R_xlen_t i ) const { return op.apply( lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const VEC_TYPE& lhs ; OPERATOR op ; } ; } } template inline Rcpp::sugar::UnaryMinus_Vector< RTYPE , NA , T > operator-( const Rcpp::VectorBase& x ) { return Rcpp::sugar::UnaryMinus_Vector( x ) ; } #endif Rcpp/inst/include/Rcpp/sugar/operators/times.h0000644000176200001440000003716112716501067021130 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // times.h: Rcpp R/C++ interface class library -- operator* // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__times_h #define Rcpp__sugar__times_h namespace Rcpp{ namespace sugar{ template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) { } inline STORAGE operator[]( R_xlen_t i ) const { STORAGE lhs_ = lhs[i] ; if( traits::is_na(lhs_) ) return lhs_ ; STORAGE rhs_ = rhs[i] ; return traits::is_na(rhs_) ? rhs_ : (lhs_ * rhs_) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()) { } inline double operator[]( R_xlen_t i ) const { return lhs[i] * rhs[i]; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization LHS_NA = false template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, RHS_NA, RHS_T>::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE rhs_ = rhs[i] ; if( traits::is_na(rhs_) ) return rhs_ ; return lhs[i] * rhs_ ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] * rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization for RHS_NA = false template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, LHS_NA, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, false, RHS_T>::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE lhs_ = lhs[i] ; if( traits::is_na(lhs_) ) return lhs_ ; return lhs_ * rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] * rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // specialization for RHS_NA = false and LHS_NA = false template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, LHS_T>::type LHS_EXT ; typedef typename Rcpp::traits::Extractor< RTYPE, false, RHS_T>::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline STORAGE operator[]( R_xlen_t i ) const { return lhs[i] * rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; // RTYPE = REALSXP template class Times_Vector_Vector : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; typedef typename Rcpp::traits::Extractor::type LHS_EXT ; typedef typename Rcpp::traits::Extractor::type RHS_EXT ; Times_Vector_Vector( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_.get_ref()){} inline double operator[]( R_xlen_t i ) const { return lhs[i] * rhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const LHS_EXT& lhs ; const RHS_EXT& rhs ; } ; template class Times_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Times_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { if( rhs_na ) return rhs ; STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x * rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE = REALSXP template class Times_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type EXT ; Times_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs * lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; template class Times_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, T>::type EXT ; Times_Vector_Primitive( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_), rhs_na( Rcpp::traits::is_na(rhs_) ) {} inline STORAGE operator[]( R_xlen_t i ) const { return rhs_na ? rhs : (rhs * lhs[i] ) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; bool rhs_na ; } ; // RTYPE = REALSXP template class Times_Vector_Primitive : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type EXT ; Times_Vector_Primitive( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs * lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; // Vector * nona(primitive) template class Times_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, NA, T>::type EXT ; Times_Vector_Primitive_nona( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { STORAGE x = lhs[i] ; return Rcpp::traits::is_na(x) ? x : (x * rhs) ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; } ; // RTYPE = REALSXP template class Times_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type EXT ; Times_Vector_Primitive_nona( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return lhs[i] * rhs ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; template class Times_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename traits::storage_type::type STORAGE ; typedef typename Rcpp::traits::Extractor< RTYPE, false, T>::type EXT ; Times_Vector_Primitive_nona( const VEC_TYPE& lhs_, STORAGE rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline STORAGE operator[]( R_xlen_t i ) const { return rhs * lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; STORAGE rhs ; } ; template class Times_Vector_Primitive_nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type EXT ; Times_Vector_Primitive_nona( const VEC_TYPE& lhs_, double rhs_ ) : lhs(lhs_.get_ref()), rhs(rhs_) {} inline double operator[]( R_xlen_t i ) const { return rhs * lhs[i] ; } inline R_xlen_t size() const { return lhs.size() ; } private: const EXT& lhs ; double rhs ; } ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Times_Vector_Primitive >::type operator*( const VectorBase& lhs, const U &rhs ) { return sugar::Times_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Times_Vector_Primitive< RTYPE , NA , T > >::type operator*( const U &rhs, const VectorBase& lhs ) { return sugar::Times_Vector_Primitive( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Times_Vector_Primitive_nona >::type operator*( const VectorBase& lhs, const typename sugar::NonaPrimitive< U > &rhs ) { return sugar::Times_Vector_Primitive_nona( lhs, rhs ) ; } template inline typename traits::enable_if::type, typename traits::storage_type::type>::value, sugar::Times_Vector_Primitive_nona< RTYPE , NA , T > >::type operator*( const typename sugar::NonaPrimitive< U > &rhs, const VectorBase& lhs ) { return sugar::Times_Vector_Primitive_nona( lhs, rhs ) ; } template inline sugar::Times_Vector_Vector< RTYPE , LHS_NA, LHS_T, RHS_NA, RHS_T > operator*( const VectorBase& lhs, const VectorBase& rhs ) { return sugar::Times_Vector_Vector< RTYPE, LHS_NA, LHS_T, RHS_NA, RHS_T >( lhs, rhs ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/Range.h0000644000176200001440000000466113004204647017017 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Range.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2013 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 . #ifndef RCPP_SUGAR_RANGE_H #define RCPP_SUGAR_RANGE_H namespace Rcpp{ class Range : public VectorBase{ public: Range( R_xlen_t start_, R_xlen_t end__ ) : start(start_), end_(end__){ if( start_ > end__ ){ throw std::range_error( "upper value must be greater than lower value" ) ; } } inline R_xlen_t size() const{ return end_ - start + 1; } inline R_xlen_t operator[]( R_xlen_t i) const { return start + i ; } Range& operator++() { start++ ; end_++ ; return *this ; } Range operator++(int) { Range orig(*this) ; ++(*this); return orig ; } Range& operator--() { start-- ; end_-- ; return *this ; } Range operator--(int) { Range orig(*this) ; --(*this); return orig ; } Range& operator+=( int n ) { start += n ; end_ += n ; return *this ; } Range& operator-=( int n ) { start -= n ; end_ -= n ; return *this ; } Range operator+( int n ){ return Range( start + n, end_ + n ) ; } Range operator-( int n ){ return Range( start - n, end_ - n ) ; } inline R_xlen_t get_start() const { return start ; } inline R_xlen_t get_end() const { return end_ ; } private: R_xlen_t start ; R_xlen_t end_ ; } ; } #endif Rcpp/inst/include/Rcpp/sugar/sugar_forward.h0000644000176200001440000000212612253723677020640 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // sugar_forward.h: Rcpp R/C++ interface class library -- forward declaration for Rcpp::sugar // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_FORWARD_H #define RCPP_SUGAR_FORWARD_H // traits #include // abstractions #include #include #endif Rcpp/inst/include/Rcpp/sugar/block/0000755000176200001440000000000012535036334016701 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/block/SugarBlock_1.h0000644000176200001440000000504312535036334021330 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_BLOCK_1_H #define RCPP_SUGAR_BLOCK_1_H namespace Rcpp{ namespace sugar{ template class SugarBlock_1 : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_1 > { public: typedef RESULT_TYPE (*FunPtr)(U1) ; SugarBlock_1( FunPtr ptr_, const T1 & vec_) : ptr(ptr_), vec(vec_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( vec[i] ) ; } inline R_xlen_t size() const { return vec.size() ; } private: FunPtr ptr ; const T1& vec ; }; } // sugar } // Rcpp #define SB1_T VectorBase #define SUGAR_BLOCK_1(__NAME__,__SYMBOL__) \ namespace Rcpp{ \ template \ inline sugar::SugarBlock_1 \ __NAME__( \ const SB1_T& t \ ){ \ return sugar::SugarBlock_1( \ __SYMBOL__ , t \ ) ; \ } \ } #endif Rcpp/inst/include/Rcpp/sugar/block/SugarMath.h0000644000176200001440000001071412535036334020750 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_SUGARMATH_H #define RCPP_SUGAR_SUGARMATH_H namespace Rcpp{ namespace sugar{ template class SugarMath_1 : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarMath_1 > { public: typedef Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype ,NA,T1> VEC_TYPE ; SugarMath_1( FunPtr ptr_, const VEC_TYPE & vec_) : ptr(ptr_), vec(vec_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { U1 x = vec[i] ; if( ISNAN(x) ) return x; return ptr( x ) ; } inline R_xlen_t size() const { return vec.size() ; } private: FunPtr ptr ; const VEC_TYPE& vec ; }; template class SugarMath_1 : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarMath_1 > { public: typedef Rcpp::VectorBase< INTSXP ,NA,T1> VEC_TYPE ; SugarMath_1( FunPtr ptr_, const VEC_TYPE & vec_) : ptr(ptr_), vec(vec_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { int x = vec[i] ; if( Rcpp::traits::is_na(x) ) return Rcpp::traits::get_na( ) ; return ptr( x ) ; } inline R_xlen_t size() const { return vec.size() ; } private: FunPtr ptr ; const VEC_TYPE& vec ; }; template class SugarMath_1 : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , false, SugarMath_1 > { public: typedef Rcpp::VectorBase< INTSXP ,false,T1> VEC_TYPE ; SugarMath_1( FunPtr ptr_, const VEC_TYPE & vec_) : ptr(ptr_), vec(vec_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( vec[i] ) ; } inline R_xlen_t size() const { return vec.size() ; } private: FunPtr ptr ; const VEC_TYPE& vec ; }; } // sugar } // Rcpp #define SUGAR_MATH_1(__NAME__,__SYMBOL__) \ namespace Rcpp{ \ template \ inline sugar::SugarMath_1 \ __NAME__( \ const VectorBase& t \ ){ \ return sugar::SugarMath_1( \ &__SYMBOL__ , t \ ) ; \ } \ inline sugar::SugarMath_1 \ __NAME__( SEXP x){ return __NAME__( NumericVector( x ) ) ; } \ template \ inline sugar::SugarMath_1 \ __NAME__( \ const VectorBase& t \ ){ \ return sugar::SugarMath_1( \ &__SYMBOL__ , t \ ) ; \ } \ } #endif Rcpp/inst/include/Rcpp/sugar/block/SugarBlock_3.h0000644000176200001440000001164312535036334021335 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_BLOCK_3_H #define RCPP_SUGAR_BLOCK_3_H namespace Rcpp{ namespace sugar{ template < bool NA, typename RESULT_TYPE, typename U1, typename T1, typename U2, typename T2, typename U3, typename T3 > class SugarBlock_3_VVV : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_3_VVV > { public: typedef RESULT_TYPE (*FunPtr)(U1,U2,U3) ; SugarBlock_3_VVV( FunPtr ptr_, const T1 & x_, const T2& y_, const T3& z_ ) : ptr(ptr_), x(x_), y(y_), z(z_) { // TODO: size checks, recycling, etc ... } inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( x[i], y[i], z[i] ) ; } inline R_xlen_t size() const { return x.size() ; } private: FunPtr ptr ; const T1& x ; const T2& y ; const T2& z ; }; // template // class SugarBlock_3__VP : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_3__VP > { // public: // typedef RESULT_TYPE (*FunPtr)(U1,U2) ; // SugarBlock_3__VP( FunPtr ptr_, const T1 & x_, U2 u2 ) : // ptr(ptr_), x(x_), y(u2){} // // inline RESULT_TYPE operator[]( int i) const { // return ptr( x[i], y ) ; // } // inline int size() const { return x.size() ; } // // private: // FunPtr ptr ; // const T1& x ; // U2 y ; // }; // // template // class SugarBlock_3__PV : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_3__PV > { // public: // typedef RESULT_TYPE (*FunPtr)(U1,U2) ; // SugarBlock_3__PV( FunPtr ptr_, U1 u1, const T2& y_ ) : // ptr(ptr_), x(u1), y(y_){} // // inline RESULT_TYPE operator[]( int i) const { // return ptr( x, y[i] ) ; // } // inline int size() const { return y.size() ; } // // private: // FunPtr ptr ; // U1 x ; // const T2& y ; // }; } // sugar } // Rcpp #define SB3_T1 VectorBase #define SB3_T2 VectorBase #define SB3_T3 VectorBase #define SUGAR_BLOCK_3(__NAME__,__SYMBOL__) \ namespace Rcpp{ \ template \ inline sugar::SugarBlock_3_VVV< \ (T1_NA||T2_NA||T3_NA) ,double, \ double,SB3_T1, \ double,SB3_T2, \ double,SB3_T3 \ > \ __NAME__( \ const SB3_T1& x1, \ const SB3_T2& x2, \ const SB3_T3& x3 \ ){ \ return sugar::SugarBlock_3_VVV< \ (T1_NA||T2_NA||T3_NA) , double, \ double,SB3_T1, \ double,SB3_T2, \ double,SB3_T3 \ >( \ __SYMBOL__ , x1, x2, x3 \ ) ; \ } \ } #endif Rcpp/inst/include/Rcpp/sugar/block/Vectorized_Math.h0000644000176200001440000000761412535036334022151 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_VECTORIZEDMATH_H #define RCPP_SUGAR_VECTORIZEDMATH_H namespace Rcpp{ namespace sugar{ extern "C" typedef double (*DDFun)(double); template class Vectorized : public VectorBase >{ public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Vectorized( const VEC_TYPE& object_) : object( object_.get_ref() ){} inline double operator[]( R_xlen_t i) const { return Func( object[i] ) ; } inline R_xlen_t size() const { return object.size(); } private: const VEC_EXT& object ; } ; template class Vectorized_INTSXP : public VectorBase >{ public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Vectorized_INTSXP( const VEC_TYPE& object_) : object( object_.get_ref() ){} inline double operator[]( R_xlen_t i) const { int x = object[i] ; if( x == NA_INTEGER ) return NA_REAL ; return Func( x ) ; } inline R_xlen_t size() const { return object.size(); } private: const VEC_EXT& object ; } ; template class Vectorized_INTSXP : public VectorBase >{ public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::Extractor::type VEC_EXT ; Vectorized_INTSXP( const VEC_TYPE& object_) : object( object_.get_ref() ){} inline double operator[]( R_xlen_t i) const { return Func( object[i] ) ; } inline R_xlen_t size() const { return object.size(); } private: const VEC_EXT& object ; } ; } // sugar } // Rcpp #define VECTORIZED_MATH_1(__NAME__,__SYMBOL__) \ namespace Rcpp{ \ template \ inline sugar::Vectorized<__SYMBOL__,NA,T> \ __NAME__( const VectorBase& t ){ \ return sugar::Vectorized<__SYMBOL__,NA,T>( t ) ; \ } \ inline sugar::Vectorized<__SYMBOL__,true,NumericVector> \ __NAME__( SEXP x){ return __NAME__( NumericVector( x ) ) ; } \ template \ inline sugar::Vectorized_INTSXP<__SYMBOL__,NA,T> \ __NAME__( const VectorBase& t ){ \ return sugar::Vectorized_INTSXP<__SYMBOL__,NA,T>( t ) ; \ } \ } #endif Rcpp/inst/include/Rcpp/sugar/block/SugarBlock_2.h0000644000176200001440000002232112535036334021327 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_BLOCK_2_H #define RCPP_SUGAR_BLOCK_2_H namespace Rcpp{ namespace sugar{ template class SugarBlock_2 : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_2 > { public: typedef RESULT_TYPE (*FunPtr)(U1,U2) ; SugarBlock_2( FunPtr ptr_, const T1 & x_, const T2& y_ ) : ptr(ptr_), x(x_), y(y_){ // TODO: check that x and y have same size } inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( x[i], y[i] ) ; } inline R_xlen_t size() const { return x.size() ; } private: FunPtr ptr ; const T1& x ; const T2& y ; }; template class SugarBlock_2__VP : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_2__VP > { public: typedef RESULT_TYPE (*FunPtr)(U1,U2) ; SugarBlock_2__VP( FunPtr ptr_, const T1 & x_, U2 u2 ) : ptr(ptr_), x(x_), y(u2){} inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( x[i], y ) ; } inline R_xlen_t size() const { return x.size() ; } private: FunPtr ptr ; const T1& x ; U2 y ; }; template class SugarBlock_2__PV : public Rcpp::VectorBase< Rcpp::traits::r_sexptype_traits::rtype , NA, SugarBlock_2__PV > { public: typedef RESULT_TYPE (*FunPtr)(U1,U2) ; SugarBlock_2__PV( FunPtr ptr_, U1 u1, const T2& y_ ) : ptr(ptr_), x(u1), y(y_){} inline RESULT_TYPE operator[]( R_xlen_t i) const { return ptr( x, y[i] ) ; } inline R_xlen_t size() const { return y.size() ; } private: FunPtr ptr ; U1 x ; const T2& y ; }; } // sugar } // Rcpp #define SB2_LHT VectorBase #define SB2_RHT VectorBase #define SUGAR_BLOCK_2(__NAME__,__SYMBOL__) \ namespace Rcpp{ \ template \ inline sugar::SugarBlock_2< (LHS_NA||RHS_NA) ,double,double,SB2_LHT,double,SB2_RHT> \ __NAME__( \ const SB2_LHT& lhs, \ const SB2_RHT& rhs \ ){ \ return sugar::SugarBlock_2< (LHS_NA||RHS_NA) ,double,double,SB2_LHT,double,SB2_RHT >(\ __SYMBOL__ , lhs, rhs \ ) ; \ } \ template \ inline sugar::SugarBlock_2__VP \ __NAME__( \ const SB2_LHT& lhs, \ double rhs \ ){ \ return sugar::SugarBlock_2__VP( \ __SYMBOL__ , lhs, rhs \ ) ; \ } \ template \ inline sugar::SugarBlock_2__PV \ __NAME__( \ double lhs, \ const SB2_RHT& rhs \ ){ \ return sugar::SugarBlock_2__PV( \ __SYMBOL__ , lhs, rhs \ ) ; \ } \ } #define SUGAR_BLOCK_2_NA(__NAME__,__SYMBOL__,__NA__) \ namespace Rcpp{ \ template \ inline sugar::SugarBlock_2< __NA__ ,double,double,SB2_LHT,double,SB2_RHT> \ __NAME__( \ const SB2_LHT& lhs, \ const SB2_RHT& rhs \ ){ \ return sugar::SugarBlock_2< __NA__ ,double,double,SB2_LHT,double,SB2_RHT \ >( \ __SYMBOL__ , lhs, rhs \ ) ; \ } \ template \ inline sugar::SugarBlock_2__VP<__NA__,double,double,SB2_LHT,double> \ __NAME__( \ const SB2_LHT& lhs, \ double rhs \ ){ \ return sugar::SugarBlock_2__VP<__NA__,double,double,SB2_LHT,double>( \ __SYMBOL__ , lhs, rhs \ ) ; \ } \ template \ inline sugar::SugarBlock_2__PV<__NA__,double,double,double,SB2_RHT> \ __NAME__( \ double lhs, \ const SB2_RHT& rhs \ ){ \ return sugar::SugarBlock_2__PV<__NA__,double,double,double,SB2_RHT \ >( \ __SYMBOL__ , lhs, rhs \ ) ; \ } \ } #endif Rcpp/inst/include/Rcpp/sugar/block/block.h0000644000176200001440000000221512253723677020156 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // block.h: Rcpp R/C++ interface class library -- sugar blocks // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__block__block_h #define Rcpp__sugar__block__block_h #include #include #include #include #include #endif Rcpp/inst/include/Rcpp/sugar/logical/0000755000176200001440000000000012535036334017221 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/logical/SingleLogicalResult.h0000644000176200001440000000437212336231761023313 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // SingleLogicalResult.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__SingleLogicalResult_h #define Rcpp__sugar__SingleLogicalResult_h namespace Rcpp{ namespace sugar{ template class forbidden_conversion ; template <> class forbidden_conversion{} ; template class conversion_to_bool_is_forbidden : forbidden_conversion{ public: void touch(){} }; template class SingleLogicalResult { public: const static int UNRESOLVED = -5 ; SingleLogicalResult() : result(UNRESOLVED) {} ; void apply(){ if( result == UNRESOLVED ){ static_cast(*this).apply() ; } } inline bool is_true(){ apply() ; return result == TRUE ; } inline bool is_false(){ apply() ; return result == FALSE ; } inline bool is_na(){ apply() ; return Rcpp::traits::is_na( result ) ; } inline operator SEXP(){ return get_sexp() ; } inline operator bool(){ conversion_to_bool_is_forbidden x ; x.touch() ; return is_true() ; } inline int size(){ return 1 ; } inline int get(){ apply(); return result; } inline SEXP get_sexp(){ apply() ; return Rf_ScalarLogical( result ) ; } protected: int result ; inline void set(int x){ result = x ;} inline void reset(){ set(UNRESOLVED) ; } inline void set_true(){ set(TRUE); } inline void set_false(){ set(FALSE); } inline void set_na(){ set(NA_LOGICAL); } inline bool is_unresolved(){ return result == UNRESOLVED ; } } ; } } #endif Rcpp/inst/include/Rcpp/sugar/logical/or.h0000644000176200001440000002300012535036334020005 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // or.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__logical_or_h #define Rcpp__sugar__logical_or_h namespace Rcpp{ namespace sugar{ template class Or_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< (LHS_NA || RHS_NA) , Or_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< (LHS_NA || RHS_NA) , Or_SingleLogicalResult_SingleLogicalResult > BASE ; Or_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ int left = lhs.get() ; if( Rcpp::traits::is_na( left ) ){ BASE::set( left ) ; } else if( left == TRUE ){ BASE::set( TRUE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know the rhs is not NA template class Or_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< LHS_NA , Or_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< LHS_NA, Or_SingleLogicalResult_SingleLogicalResult > BASE ; Or_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ // here we know rhs does not have NA, so we start with the rhs int right = rhs.get() ; if( right == TRUE ){ BASE::set( TRUE ) ; } else { BASE::set( lhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know the lhs is not NA template class Or_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< RHS_NA , Or_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< RHS_NA, Or_SingleLogicalResult_SingleLogicalResult > BASE ; Or_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ // here we know lhs does not have NA, so we start with the rhs int left = lhs.get() ; if( left == TRUE ){ BASE::set( TRUE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know both the lhs and the rhs are not NA template class Or_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< false , Or_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< false, Or_SingleLogicalResult_SingleLogicalResult > BASE ; Or_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ int left = lhs.get() ; if( left == TRUE ){ BASE::set( TRUE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class Or_SingleLogicalResult_bool : public SingleLogicalResult< LHS_NA , And_SingleLogicalResult_bool > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult< LHS_NA , Or_SingleLogicalResult_bool > BASE ; Or_SingleLogicalResult_bool( const LHS_TYPE& lhs_, bool rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ if( rhs ){ BASE::set( TRUE ) ; } else{ BASE::set( lhs.get() ) ; } } private: const LHS_TYPE& lhs ; bool rhs ; } ; // (LogicalExpression) | (LogicalExpression) template class Or_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, Or_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; Or_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE || rhs[i] == TRUE ) return TRUE ; if( lhs[i] == FALSE && rhs[i] == FALSE ) return FALSE ; return NA_LOGICAL; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class Or_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, Or_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; Or_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE || rhs[i] == TRUE ) return TRUE ; if( rhs[i] == NA_LOGICAL ) return NA_LOGICAL ; return FALSE ; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class Or_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, Or_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; Or_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE || rhs[i] == TRUE ) return TRUE ; if( lhs[i] == NA_LOGICAL ) return NA_LOGICAL ; return FALSE; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class Or_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, false, Or_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; Or_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE || rhs[i] == TRUE ) return TRUE ; return FALSE; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; } // sugar } // Rcpp template inline Rcpp::sugar::Or_SingleLogicalResult_SingleLogicalResult operator||( const Rcpp::sugar::SingleLogicalResult& lhs, const Rcpp::sugar::SingleLogicalResult& rhs ){ return Rcpp::sugar::Or_SingleLogicalResult_SingleLogicalResult( lhs, rhs ) ; } template inline Rcpp::sugar::Or_SingleLogicalResult_bool operator||( const Rcpp::sugar::SingleLogicalResult& lhs, bool rhs ){ return Rcpp::sugar::Or_SingleLogicalResult_bool( lhs, rhs ) ; } template inline Rcpp::sugar::Or_SingleLogicalResult_bool operator||( bool rhs, const Rcpp::sugar::SingleLogicalResult& lhs ){ return Rcpp::sugar::Or_SingleLogicalResult_bool( lhs, rhs ) ; } // (logical expression) | (logical expression) template inline Rcpp::sugar::Or_LogicalExpression_LogicalExpression operator|( const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::Or_LogicalExpression_LogicalExpression( lhs, rhs ) ; } #endif Rcpp/inst/include/Rcpp/sugar/logical/and.h0000644000176200001440000002305712535036334020143 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // and.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2012 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 . #ifndef Rcpp__sugar__logical_and_h #define Rcpp__sugar__logical_and_h namespace Rcpp{ namespace sugar{ template class And_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< (LHS_NA || RHS_NA) , And_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< (LHS_NA || RHS_NA) , And_SingleLogicalResult_SingleLogicalResult > BASE ; And_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ int left = lhs.get() ; if( Rcpp::traits::is_na( left ) ){ BASE::set( left ) ; } else if( left == FALSE ){ BASE::set( FALSE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know the rhs is not NA template class And_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< LHS_NA , And_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< LHS_NA, And_SingleLogicalResult_SingleLogicalResult > BASE ; And_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ // here we know rhs does not have NA, so we start with the rhs int right = rhs.get() ; if( right == FALSE ){ BASE::set( FALSE ) ; } else { BASE::set( lhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know the lhs is not NA template class And_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< RHS_NA , And_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< RHS_NA, And_SingleLogicalResult_SingleLogicalResult > BASE ; And_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ // here we know lhs does not have NA, so we start with the rhs int left = lhs.get() ; if( left == FALSE ){ BASE::set( FALSE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; // special version when we know both the lhs and the rhs are not NA template class And_SingleLogicalResult_SingleLogicalResult : public SingleLogicalResult< false , And_SingleLogicalResult_SingleLogicalResult > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult RHS_TYPE ; typedef SingleLogicalResult< false, And_SingleLogicalResult_SingleLogicalResult > BASE ; And_SingleLogicalResult_SingleLogicalResult( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ int left = lhs.get() ; if( left == FALSE ){ BASE::set( FALSE ) ; } else { BASE::set( rhs.get() ) ; } } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class And_SingleLogicalResult_bool : public SingleLogicalResult< LHS_NA , And_SingleLogicalResult_bool > { public: typedef SingleLogicalResult LHS_TYPE ; typedef SingleLogicalResult< LHS_NA , And_SingleLogicalResult_bool > BASE ; And_SingleLogicalResult_bool( const LHS_TYPE& lhs_, bool rhs_) : lhs(lhs_), rhs(rhs_){} ; inline void apply(){ if( !rhs ){ BASE::set( FALSE ) ; } else{ BASE::set( lhs.get() ) ; } } private: const LHS_TYPE& lhs ; bool rhs ; } ; // (LogicalExpression) & (LogicalExpression) template class And_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, And_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; And_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE && rhs[i] == TRUE ) return TRUE ; if( lhs[i] == NA_LOGICAL || rhs[i] == NA_LOGICAL ) return NA_LOGICAL ; return FALSE ; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class And_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, And_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; And_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE && rhs[i] == TRUE ) return TRUE ; if( rhs[i] == NA_LOGICAL ) return NA_LOGICAL ; return FALSE ; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class And_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, true, And_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; And_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE && rhs[i] == TRUE ) return TRUE ; if( lhs[i] == NA_LOGICAL ) return NA_LOGICAL ; return FALSE; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; template class And_LogicalExpression_LogicalExpression : public Rcpp::VectorBase< LGLSXP, false, And_LogicalExpression_LogicalExpression >{ public: typedef typename Rcpp::VectorBase LHS_TYPE ; typedef typename Rcpp::VectorBase RHS_TYPE ; And_LogicalExpression_LogicalExpression( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_ ) : lhs(lhs_), rhs(rhs_){} inline int operator[]( R_xlen_t i ) const{ if( lhs[i] == TRUE && rhs[i] == TRUE ) return TRUE ; return FALSE; } inline R_xlen_t size() const { return lhs.size(); } private: const LHS_TYPE& lhs ; const RHS_TYPE& rhs ; } ; } } template inline Rcpp::sugar::And_SingleLogicalResult_SingleLogicalResult operator&&( const Rcpp::sugar::SingleLogicalResult& lhs, const Rcpp::sugar::SingleLogicalResult& rhs ){ return Rcpp::sugar::And_SingleLogicalResult_SingleLogicalResult( lhs, rhs ) ; } template inline Rcpp::sugar::And_SingleLogicalResult_bool operator&&( const Rcpp::sugar::SingleLogicalResult& lhs, bool rhs ){ return Rcpp::sugar::And_SingleLogicalResult_bool( lhs, rhs ) ; } template inline Rcpp::sugar::And_SingleLogicalResult_bool operator&&( bool rhs, const Rcpp::sugar::SingleLogicalResult& lhs ){ return Rcpp::sugar::And_SingleLogicalResult_bool( lhs, rhs ) ; } // (logical expression) & (logical expression) template inline Rcpp::sugar::And_LogicalExpression_LogicalExpression operator&( const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs ){ return Rcpp::sugar::And_LogicalExpression_LogicalExpression( lhs, rhs ) ; } #endif Rcpp/inst/include/Rcpp/sugar/logical/not.h0000644000176200001440000000351612336231761020177 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // not.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__logical__not_h #define Rcpp__sugar__logical__not_h namespace Rcpp{ namespace sugar{ template struct negate{ static inline int apply( int x ){ return Rcpp::traits::is_na( x ) ? x : ( x ? FALSE : TRUE ) ; } } ; template<> struct negate{ static inline int apply( int x){ return x ? FALSE : TRUE ; } ; } ; template class Negate_SingleLogicalResult : public SingleLogicalResult >{ public: typedef SingleLogicalResult TYPE ; typedef SingleLogicalResult > BASE ; Negate_SingleLogicalResult( const TYPE& orig_ ) : orig(orig_) {} inline void apply(){ BASE::set( negate::apply( orig.get() ) ); } private: const TYPE& orig ; } ; } } template inline Rcpp::sugar::Negate_SingleLogicalResult operator!( const Rcpp::sugar::SingleLogicalResult& x){ return Rcpp::sugar::Negate_SingleLogicalResult( x ); } #endif Rcpp/inst/include/Rcpp/sugar/logical/logical.h0000644000176200001440000000221412316773510021004 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // logical.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_LOGICAL_H #define RCPP_SUGAR_LOGICAL_H #include #include #include #include #include #include #endif Rcpp/inst/include/Rcpp/sugar/logical/is.h0000644000176200001440000000273412336231761020013 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_LOGICAL_IS_H #define RCPP_SUGAR_LOGICAL_IS_H namespace Rcpp{ template inline bool is_true( const Rcpp::sugar::SingleLogicalResult& x){ return const_cast< Rcpp::sugar::SingleLogicalResult& >(x).is_true() ; } template inline bool is_false( const Rcpp::sugar::SingleLogicalResult& x){ return const_cast< Rcpp::sugar::SingleLogicalResult& >(x).is_false() ; } template inline bool is_na( const Rcpp::sugar::SingleLogicalResult& x){ return const_cast< Rcpp::sugar::SingleLogicalResult& >(x).is_na() ; } } #endif Rcpp/inst/include/Rcpp/sugar/logical/can_have_na.h0000644000176200001440000000201612316773510021614 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // can_have_na.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__can_have_na_h #define Rcpp__sugar__can_have_na_h namespace Rcpp{ template struct can_have_na : T::can_have_na::type {} ; } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/matrix/0000755000176200001440000000000014772603376017126 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/matrix/diag.h0000644000176200001440000000513012535036334020167 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // diag.h: Rcpp R/C++ interface class library -- diag // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__diag_h #define Rcpp__sugar__diag_h namespace Rcpp{ namespace sugar{ template class Diag_Extractor : public Rcpp::VectorBase< RTYPE ,NA, Diag_Extractor > { public: typedef typename Rcpp::MatrixBase MAT_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Diag_Extractor( const MAT_TYPE& object_ ) : object(object_), n(0) { int nr = object.nrow() ; int nc = object.ncol() ; n = (nc < nr ) ? nc : nr ; } inline STORAGE operator[]( int i ) const { return object( i, i ) ; } inline R_xlen_t size() const { return n; } private: const MAT_TYPE& object ; R_xlen_t n ; } ; template class Diag_Maker : public Rcpp::MatrixBase< RTYPE ,NA, Diag_Maker > { public: typedef typename Rcpp::VectorBase VEC_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Diag_Maker( const VEC_TYPE& object_ ) : object(object_), n(object_.size()) {} inline STORAGE operator()( int i, int j ) const { return (i==j) ? object[i] : 0 ; } inline R_xlen_t size() const { return static_cast(n) * n; } inline int ncol() const { return n; } inline int nrow() const { return n; } private: const VEC_TYPE& object ; int n ; } ; template struct diag_result_type_trait{ typedef typename Rcpp::traits::if_< Rcpp::traits::matrix_interface::value, Diag_Extractor< T::r_type::value , T::can_have_na::value , T >, Diag_Maker< T::r_type::value , T::can_have_na::value , T > >::type type ; } ; } // sugar template inline typename sugar::diag_result_type_trait::type diag( const T& t ){ return typename sugar::diag_result_type_trait::type( t ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/matrix/lower_tri.h0000644000176200001440000000427713044160437021302 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // lower_tri.h: Rcpp R/C++ interface class library -- lower.tri // // Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2017 Dirk Eddelbuettel, Romain Francois, and Nathan Russell // // 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 . #ifndef Rcpp__sugar__lower_tri_h #define Rcpp__sugar__lower_tri_h namespace Rcpp { namespace sugar { template class LowerTri : public MatrixBase > { public: typedef Rcpp::MatrixBase MatBase; LowerTri(const T& lhs, bool diag) : nr(lhs.nrow()), nc(lhs.ncol()), getter(diag ? (&LowerTri::get_diag_true) : (&LowerTri::get_diag_false)) {} inline int operator()(int i, int j) const { return get(i, j); } inline R_xlen_t size() const { return static_cast(nr) * nc; } inline int nrow() const { return nr; } inline int ncol() const { return nc; } private: typedef bool (LowerTri::*Method)(int, int) const; int nr, nc; Method getter; inline bool get_diag_true(int i, int j) const { return i >= j; } inline bool get_diag_false(int i, int j) const { return i > j; } inline bool get(int i, int j) const { return (this->*getter)(i, j); } }; } // sugar template inline sugar::LowerTri lower_tri(const Rcpp::MatrixBase& lhs, bool diag = false) { return sugar::LowerTri(lhs, diag); } } // Rcpp #endif // Rcpp__sugar__lower_tri_h Rcpp/inst/include/Rcpp/sugar/matrix/tools.h0000644000176200001440000000236212336231761020427 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // matrix_functions.h: Rcpp R/C++ interface class library -- matrix sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_MATRIX_TOOLS_H #define RCPP_SUGAR_MATRIX_TOOLS_H namespace Rcpp{ namespace internal{ inline int get_line( int index, int nr ){ return index % nr ; } inline int get_column( int index, int nr ){ int i = get_line( index, nr ); return (index-i) / nr ; } inline int get_column( int index, int nr, int i ){ return (index-i) / nr ; } } } #endif Rcpp/inst/include/Rcpp/sugar/matrix/col.h0000644000176200001440000000322412535036334020042 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // col.h: Rcpp R/C++ interface class library -- col // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__col_h #define Rcpp__sugar__col_h namespace Rcpp{ namespace sugar{ template class Col : public MatrixBase< INTSXP , false , Col > { public: typedef Rcpp::MatrixBase LHS_TYPE ; Col( const LHS_TYPE& lhs) : nr( lhs.ncol() ), nc( lhs.ncol() ) {} inline int operator()( int i, int j ) const { return j + 1 ; } inline R_xlen_t size() const { return static_cast(nr) * nc ; } inline int nrow() const { return nr; } inline int ncol() const { return nc; } private: int nr, nc ; } ; } // sugar template inline sugar::Col col( const Rcpp::MatrixBase& lhs){ return sugar::Col( lhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/matrix/outer.h0000644000176200001440000000567014772603376020445 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // outer.h: Rcpp R/C++ interface class library -- outer // // Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2025 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 . #ifndef Rcpp__sugar__outer_h #define Rcpp__sugar__outer_h namespace Rcpp{ namespace sugar{ template class Outer : public MatrixBase< Rcpp::traits::r_sexptype_traits< typename ::Rcpp::traits::result_of::type >::rtype , true , Outer > { public: typedef typename ::Rcpp::traits::result_of::type result_type ; const static int RESULT_R_TYPE = Rcpp::traits::r_sexptype_traits::rtype ; typedef Rcpp::VectorBase LHS_TYPE ; typedef Rcpp::VectorBase RHS_TYPE ; typedef Rcpp::internal::LazyVector LHS_LAZY ; typedef Rcpp::internal::LazyVector RHS_LAZY ; typedef typename Rcpp::traits::r_vector_element_converter::type converter_type ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Outer( const LHS_TYPE& lhs_, const RHS_TYPE& rhs_, Function fun_ ) : lhs(lhs_), rhs(rhs_), fun(fun_), nr(lhs_.size()), nc(rhs_.size()) {} inline STORAGE operator()( int i, int j ) const { return converter_type::get( fun( lhs[i], rhs[j] ) ); } inline R_xlen_t size() const { return static_cast(nr) * nc ; } inline int nrow() const { return nr; } inline int ncol() const { return nc; } private: LHS_LAZY lhs ; RHS_LAZY rhs ; Function fun ; int nr, nc ; } ; } // sugar template inline sugar::Outer outer( const Rcpp::VectorBase& lhs, const Rcpp::VectorBase& rhs, Function fun ){ return sugar::Outer( lhs, rhs, fun ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/matrix/upper_tri.h0000644000176200001440000000430313044160437021273 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // upper_tri.h: Rcpp R/C++ interface class library -- upper.tri // // Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois // Copyright (C) 2017 Dirk Eddelbuettel, Romain Francois, and Nathan Russell // // 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 . #ifndef Rcpp__sugar__upper_tri_h #define Rcpp__sugar__upper_tri_h namespace Rcpp { namespace sugar { template class UpperTri : public MatrixBase > { public: typedef Rcpp::MatrixBase MatBase; UpperTri(const T& lhs, bool diag) : nr(lhs.nrow()), nc(lhs.ncol()), getter(diag ? (&UpperTri::get_diag_true) : (&UpperTri::get_diag_false)) {} inline int operator()(int i, int j) const { return get(i, j); } inline R_xlen_t size() const { return static_cast(nr) * nc; } inline int nrow() const { return nr; } inline int ncol() const { return nc; } private: typedef bool (UpperTri::*Method)(int, int) const; int nr, nc; Method getter; inline bool get_diag_true(int i, int j) const { return i <= j; } inline bool get_diag_false(int i, int j) const { return i < j; } inline bool get(int i, int j) const { return (this->*getter)(i, j); } }; } // sugar template inline sugar::UpperTri upper_tri(const Rcpp::MatrixBase& lhs, bool diag = false) { return sugar::UpperTri(lhs, diag); } } // Rcpp #endif // Rcpp__sugar__upper_tri_h Rcpp/inst/include/Rcpp/sugar/matrix/as_vector.h0000644000176200001440000000421212535036334021250 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // as_vector.h: Rcpp R/C++ interface class library -- as_vector( sugar matrix expression ) // // Copyright (C) 2010 - 2014 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 . #ifndef Rcpp__sugar__matrix_as_vector_h #define Rcpp__sugar__matrix_as_vector_h namespace Rcpp{ namespace internal{ template inline Rcpp::Vector as_vector__impl( MatrixBase& t, Rcpp::traits::false_type ){ T& ref = t.get_ref() ; int nc = ref.ncol(), nr = ref.nrow() ; Vector out (static_cast(nr) * nc) ; R_xlen_t k =0; for( int col_index=0; col_index inline Rcpp::Vector as_vector__impl( MatrixBase& t, Rcpp::traits::true_type ){ Matrix& ref = t.get_ref() ; R_xlen_t size = static_cast(ref.ncol())*ref.nrow() ; typename Rcpp::Vector::const_iterator first(static_cast&>(ref).begin()) ; return Vector(first, first+size ); } } // internal template inline Rcpp::Vector as_vector( const MatrixBase& t ){ return internal::as_vector__impl( const_cast< MatrixBase& >(t), typename Rcpp::traits::same_type< T , Matrix >() ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/matrix/matrix_functions.h0000644000176200001440000000233013004204647022652 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // matrix_functions.h: Rcpp R/C++ interface class library -- matrix sugar functions // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_MATRIX_FUNCTIONS_H #define RCPP_SUGAR_MATRIX_FUNCTIONS_H #include #include #include #include #include #include #include #endif Rcpp/inst/include/Rcpp/sugar/matrix/row.h0000644000176200001440000000322412535036334020074 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // row.h: Rcpp R/C++ interface class library -- row // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__sugar__row_h #define Rcpp__sugar__row_h namespace Rcpp{ namespace sugar{ template class Row : public MatrixBase< INTSXP , false , Row > { public: typedef Rcpp::MatrixBase LHS_TYPE ; Row( const LHS_TYPE& lhs) : nr( lhs.nrow() ), nc( lhs.ncol() ) {} inline int operator()( int i, int j ) const { return i + 1 ; } inline R_xlen_t size() const { return static_cast(nr) * nc ; } inline int nrow() const { return nr; } inline int ncol() const { return nc; } private: int nr, nc ; } ; } // sugar template inline sugar::Row row( const Rcpp::MatrixBase& lhs){ return sugar::Row( lhs ) ; } } // Rcpp #endif Rcpp/inst/include/Rcpp/sugar/nona/0000755000176200001440000000000012535036334016542 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/nona/nona.h0000644000176200001440000000544312535036334017654 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*- // // nona.h: Rcpp R/C++ interface class library -- noNA handling // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_NONA_NONA_H #define RCPP_SUGAR_NONA_NONA_H namespace Rcpp{ namespace sugar { template class Nona : public Rcpp::VectorBase > { public: typedef typename Rcpp::VectorBase SUGAR_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; Nona( const SUGAR_TYPE& expr) : data(expr.get_ref()){} inline R_xlen_t size() const { return data.size() ; } inline STORAGE operator[](R_xlen_t i) const { return data[i] ; } private: const VECTOR& data ; } ; // specialization when the expression is actually a vector expression template class Nona< RTYPE,NA,Rcpp::Vector > : public Rcpp::VectorBase > > { public: typedef typename Rcpp::VectorBase > SUGAR_TYPE ; typedef typename Rcpp::traits::storage_type::type STORAGE ; typedef typename Rcpp::Vector::const_iterator iterator ; Nona( const SUGAR_TYPE& expr) : data(expr.get_ref().begin()), n(expr.size()){} inline R_xlen_t size() const { return n ; } inline STORAGE operator[](R_xlen_t i) const { return data[i] ; } private: iterator data ; R_xlen_t n ; } ; template class NonaPrimitive { public: NonaPrimitive( T t) : x(t){} inline operator T(){ return x ; } private: T x ; } ; } template inline sugar::Nona noNA( const Rcpp::VectorBase& vec ){ return sugar::Nona( vec ) ; } inline sugar::NonaPrimitive noNA( double x ){ return sugar::NonaPrimitive( x ) ; } inline sugar::NonaPrimitive noNA( int x ){ return sugar::NonaPrimitive( x ) ; } } #endif Rcpp/inst/include/Rcpp/sugar/sets.h0000644000176200001440000000207014771655440016746 0ustar liggesusers// sets.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2012 - 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 . #ifndef Rcpp__sugar__sets_h #define Rcpp__sugar__sets_h namespace std { template<> struct hash { std::size_t operator()(const Rcpp::String& key) const { return pointer_hasher( key.get_sexp() ) ; } hash pointer_hasher ; }; } #endif Rcpp/inst/include/Rcpp/sugar/tools/0000755000176200001440000000000012535036334016747 5ustar liggesusersRcpp/inst/include/Rcpp/sugar/tools/iterator.h0000644000176200001440000001153312535036334020754 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // iterator.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2012 - 2013 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 . #ifndef Rcpp__sugar__tools_iterator_h #define Rcpp__sugar__tools_iterator_h namespace Rcpp { namespace sugar { /* generic sugar iterator type */ template class SugarIterator { public: typedef R_xlen_t difference_type ; typedef typename Rcpp::traits::storage_type< Rcpp::traits::r_sexptype_traits::rtype >::type STORAGE_TYPE ; typedef STORAGE_TYPE reference ; typedef STORAGE_TYPE* pointer ; typedef std::random_access_iterator_tag iterator_category ; typedef SugarIterator iterator ; SugarIterator( const T& ref_ ) :ref(ref_), index(0) {} SugarIterator( const T& ref_, R_xlen_t index_) : ref(ref_), index(index_) {} SugarIterator( const SugarIterator& other) : ref(other.ref), index(other.index){} inline iterator& operator++(){ index++; return *this ; } inline iterator operator++(int){ iterator orig(*this) ; ++(*this); return orig ; } inline iterator& operator--(){ index--; return *this ; } inline iterator operator--(int){ iterator orig(*this) ; --(*this); return orig ; } inline iterator operator+(difference_type n) const { return iterator( ref, index+n ) ; } inline iterator operator-(difference_type n) const { return iterator( ref, index-n ) ; } inline iterator& operator+=(difference_type n) { index += n ; return *this ; } inline iterator& operator-=(difference_type n) { index -= n; return *this ; } inline reference operator[](R_xlen_t i){ return ref[index+i] ; } inline reference operator*() { return ref[index] ; } inline pointer operator->(){ return &ref[index] ; } inline bool operator==( const iterator& y) const { return ( index == y.index ) ; } inline bool operator!=( const iterator& y) const { return ( index != y.index ) ; } inline bool operator<( const iterator& other ) const { return index < other.index ; } inline bool operator>( const iterator& other ) const { return index > other.index ; } inline bool operator<=( const iterator& other ) const { return index <= other.index ; } inline bool operator>=( const iterator& other ) const { return index >= other.index ; } inline difference_type operator-(const iterator& other) const { return index - other.index ; } private: const T& ref ; R_xlen_t index ; } ; template struct sugar_const_iterator_type { typedef SugarIterator type ; } ; template struct sugar_const_iterator_type< Rcpp::Vector >{ typedef typename Rcpp::Vector::const_iterator type ; } ; template <> struct sugar_const_iterator_type< CharacterVector >{ typedef SEXP* type ; } ; template struct is_sugar_vector : public Rcpp::traits::false_type{} ; template struct is_sugar_vector< Rcpp::Vector > : public Rcpp::traits::true_type{} ; template inline typename sugar_const_iterator_type::type get_const_begin__impl(const T& obj, Rcpp::traits::true_type ){ return obj.begin() ; } template inline typename sugar_const_iterator_type::type get_const_begin__impl(const T& obj, Rcpp::traits::false_type ){ typedef typename sugar_const_iterator_type::type const_iterator ; return const_iterator( obj ) ; } template inline typename sugar_const_iterator_type::type get_const_begin(const T& obj){ return get_const_begin__impl( obj, typename is_sugar_vector::type() ) ; } /* full specialization for character vectors */ template <> inline SEXP* get_const_begin(const CharacterVector& obj){ return get_string_ptr(obj) ; } template inline typename sugar_const_iterator_type::type get_const_end(const T& obj){ return get_const_begin(obj) + obj.size() ; } } } #endif Rcpp/inst/include/Rcpp/sugar/sugar.h0000644000176200001440000000222612253723677017115 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // sugar.h: Rcpp R/C++ interface class library -- main file for Rcpp::sugar // // Copyright (C) 2010 - 2012 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 . #ifndef RCPP_SUGAR_H #define RCPP_SUGAR_H #include #include #include #include #include #include #endif Rcpp/inst/include/Rcpp/sugar/undoRmath.h0000644000176200001440000000561315121245304017717 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // undoRmath.h: Rcpp R/C++ interface class library -- undo the macros set by Rmath.h // // Copyright (C) 2010 - 2011 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 . #ifndef RCPP_SUGAR_UNDORMATH_H #define RCPP_SUGAR_UNDORMATH_H // undo some of the mess of Rmath #undef sign #undef trunc #undef rround #undef prec #undef bessel_i #undef bessel_j #undef bessel_k #undef bessel_y #undef bessel_i_ex #undef bessel_j_ex #undef bessel_k_ex #undef bessel_y_ex #undef beta #undef choose #undef dbeta #undef dbinom #undef dcauchy #undef dchisq #undef dexp #undef df #undef dgamma #undef dgeom #undef dhyper #undef digamma #undef dlnorm #undef dlogis #undef dnbeta #undef dnbinom #undef dnchisq #undef dnf #undef dnorm4 #undef dnt #undef dpois #undef dpsifn #undef dsignrank #undef dt #undef dtukey #undef dunif #undef dweibull #undef dwilcox #undef fmax2 #undef fmin2 #undef fprec #undef fround #undef ftrunc #undef fsign #undef gammafn #undef imax2 #undef imin2 #undef lbeta #undef lchoose #undef lgammafn #undef lgammafn_sign #undef lgamma1p #undef log1pmx #undef logspace_add #undef logspace_sub #undef pbeta #undef pbeta_raw #undef pbinom #undef pcauchy #undef pchisq #undef pentagamma #undef pexp #undef pf #undef pgamma #undef pgeom #undef phyper #undef plnorm #undef plogis #undef pnbeta #undef pnbinom #undef pnchisq #undef pnf #undef pnorm5 #undef pnorm_both #undef pnt #undef ppois #undef psignrank #undef psigamma #undef pt #undef ptukey #undef punif /* #undef pythag */ #undef pweibull #undef pwilcox #undef qbeta #undef qbinom #undef qcauchy #undef qchisq #undef qchisq_appr #undef qexp #undef qf #undef qgamma #undef qgeom #undef qhyper #undef qlnorm #undef qlogis #undef qnbeta #undef qnbinom #undef qnchisq #undef qnf #undef qnorm5 #undef qnt #undef qpois #undef qsignrank #undef qt #undef qtukey #undef qunif #undef qweibull #undef qwilcox #undef rbeta #undef rbinom #undef rcauchy #undef rchisq #undef rexp #undef rf #undef rgamma #undef rgeom #undef rhyper #undef rlnorm #undef rlogis //#undef rnbeta #undef rnbinom #undef rnchisq #undef rnf #undef rnorm #undef rnt #undef rpois #undef rsignrank #undef rt #undef rtukey #undef runif #undef rweibull #undef rwilcox #undef sign #undef tetragamma #undef trigamma #endif Rcpp/inst/include/Rcpp/Benchmark/0000755000176200001440000000000014765550031016362 5ustar liggesusersRcpp/inst/include/Rcpp/Benchmark/Timer.h0000644000176200001440000001041314765550031017612 0ustar liggesusers// Timer.h: Rcpp R/C++ interface class library -- Rcpp benchmark utility // // Copyright (C) 2012 - 2025 JJ Allaire, 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 . #ifndef RCPP_BENCHMARH_TIMER_H #define RCPP_BENCHMARH_TIMER_H #include #include #include #ifndef R_NO_REMAP #define R_NO_REMAP #endif #include #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include #elif defined(__APPLE__) #include #elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__) #include #elif defined(sun) || defined(__sun) || defined(_AIX) #include #else /* Unsupported OS */ #error "Rcpp::Timer not supported by your OS." #endif namespace Rcpp{ typedef uint64_t nanotime_t; #if defined(_WIN32) inline nanotime_t get_nanotime(void) { LARGE_INTEGER time_var, frequency; QueryPerformanceCounter(&time_var); QueryPerformanceFrequency(&frequency); /* Convert to nanoseconds */ return 1.0e9 * time_var.QuadPart / frequency.QuadPart; } #elif defined(__APPLE__) inline nanotime_t get_nanotime(void) { nanotime_t time; mach_timebase_info_data_t info; time = mach_absolute_time(); mach_timebase_info(&info); /* Convert to nanoseconds */ return time * (info.numer / info.denom); } #elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__) static const nanotime_t nanoseconds_in_second = static_cast(1000000000.0); inline nanotime_t get_nanotime(void) { struct timespec time_var; /* Possible other values we could have used are CLOCK_MONOTONIC, * which is takes longer to retrieve and CLOCK_PROCESS_CPUTIME_ID * which, if I understand it correctly, would require the R * process to be bound to one core. */ clock_gettime(CLOCK_REALTIME, &time_var); nanotime_t sec = time_var.tv_sec; nanotime_t nsec = time_var.tv_nsec; /* Combine both values to one nanoseconds value */ return (nanoseconds_in_second * sec) + nsec; } #elif defined(sun) || defined(__sun) || defined(_AIX) /* short an sweet! */ inline nanotime_t get_nanotime(void) { return gethrtime(); } #endif class Timer { public: Timer() : data(), start_time( get_nanotime() ){} Timer(nanotime_t start_time_) : data(), start_time(start_time_){} void step( const std::string& name){ data.push_back(std::make_pair(name, now())); } operator SEXP() const { size_t n = data.size(); NumericVector out(n); CharacterVector names(n); for (size_t i=0; i get_timers(int n){ return std::vector( n, Timer() ) ; } inline nanotime_t now() const { return get_nanotime() ; } inline nanotime_t origin() const { return start_time ; } private: typedef std::pair Step; typedef std::vector Steps; Steps data; const nanotime_t start_time; }; } #ifdef FALSE #undef FALSE #endif #endif Rcpp/inst/include/Rcpp/Rcpp0000644000176200001440000000151014154713250015310 0ustar liggesusers// Rcpp/Rcpp: R/C++ interface class library // // Copyright (C) 2008 - 2021 Dirk Eddelbuettel // Copyright (C) 2009 - 2021 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 . #include Rcpp/inst/include/Rcpp/protection/0000755000176200001440000000000013431002072016640 5ustar liggesusersRcpp/inst/include/Rcpp/protection/protection.h0000644000176200001440000000157312253723677021233 0ustar liggesusers// Copyright (C) 2013 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 . #ifndef Rcpp_protection_protection_H #define Rcpp_protection_protection_H #include #include #include #endif Rcpp/inst/include/Rcpp/protection/Armor.h0000644000176200001440000000264112316773510020111 0ustar liggesusers// Copyright (C) 2013 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 . #ifndef Rcpp_protection_Armor_H #define Rcpp_protection_Armor_H namespace Rcpp { template class Armor { public: Armor() : data(){ init(R_NilValue) ; } template Armor( U x ); inline operator SEXP() const { return data ; } template inline Armor& operator=( const U& x ) ; ~Armor(){ UNPROTECT(1) ; } private: void init(SEXP x){ PROTECT_WITH_INDEX( data = x, &index ) ; } SEXP data ; PROTECT_INDEX index ; // not defined on purpose Armor(const Armor&) ; Armor& operator=(const Armor&) ; } ; } #endif Rcpp/inst/include/Rcpp/protection/Shield.h0000644000176200001440000000271513341030612020227 0ustar liggesusers// Copyright (C) 2013 Romain Francois and Kevin Ushey // // 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 . #ifndef Rcpp__protection_Shield_h #define Rcpp__protection_Shield_h namespace Rcpp{ inline SEXP Rcpp_protect(SEXP x){ if( x != R_NilValue ) PROTECT(x) ; return x ; } inline void Rcpp_unprotect(int i){ // Prefer this function over UNPROTECT() in Rcpp so that all // balance checks errors by rchk are contained at one location (#892) UNPROTECT(i); } template class Shield{ public: Shield( SEXP t_) : t(Rcpp_protect(t_)){} ~Shield(){ if( t != R_NilValue ) Rcpp_unprotect(1) ; } operator SEXP() const { return t; } SEXP t ; private: Shield( const Shield& ) ; Shield& operator=( const Shield& ) ; } ; } #endif Rcpp/inst/include/Rcpp/protection/Shelter.h0000644000176200001440000000240213431002072020415 0ustar liggesusers// Copyright (C) 2013 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 . #ifndef Rcpp_protection_Shelter_H #define Rcpp_protection_Shelter_H namespace Rcpp { template class Shelter { public: Shelter() : nprotected(0) {} inline SEXP operator()(SEXP x) { if (x != R_NilValue) nprotected++; return Rcpp_protect(x); } ~Shelter(){ Rcpp_unprotect(nprotected); nprotected = 0; } private: int nprotected; // not defined on purpose Shelter(const Shelter&) ; Shelter& operator=(const Shelter&) ; }; } #endif Rcpp/inst/include/Rcpp/Nullable.h0000644000176200001440000000755012650522242016400 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Nullable.h: Rcpp R/C++ interface class library -- SEXP container which can be NULL // // Copyright (C) 2015 Dirk Eddelbuettel and Daniel C. Dillon // // 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 . #ifndef Rcpp_Nullable_h #define Rcpp_Nullable_h // We looked into the safe_bool_idiom [1] but found that more trouble than is // warranted here. We first and foremost want an operator SEXP() which got in // the way of redefining operator bool. // [1] http://www.artima.com/cppsource/safebool.html) namespace Rcpp { template class Nullable { public: /** * Empty no-argument constructor of a Nullable object * * Assigns (R's) NULL value, and sets validator to FALSE */ inline Nullable() : m_sexp(R_NilValue), m_set(false) {} /** * Template constructor of a Nullable object * * Assigns object, and set validator to TRUE */ inline Nullable(const T &t) : m_sexp(t), m_set(true) {} /** * Standard constructor of a Nullable object * * @param SEXP is stored */ inline Nullable(SEXP t) { m_sexp = t; m_set = true; } public: /** * Copy constructor for Nullable object * * @param SEXP is used to update internal copy */ inline Nullable &operator=(SEXP sexp) { m_sexp = sexp; m_set = true; return *this; } /** * operator SEXP() to return nullable object * * @throw 'not initialized' if object has not been set */ inline operator SEXP() const { checkIfSet(); return m_sexp; } /** * get() accessor for object * * @throw 'not initialized' if object has not been set */ inline SEXP get() const { checkIfSet(); return m_sexp; } /** * Boolean test for usability as a T */ inline bool isUsable() const { return m_set && !Rf_isNull(m_sexp); } /** * Boolean test for NULL * * @throw 'not initialized' if object has not been set */ inline bool isNull() const { checkIfSet(); return Rf_isNull(m_sexp); } /** * Boolean test for not NULL * * @throw 'not initialized' if object has not been set */ inline bool isNotNull() const { return ! isNull(); } /** * Test function to check if object has been initialized * */ inline bool isSet(void) const { return m_set; } /** * Returns m_sexp as a T */ inline T as() { return get(); } /** * Return a clone of m_sexp as a T */ inline T clone() const { return Rcpp::clone(get()); } private: SEXP m_sexp; bool m_set; inline void checkIfSet(void) const { if (!m_set) { throw ::Rcpp::exception("Not initialized"); } } }; } #endif Rcpp/inst/include/Rcpp/RNGScope.h0000644000176200001440000000244713306213000016246 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // RNGScope.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2016 Douglas Bates, 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 . #ifndef Rcpp__RNGScope_h #define Rcpp__RNGScope_h namespace Rcpp { class RNGScope{ public: RNGScope(){ internal::enterRNGScope(); } ~RNGScope(){ internal::exitRNGScope(); } }; class SuspendRNGSynchronizationScope { public: SuspendRNGSynchronizationScope() { internal::beginSuspendRNGSynchronization(); } ~SuspendRNGSynchronizationScope() { internal::endSuspendRNGSynchronization(); } }; } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/unwindProtect.h0000644000176200001440000000460214770145744017517 0ustar liggesusers // unwind.h: Rcpp R/C++ interface class library -- Unwind Protect // // Copyright (C) 2018 - 2020 RStudio // Copyright (C) 2021 - 2025 RStudio, Dirk Eddelbuettel 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 . #ifndef RCPP_UNWINDPROTECT_H #define RCPP_UNWINDPROTECT_H #include #include namespace Rcpp { namespace internal { struct UnwindData { std::jmp_buf jmpbuf; }; // First jump back to the protected context with a C longjmp because // `Rcpp_protected_eval()` is called from C and we can't safely throw // exceptions across C frames. inline void maybeJump(void* unwind_data, Rboolean jump) { if (jump) { UnwindData* data = static_cast(unwind_data); longjmp(data->jmpbuf, 1); } } inline SEXP unwindProtectUnwrap(void* data) { std::function* callback = (std::function*) data; return (*callback)(); } }} // namespace Rcpp::internal namespace Rcpp { inline SEXP unwindProtect(SEXP (*callback)(void* data), void* data) { internal::UnwindData unwind_data; Shield token(::R_MakeUnwindCont()); if (setjmp(unwind_data.jmpbuf)) { // Keep the token protected while unwinding because R code might run // in C++ destructors. Can't use PROTECT() for this because // UNPROTECT() might be called in a destructor, for instance if a // Shield is on the stack. ::R_PreserveObject(token); throw LongjumpException(token); } return ::R_UnwindProtect(callback, data, internal::maybeJump, &unwind_data, token); } inline SEXP unwindProtect(std::function callback) { return unwindProtect(&internal::unwindProtectUnwrap, &callback); } } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/internal/0000755000176200001440000000000015126566764016320 5ustar liggesusersRcpp/inst/include/Rcpp/internal/wrap_end.h0000644000176200001440000000303112316773510020250 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // wrap_end.h: R/C++ interface class library // // Copyright (C) 2012 - 2013 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 . #ifndef Rcpp_internal_wrap_end_h #define Rcpp_internal_wrap_end_h namespace Rcpp{ template inline SEXP wrap(const T& object){ RCPP_DEBUG_1( "inline SEXP wrap<%s>(const T& object)", DEMANGLE(T) ) return internal::wrap_dispatch( object, typename ::Rcpp::traits::wrap_type_traits::wrap_category() ) ; } template inline SEXP module_wrap_dispatch( const T& obj, Rcpp::traits::normal_wrap_tag ){ return wrap( obj ) ; } template inline SEXP module_wrap_dispatch( const T& obj, Rcpp::traits::pointer_wrap_tag ) { return wrap( object< typename traits::un_pointer::type >( obj ) ) ; } } #endif Rcpp/inst/include/Rcpp/internal/r_coerce.h0000644000176200001440000002040014351164565020236 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // r_coerce.h: Rcpp R/C++ interface class library -- coercion // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel, Romain Francois, and Kevin Ushey // // 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 . #ifndef Rcpp__internal__r_coerce__h #define Rcpp__internal__r_coerce__h namespace Rcpp{ namespace internal{ template typename ::Rcpp::traits::storage_type::type r_coerce( typename ::Rcpp::traits::storage_type::type from ) ; template <> inline int r_coerce(int from) { return from ; } template <> inline int r_coerce(int from) { return from ; } template <> inline double r_coerce(double from) { return from ; } template <> inline Rcomplex r_coerce(Rcomplex from) { return from ; } template <> inline Rbyte r_coerce(Rbyte from) { return from ; } // -> INTSXP template <> inline int r_coerce(int from){ return (from==NA_LOGICAL) ? NA_INTEGER : from ; } template <> inline int r_coerce(double from){ if (Rcpp_IsNA(from)) { return NA_INTEGER; } else if (from > INT_MAX || from <= INT_MIN ) { return NA_INTEGER; } return static_cast(from); } template <> inline int r_coerce(Rcomplex from){ return r_coerce(from.r) ; } template <> inline int r_coerce(Rbyte from){ return static_cast(from); } // -> REALSXP template <> inline double r_coerce(int from){ return from == NA_LOGICAL ? NA_REAL : static_cast(from) ; } template <> inline double r_coerce(int from){ return from == NA_INTEGER ? NA_REAL : static_cast(from) ; } template <> inline double r_coerce(Rcomplex from){ return from.r ; } template <> inline double r_coerce(Rbyte from){ return static_cast(from) ; } // -> LGLSXP template <> inline int r_coerce(double from){ return Rcpp_IsNA(from) ? NA_LOGICAL : (from!=0.0); } template <> inline int r_coerce(int from){ return ( from == NA_INTEGER ) ? NA_LOGICAL : (from!=0); } template <> inline int r_coerce(Rcomplex from){ if( Rcpp_IsNA(from.r) ) return NA_LOGICAL ; if( from.r == 0.0 || from.i == 0.0 ) return FALSE ; return TRUE ; } template <> inline int r_coerce(Rbyte from){ if( from != static_cast(0) ) return TRUE ; return FALSE ; } // -> RAWSXP template <> inline Rbyte r_coerce(int from){ return (from < 0 || from > 255) ? static_cast(0) : static_cast(from) ; } template <> inline Rbyte r_coerce(double from){ if( Rcpp_IsNA(from) ) return static_cast(0) ; return r_coerce(static_cast(from)) ; } template <> inline Rbyte r_coerce(Rcomplex from){ return r_coerce(from.r) ; } template <> inline Rbyte r_coerce(int from){ return static_cast(from == TRUE) ; } // -> CPLXSXP template <> inline Rcomplex r_coerce(double from){ Rcomplex c ; if( Rcpp_IsNA(from) ){ c.r = NA_REAL; c.i = NA_REAL; } else{ c.r = from ; c.i = 0.0 ; } return c ; } template <> inline Rcomplex r_coerce(int from){ Rcomplex c ; if( from == NA_INTEGER ){ c.r = NA_REAL; c.i = NA_REAL; } else{ c.r = static_cast(from) ; c.i = 0.0 ; } return c ; } template <> inline Rcomplex r_coerce(Rbyte from){ Rcomplex c ; c.r = static_cast(from); c.i = 0.0 ; return c ; } template <> inline Rcomplex r_coerce(int from){ Rcomplex c ; if( from == TRUE ){ c.r = 1.0 ; c.i = 0.0 ; } else if( from == FALSE ){ c.r = c.i = 0.0 ; } else { /* NA */ c.r = c.i = NA_REAL; } return c ; } // -> STRSXP template const char* coerce_to_string( typename ::Rcpp::traits::storage_type::type from ) ; inline const char* dropTrailing0(char *s, char cdec) { /* Note that 's' is modified */ char *p = s; for (p = s; *p; p++) { if(*p == cdec) { char *replace = p++; while ('0' <= *p && *p <= '9') if(*(p++) != '0') replace = p; if(replace != p) while((*(replace++) = *(p++))) ; break; } } return s; } inline int integer_width( int n ){ return n < 0 ? ( (int) ( ::log10( -n+0.5) + 2 ) ) : ( (int) ( ::log10( n+0.5) + 1 ) ) ; } template <> inline const char* coerce_to_string(Rcomplex x){ //int wr, dr, er, wi, di, ei; //Rf_formatComplex(&x, 1, &wr, &dr, &er, &wi, &di, &ei, 0); // we are no longer allowed to use this: // Rf_EncodeComplex(x, wr, dr, er, wi, di, ei, '.' ); // so approximate it poorly as static char tmp1[128], tmp2[128], tmp3[256]; //snprintf(tmp, 127, "%*.*f+%*.*fi", wr, dr, x.r, wi, di, x.i); //snprintf(tmp, 127, "%f+%fi", x.r, x.i); // FIXEM: barebones default formatting snprintf(tmp1, 127, "%f", x.r); snprintf(tmp2, 127, "%f", x.i); snprintf(tmp3, 255, "%s+%si", dropTrailing0(tmp1, '.'), dropTrailing0(tmp2, '.')); return tmp3; } template <> inline const char* coerce_to_string(double x){ //int w,d,e ; // cf src/main/format.c in R's sources: // The return values are // w : the required field width // d : use %w.df in fixed format, %#w.de in scientific format // e : use scientific format if != 0, value is number of exp digits - 1 // // nsmall specifies the minimum number of decimal digits in fixed format: // it is 0 except when called from do_format. //Rf_formatReal( &x, 1, &w, &d, &e, 0 ) ; // we are no longer allowed to use this: // char* tmp = const_cast( Rf_EncodeReal(x, w, d, e, '.') ); // so approximate it poorly as static char tmp[128]; snprintf(tmp, 127, "%f", x); if (strcmp( dropTrailing0(tmp, '.'), "-0") == 0) return "0"; else return dropTrailing0(tmp, '.'); } #define NB 1000 template <> inline const char* coerce_to_string(int from) { static char buffer[NB] ; snprintf(buffer, NB, "%*d", integer_width(from), from); return buffer ; } template <> inline const char* coerce_to_string(Rbyte from){ static char buff[3]; snprintf(buff, 3, "%02x", from); return buff; } template <> inline const char* coerce_to_string(int from){ return from == 0 ? "FALSE" : "TRUE" ; } #undef NB template <> inline SEXP r_coerce(SEXP from){ return from ; } template <> inline SEXP r_coerce(Rcomplex from) { return Rcpp::traits::is_na(from) ? NA_STRING : Rf_mkChar( coerce_to_string( from ) ) ; } template <> inline SEXP r_coerce(double from){ // handle some special values explicitly if (Rcpp_IsNaN(from)) return Rf_mkChar("NaN"); else if (from == R_PosInf) return Rf_mkChar("Inf"); else if (from == R_NegInf) return Rf_mkChar("-Inf"); else return Rcpp::traits::is_na(from) ? NA_STRING :Rf_mkChar( coerce_to_string( from ) ) ; } template <> inline SEXP r_coerce(int from){ return Rcpp::traits::is_na(from) ? NA_STRING :Rf_mkChar( coerce_to_string( from ) ) ; } template <> inline SEXP r_coerce(Rbyte from){ return Rf_mkChar( coerce_to_string(from)); } template <> inline SEXP r_coerce(int from){ return Rcpp::traits::is_na(from) ? NA_STRING :Rf_mkChar( coerce_to_string(from)); } template <> inline SEXP r_coerce(SEXP from){ return Rf_ScalarString( PRINTNAME(from) ) ; } } // internal } // Rcpp #endif Rcpp/inst/include/Rcpp/internal/GreedyVector.h0000644000176200001440000000547012316773510021064 0ustar liggesusers// Copyright (C) 2013 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 . #ifndef RCPP_INTERNAL_GREEDYVECTOR_H #define RCPP_INTERNAL_GREEDYVECTOR_H namespace Rcpp { template class GreedyVector { public: typedef typename std::vector::iterator iterator; typedef typename std::vector::const_iterator const_iterator; GreedyVector(SEXP vec) : v(0){ if (!Rf_isNumeric(vec) || Rf_isMatrix(vec) || Rf_isLogical(vec)) throw std::range_error("invalid numeric vector in constructor"); int len = Rf_length(vec); if (len == 0) throw std::range_error("null vector in constructor"); v.resize(len); for (int i = 0; i < len; i++) v[i] = T( static_cast(REAL(vec)[i])); } GreedyVector(int n) : v(n){} inline const T& operator()(int i) const{ return at(i) ; } inline T& operator()(int i){ return at(i) ; } inline const T& operator[](int i) const{ return at(i) ; } inline T& operator[](int i){ return at(i) ; } inline int size() const { return (int)v.size(); } inline iterator begin(){ return v.begin(); } inline iterator end(){ return v.end(); } inline const_iterator begin() const { return v.begin(); } inline const_iterator end() const { return v.end(); } inline operator SEXP() const { return wrap( v ) ; } protected: std::vector v; private: const T& at(int i) const{ if (i < 0 || i >= static_cast(v.size())) { std::ostringstream oss; oss << "subscript out of range: " << i; throw std::range_error(oss.str()); } return v[i]; } T& at(int i) { if (i < 0 || i >= static_cast(v.size())) { std::ostringstream oss; oss << "subscript out of range: " << i; throw std::range_error(oss.str()); } return v[i]; } } ; } #endif Rcpp/inst/include/Rcpp/internal/call.h0000644000176200001440000000403214767256403017377 0ustar liggesusers#ifndef RCPP_INTERNAL_CALL_H #define RCPP_INTERNAL_CALL_H #include #include namespace Rcpp { namespace internal { // Utility struct so that we can pass a pack of types between functions template struct type_pack {}; /** * This specialisation is for functions that return a value, whereas the below * is for void-returning functions. * * The "* = nullptr" default argument allows both templates to be well-defined * regardless of which one is used. */ template ::value>::type* = nullptr> SEXP call_impl(const F& fun, SEXP* args, type_pack, traits::index_sequence) { RESULT_TYPE res = fun((typename traits::input_parameter::type(args[Is]))...); return Rcpp::module_wrap(res); } template ::value>::type* = nullptr> SEXP call_impl(const F& fun, SEXP* args, type_pack, traits::index_sequence) { fun((typename traits::input_parameter::type(args[Is]))...); return R_NilValue; } } // namespace internal /** * Helper for calling a function with an array of SEXP arguments, * where each argument is converted to the appropriate type before being passed * to the function. A compile-time sequence is used to index the SEXP array. * * The function only needs the intended types of the result and arguments, * which allows the template to be used for function pointers, lambdas, and * `std::function` objects. */ template SEXP call(const F& fun, SEXP* args) { return internal::call_impl(fun, args, internal::type_pack{}, traits::make_index_sequence{}); } } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/internal/Proxy_Iterator.h0000644000176200001440000000662014765550031021453 0ustar liggesusers // Proxy_Iterator.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__internal__Proxy_Iterator__h #define Rcpp__internal__Proxy_Iterator__h namespace Rcpp{ namespace internal{ template class Proxy_Iterator { public: typedef PROXY& reference ; typedef PROXY* pointer ; typedef R_xlen_t difference_type ; typedef PROXY value_type; typedef std::random_access_iterator_tag iterator_category ; Proxy_Iterator( ): proxy(){} ; Proxy_Iterator( const Proxy_Iterator& other) : proxy( other.proxy){} Proxy_Iterator( const PROXY& proxy_ ) : proxy( proxy_ ){} ; Proxy_Iterator& operator=( const Proxy_Iterator& other ){ proxy.import( other.proxy ) ; return *this ; } inline Proxy_Iterator& operator++(){ proxy.move(1) ; return *this ; } inline Proxy_Iterator operator++(int){ Proxy_Iterator orig(*this) ; ++(*this) ; return orig ; } inline Proxy_Iterator& operator--(){ proxy.move(-1) ; return *this ; } inline Proxy_Iterator operator--(int){ Proxy_Iterator orig(*this) ; --(*this) ; return orig ; } inline Proxy_Iterator operator+(difference_type n) const { return Proxy_Iterator( PROXY(*proxy.parent, proxy.index + n) ) ; } inline Proxy_Iterator operator-(difference_type n) const { return Proxy_Iterator( PROXY(*proxy.parent, proxy.index - n) ) ; } inline Proxy_Iterator& operator+=(difference_type n) { proxy.move( n ) ; return *this ; } inline Proxy_Iterator& operator-=(difference_type n) { proxy.move( -n ) ; return *this ; } inline reference operator*() { return proxy ; } inline pointer operator->(){ return &proxy ; } inline bool operator==( const Proxy_Iterator& y) const { return ( this->proxy.index == y.proxy.index ) && ( this->proxy.parent == y.proxy.parent ); } inline bool operator!=( const Proxy_Iterator& y) const { return ( this->proxy.index != y.proxy.index ) || ( this->proxy.parent != y.proxy.parent ); } inline bool operator<( const Proxy_Iterator& other ) const { return proxy.index < other.proxy.index ; } inline bool operator>( const Proxy_Iterator& other ) const { return proxy.index > other.proxy.index ; } inline bool operator<=( const Proxy_Iterator& other ) const { return proxy.index <= other.proxy.index ; } inline bool operator>=( const Proxy_Iterator& other ) const { return proxy.index >= other.proxy.index ; } inline difference_type operator-(const Proxy_Iterator& other) const { return proxy.index - other.proxy.index ; } inline int index() const { return proxy.index ; } inline PROXY operator[](R_xlen_t i) const { return PROXY(*proxy.parent, proxy.index + i) ; } private: PROXY proxy ; } ; } } #endif Rcpp/inst/include/Rcpp/internal/Exporter.h0000644000176200001440000000745112336231761020272 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // exporter.h: Rcpp R/C++ interface class library -- identify if a class has a nested iterator typedef // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__internal__exporter__h #define Rcpp__internal__exporter__h namespace Rcpp{ namespace traits{ template class Exporter{ public: Exporter( SEXP x ) : t(x){} inline T get(){ return t ; } private: T t ; } ; template class RangeExporter { public: typedef typename T::value_type r_export_type ; RangeExporter( SEXP x ) : object(x){} ~RangeExporter(){} T get(){ T vec( ::Rf_length(object) ); ::Rcpp::internal::export_range( object, vec.begin() ) ; return vec ; } private: SEXP object ; } ; template class IndexingExporter { public: typedef value_type r_export_type ; IndexingExporter( SEXP x) : object(x){} ~IndexingExporter(){} T get(){ T result( ::Rf_length(object) ) ; ::Rcpp::internal::export_indexing( object, result ) ; return result ; } private: SEXP object ; } ; template class MatrixExporter { public: typedef value_type r_export_type ; MatrixExporter( SEXP x) : object(x){} ~MatrixExporter(){} T get() { Shield dims( ::Rf_getAttrib( object, R_DimSymbol ) ) ; if( Rf_isNull(dims) || ::Rf_length(dims) != 2 ){ throw ::Rcpp::not_a_matrix() ; } int* dims_ = INTEGER(dims) ; T result( dims_[0], dims_[1] ) ; ::Rcpp::internal::export_indexing( object, result ) ; return result ; } private: SEXP object ; } ; template < template class Container, typename T> struct container_exporter{ typedef RangeExporter< Container > > type ; } ; template < template class Container > struct container_exporter< Container, int > ; template < template class Container > struct container_exporter< Container, double > ; template class Exporter< std::vector > : public container_exporter< std::vector, T>::type { public: Exporter(SEXP x) : container_exporter< std::vector, T>::type(x){} }; template class Exporter< std::deque > : public container_exporter< std::deque, T>::type { public: Exporter(SEXP x) : container_exporter< std::deque, T>::type(x){} }; template class Exporter< std::list > : public container_exporter< std::list, T>::type { public: Exporter(SEXP x) : container_exporter< std::list, T>::type(x){} }; } // namespace traits } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/internal/ListInitialization.h0000644000176200001440000000262412336231761022302 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // ListInitialization.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2011 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 . #ifndef Rcpp__internal__ListInitialization__h #define Rcpp__internal__ListInitialization__h namespace Rcpp{ namespace internal{ template class ListInitialization { public: ListInitialization( iterator iter_ ) : iter(iter_) {} ; ListInitialization operator,( value_type x ){ *iter = x ; return ListInitialization( iter + 1 ); } private: iterator iter ; } ; } // internal } // Rcpp #endif Rcpp/inst/include/Rcpp/internal/na.h0000644000176200001440000000214513226746441017060 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // na.h: Rcpp R/C++ interface class library -- optimized na checking // // Copyright (C) 2012-2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey // // 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 . namespace Rcpp { namespace internal { inline bool Rcpp_IsNA(double x) { return R_IsNA(x); } inline bool Rcpp_IsNaN(double x) { return R_IsNaN(x); } } } Rcpp/inst/include/Rcpp/internal/r_vector.h0000644000176200001440000001071714765550031020306 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // r_vector.h: Rcpp R/C++ interface class library -- information about R vectors // // 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 . #ifndef Rcpp__internal__r_vector_h #define Rcpp__internal__r_vector_h namespace Rcpp{ namespace internal{ template typename Rcpp::traits::storage_type::type* r_vector_start(SEXP x) { typedef typename Rcpp::traits::storage_type::type* pointer; return reinterpret_cast(dataptr(x)); } // add specializations to avoid use of dataptr #define RCPP_VECTOR_START_IMPL(__RTYPE__, __ACCESSOR__) \ template <> \ inline typename Rcpp::traits::storage_type<__RTYPE__>::type* r_vector_start<__RTYPE__>(SEXP x) { \ return __ACCESSOR__(x); \ } RCPP_VECTOR_START_IMPL(LGLSXP, LOGICAL); RCPP_VECTOR_START_IMPL(INTSXP, INTEGER); RCPP_VECTOR_START_IMPL(RAWSXP, RAW); RCPP_VECTOR_START_IMPL(CPLXSXP, COMPLEX); RCPP_VECTOR_START_IMPL(REALSXP, REAL); #undef RCPP_VECTOR_START_IMPL /** * The value 0 statically casted to the appropriate type for * the given SEXP type */ template // #nocov start inline CTYPE get_zero() { return static_cast(0); } // #nocov end /** * Specialization for Rcomplex */ template<> inline Rcomplex get_zero(){ Rcomplex x; x.r = 0.0; x.i = 0.0; return x; } /** * Initializes a vector of the given SEXP type. The template fills the * vector with the value 0 of the appropriate type, for example * an INTSXP vector is initialized with (int)0, etc... */ template void r_init_vector(SEXP x) { // #nocov start typedef typename ::Rcpp::traits::storage_type::type CTYPE; CTYPE* start=r_vector_start(x); std::fill(start, start + Rf_xlength(x), get_zero()); } // #nocov end /** * Initializes a generic vector (VECSXP). Does nothing since * R already initializes all elements to NULL */ template<> inline void r_init_vector(SEXP /*x*/) {} /** * Initializes an expression vector (EXPRSXP). Does nothing since * R already initializes all elements to NULL */ template<> inline void r_init_vector(SEXP /*x*/) {} /** * Initializes a character vector (STRSXP). Does nothing since * R already initializes all elements to "" */ template<> inline void r_init_vector(SEXP /*x*/) {} /** * We do not allow List(RTYPE=VECSXP), RawVector(RTYPE=RAWSXP) * or ExpressionVector(RTYPE=EXPRSXP) to be sorted, so it is * desirable to issue a compiler error if user attempts to sort * these types of Vectors. * * We declare a template class without defining the generic * class body, but complete the definition in specialization * of qualified Vector types. Hence when using this class * on unqualified Vectors, the compiler will emit errors. */ template class Sort_is_not_allowed_for_this_type; /** * Specialization for CPLXSXP, INTSXP, LGLSXP, REALSXP, and STRSXP */ template<> class Sort_is_not_allowed_for_this_type { public: static void do_nothing() {} }; template<> class Sort_is_not_allowed_for_this_type { public: static void do_nothing() {} }; template<> class Sort_is_not_allowed_for_this_type { public: static void do_nothing() {} }; template<> class Sort_is_not_allowed_for_this_type { public: static void do_nothing() {} }; template<> class Sort_is_not_allowed_for_this_type { public: static void do_nothing() {} }; } // internal } // Rcpp #endif Rcpp/inst/include/Rcpp/internal/NAEquals.h0000644000176200001440000000233112316773510020124 0ustar liggesusers// NAEquals.h: Rcpp R/C++ interface class library -- for allowing NA == NA // // Copyright (C) 2014 Kevin Ushey // // 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 . #ifndef Rcpp__internal__NAEquals__h #define Rcpp__internal__NAEquals__h namespace Rcpp { namespace internal { template struct NAEquals { inline bool operator()(T left, T right) const { return left == right; } }; // TODO: check different kinds of NA, NaNs template <> struct NAEquals { inline bool operator()(double left, double right) const { return memcmp(&left, &right, sizeof(double)) == 0; } }; } } #endif Rcpp/inst/include/Rcpp/internal/SEXP_Iterator.h0000644000176200001440000000523314765550031021110 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // SEXP_Iterator.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2012 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 . #ifndef Rcpp__internal__SEXP_Iterator__h #define Rcpp__internal__SEXP_Iterator__h namespace Rcpp{ namespace internal{ template class SEXP_Iterator { public: typedef const SEXP& reference ; typedef const SEXP* pointer ; typedef int difference_type ; typedef SEXP value_type; typedef std::random_access_iterator_tag iterator_category ; SEXP_Iterator( ): ptr(){} ; SEXP_Iterator( const SEXP_Iterator& other) : ptr(other.ptr){} ; SEXP_Iterator( const VECTOR& vec ) : ptr( RCPP_VECTOR_PTR(vec) ){} ; SEXP_Iterator& operator=(const SEXP_Iterator& other){ ptr = other.ptr ; return *this ;} int operator-( const SEXP_Iterator& other){ return ptr - other.ptr ; } SEXP_Iterator operator+( int n){ return SEXP_Iterator(ptr+n); } SEXP_Iterator operator-( int n){ return SEXP_Iterator(ptr-n); } SEXP_Iterator& operator++(){ ptr++ ; return *this ; } SEXP_Iterator& operator--(){ ptr-- ; return *this ; } SEXP_Iterator& operator+=(int n){ ptr += n; return *this ; } SEXP_Iterator& operator-=(int n){ ptr -= n; return *this ; } bool operator<( const SEXP_Iterator& other ){ return ptr < other.ptr ; } bool operator>( const SEXP_Iterator& other ){ return ptr > other.ptr ; } bool operator<=( const SEXP_Iterator& other ){ return ptr <= other.ptr ; } bool operator>=( const SEXP_Iterator& other ){ return ptr >= other.ptr ; } reference operator*(){ return *ptr ; } reference operator[](int n){ return ptr[n] ; } bool operator==(const SEXP_Iterator& other) const { return ptr == other.ptr ;} bool operator!=(const SEXP_Iterator& other) const { return ptr != other.ptr ;} private: const SEXP* ptr ; SEXP_Iterator( const SEXP* ptr_) : ptr(ptr_){} } ; } } #endif Rcpp/inst/include/Rcpp/internal/export.h0000644000176200001440000001346515126566764020023 0ustar liggesusers // export.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2010 - 2013 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 . #ifndef Rcpp__internal__export__h #define Rcpp__internal__export__h namespace Rcpp{ namespace internal{ template std::wstring as_string_elt__impl( SEXP x, R_xlen_t i, Rcpp::traits::true_type ){ const char* y = char_get_string_elt( x, i ) ; return std::wstring(y, y+strlen(y) ) ; } template std::string as_string_elt__impl( SEXP x, R_xlen_t i, Rcpp::traits::false_type ){ return char_get_string_elt( x, i ) ; } template const std::basic_string< typename Rcpp::traits::char_type::type > as_string_elt( SEXP x, R_xlen_t i ){ return as_string_elt__impl( x, i, typename Rcpp::traits::is_wide_string::type() ) ; } /* iterating */ template void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::false_type ) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; typedef typename ::Rcpp::traits::storage_type::type STORAGE ; Shield y( ::Rcpp::r_cast(x) ) ; STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; std::copy( start, start + ::Rf_xlength(y), first ) ; } template void export_range__impl( SEXP x, InputIterator first, ::Rcpp::traits::true_type ) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; typedef typename ::Rcpp::traits::storage_type::type STORAGE ; Shield y( ::Rcpp::r_cast(x) ) ; STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; std::transform( start, start + ::Rf_xlength(y) , first, caster ) ; } // implemented in meat template void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_generic_tag ) ; template void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_primitive_tag ) { export_range__impl( x, first, typename ::Rcpp::traits::r_sexptype_needscast() ); } template void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_string_tag ) { if( ! ::Rf_isString( x) ) { // #nocov start const char* fmt = "Expecting a string vector: " "[type=%s; required=STRSXP]."; throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)) ); } // #nocov end R_xlen_t n = ::Rf_xlength(x) ; for( R_xlen_t i=0; i::value_type> ( x, i ) ; } } template void export_range( SEXP x, InputIterator first ) { export_range__dispatch::value_type>( x, first, typename ::Rcpp::traits::r_type_traits::value_type>::r_category() ); } /* indexing */ template void export_indexing__impl( SEXP x, T& res, ::Rcpp::traits::false_type ) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; typedef typename ::Rcpp::traits::storage_type::type STORAGE ; Shield y( ::Rcpp::r_cast(x) ) ; STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; R_xlen_t size = ::Rf_xlength(y) ; for( R_xlen_t i=0; i void export_indexing__impl( SEXP x, T& res, ::Rcpp::traits::true_type ) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype ; typedef typename ::Rcpp::traits::storage_type::type STORAGE ; Shield y( ::Rcpp::r_cast(x) ); STORAGE* start = ::Rcpp::internal::r_vector_start(y) ; R_xlen_t size = ::Rf_xlength(y) ; for( R_xlen_t i=0; i(start[i]) ; } } template void export_indexing__dispatch( SEXP x, T& res, ::Rcpp::traits::r_type_primitive_tag ) { export_indexing__impl( x, res, typename ::Rcpp::traits::r_sexptype_needscast() ); } template void export_indexing__dispatch( SEXP x, T& res, ::Rcpp::traits::r_type_string_tag ) { if( ! ::Rf_isString( x) ) { const char* fmt = "Expecting a string vector: " "[type=%s; required=STRSXP]."; throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)) ); } R_xlen_t n = ::Rf_xlength(x) ; for( R_xlen_t i=0; i( x, i) ; } } template void export_indexing( SEXP x, T& res ) { export_indexing__dispatch( x, res, typename ::Rcpp::traits::r_type_traits::r_category() ); } } } #endif Rcpp/inst/include/Rcpp/internal/NAComparator.h0000644000176200001440000000665312750071673021017 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // NAComparator.h: Rcpp R/C++ interface class library -- comparator // // Copyright (C) 2012-2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey // // 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 . #ifndef Rcpp__internal__NAComparator__h #define Rcpp__internal__NAComparator__h namespace Rcpp { namespace internal { inline int StrCmp(SEXP x, SEXP y) { if (x == NA_STRING) return (y == NA_STRING ? 0 : 1); if (y == NA_STRING) return -1; if (x == y) return 0; // same string in cache return strcmp(char_nocheck(x), char_nocheck(y)); } template struct NAComparator { inline bool operator()(T left, T right) const { return left < right; } }; template <> struct NAComparator { inline bool operator()(int left, int right) const { if (left == NA_INTEGER) return false; if (right == NA_INTEGER) return true; return left < right; } }; template <> struct NAComparator { inline bool operator()(double left, double right) const { bool leftNaN = (left != left); bool rightNaN = (right != right); // this branch inspired by data.table: see // https://github.com/arunsrinivasan/datatable/commit/1a3e476d3f746e18261662f484d2afa84ac7a146#commitcomment-4885242 if (Rcpp_IsNaN(right) and Rcpp_IsNA(left)) return true; if (leftNaN != rightNaN) { return leftNaN < rightNaN; } else { return left < right; } } }; template <> struct NAComparator { inline bool operator()(Rcomplex left, Rcomplex right) const { // sort() in R says that complex numbers are first sorted by // the real parts, and then the imaginary parts. // When only one of the two numbers contains NA or NaN, move // it to the right hand side. // When both left and right contain NA or NaN, return true. bool leftNaN = (left.r != left.r) || (left.i != left.i); bool rightNaN = (right.r != right.r) || (right.i != right.i); if (!(leftNaN || rightNaN)) // if both are nice numbers { if (left.r == right.r) // if real parts are the same return left.i < right.i; else return left.r < right.r; } else return leftNaN <= rightNaN; } }; template <> struct NAComparator { inline bool operator()(SEXP left, SEXP right) const { return StrCmp(left, right) < 0; } }; template struct NAComparatorGreater { inline bool operator()(T left, T right) const { return NAComparator()(right, left); } }; } // internal } // Rcpp #endif // Rcpp__internal__NAComparator__h Rcpp/inst/include/Rcpp/internal/converter.h0000644000176200001440000000253612336231761020470 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // converter.h: Rcpp R/C++ interface class library -- // // Copyright (C) 2012 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 . #ifndef Rcpp_internal_converter_h #define Rcpp_internal_converter_h namespace Rcpp{ namespace internal{ class converter { public: converter( ) : x(R_NilValue){} ; converter( SEXP x_) : x(x_){} ; converter( const converter& other) : x(other.x){} converter& operator=( const converter& other){ x = other.x ; return *this ; } ~converter(){} template operator T(){ return ::Rcpp::as( x ) ; } private: SEXP x ; } ; } // namespace internal } // namespace Rcpp #endif Rcpp/inst/include/Rcpp/internal/wrap.h0000644000176200001440000011543115115301232017416 0ustar liggesusers// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */ // // wrap.h: Rcpp R/C++ interface class library -- wrap implementations // // 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 . #ifndef Rcpp_internal_wrap_h #define Rcpp_internal_wrap_h #include // this is a private header, included in RcppCommon.h // don't include it directly namespace Rcpp { namespace RcppEigen { template SEXP eigen_wrap(const T& object); } template SEXP wrap(const T& object); template class CustomImporter; namespace internal { inline SEXP make_charsexp__impl__wstring(const wchar_t* data) { char* buffer = get_string_buffer(); wcstombs(buffer, data, MAXELTSIZE); return Rf_mkChar(buffer); } inline SEXP make_charsexp__impl__wstring(wchar_t data) { wchar_t x[2]; x[0] = data; x[1] = '\0'; char* buffer = get_string_buffer(); wcstombs(buffer, x, MAXELTSIZE); return Rf_mkChar(buffer); } inline SEXP make_charsexp__impl__wstring(const std::wstring& st) { return make_charsexp__impl__wstring(st.data()); } inline SEXP make_charsexp__impl__cstring(const char* data) { return Rf_mkChar(data); } inline SEXP make_charsexp__impl__cstring(char data) { char x[2]; x[0] = data; x[1] = '\0'; return Rf_mkChar(x); } inline SEXP make_charsexp__impl__cstring(const std::string& st) { return make_charsexp__impl__cstring(st.c_str()); } #if __cplusplus >= 201703L inline SEXP make_charsexp__impl__cstring(std::string_view st) { return Rf_mkCharLen(st.data(), static_cast(st.size())); } #endif template inline SEXP make_charsexp__impl(const T& s, Rcpp::traits::true_type) { return make_charsexp__impl__wstring(s); } template inline SEXP make_charsexp__impl(const T& s, Rcpp::traits::false_type) { return make_charsexp__impl__cstring(s); } template inline SEXP make_charsexp(const T& s) { return make_charsexp__impl(s, typename Rcpp::traits::is_wide_string::type()); } template <> inline SEXP make_charsexp(const Rcpp::String&); template SEXP range_wrap(InputIterator first, InputIterator last); template SEXP rowmajor_wrap(InputIterator first, int nrow, int ncol); // {{{ range wrap // {{{ unnamed range wrap /** * Range based primitive wrap implementation. used when * - T is a primitive type, indicated by the r_type_traits * - T needs a static_cast to be of the type suitable to fit in the R vector * * This produces an unnamed vector of the appropriate type using the * std::transform algorithm */ template inline SEXP primitive_range_wrap__impl(InputIterator first, InputIterator last, ::Rcpp::traits::true_type) { size_t size = std::distance(first, last); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); std::transform(first, last, r_vector_start(x), caster< T, typename ::Rcpp::traits::storage_type::type >); return wrap_extra_steps(x); } template inline SEXP primitive_range_wrap__impl__nocast(InputIterator first, InputIterator last, std::random_access_iterator_tag) { size_t size = std::distance(first, last); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); typedef typename ::Rcpp::traits::storage_type::type STORAGE; R_xlen_t __trip_count = size >> 2; STORAGE* start = r_vector_start(x); R_xlen_t i = 0; for (; __trip_count > 0; --__trip_count) { start[i] = first[i]; i++; start[i] = first[i]; i++; start[i] = first[i]; i++; start[i] = first[i]; i++; } switch (size - i) { case 3: start[i] = first[i]; i++; // fallthrough case 2: start[i] = first[i]; i++; // fallthrough case 1: start[i] = first[i]; i++; // fallthrough case 0: default: {} } return wrap_extra_steps(x); } template inline SEXP primitive_range_wrap__impl__nocast(InputIterator first, InputIterator last, std::input_iterator_tag) { size_t size = std::distance(first, last); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); std::copy(first, last, r_vector_start(x)); return wrap_extra_steps(x); } /** * Range based primitive wrap implementation. used when : * - T is a primitive type * - T does not need a cast * * This produces an unnamed vector of the appropriate type using * the std::copy algorithm */ template inline SEXP primitive_range_wrap__impl(InputIterator first, InputIterator last, ::Rcpp::traits::false_type) { return primitive_range_wrap__impl__nocast(first, last, typename std::iterator_traits::iterator_category()); } /** * Range based wrap implementation that deals with iterator over * primitive types (int, double, etc ...) * * This produces an unnamed vector of the appropriate type */ template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_primitive_tag) { return primitive_range_wrap__impl(first, last, typename ::Rcpp::traits::r_sexptype_needscast()); } /** * range based wrap implementation that deals with iterators over * some type U. each U object is itself wrapped * * This produces an unnamed generic vector (list) */ template inline SEXP range_wrap_dispatch___generic(InputIterator first, InputIterator last) { size_t size = std::distance(first, last); Shield x(Rf_allocVector(VECSXP, size)); size_t i =0; while(i < size) { SET_VECTOR_ELT(x, i, ::Rcpp::wrap(*first)); i++; ++first; } return x; } template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_generic_tag) { return range_wrap_dispatch___generic(first, last); } // modules template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_pointer_tag) { return range_wrap_dispatch___generic(first, last); } template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_const_pointer_tag) { return range_wrap_dispatch___generic(first, last); } template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_tag) { return range_wrap_dispatch___generic(first, last); } template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_reference_tag) { return range_wrap_dispatch___generic(first, last); } template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_module_object_const_reference_tag) { return range_wrap_dispatch___generic(first, last); } /** * Range based wrap implementation for iterators over std::string * * This produces an unnamed character vector */ template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_string_tag) { size_t size = std::distance(first, last); Shield x(Rf_allocVector(STRSXP, size)); size_t i = 0; while(i < size) { SET_STRING_ELT(x, i, make_charsexp(*first)); i++; ++first; } return x; } // }}} // {{{ named range wrap /** * range based wrap implementation that deals with iterators over * pair where T is a primitive type : int, double ... * * This version is used when there is no need to cast T * * This produces a named R vector of the appropriate type */ template // #nocov start inline SEXP range_wrap_dispatch___impl__cast(InputIterator first, InputIterator last, ::Rcpp::traits::false_type) { size_t size = std::distance(first, last); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); Shield names(Rf_allocVector(STRSXP, size)); typedef typename ::Rcpp::traits::storage_type::type CTYPE; CTYPE* start = r_vector_start(x); size_t i =0; std::string buf; for (; i(x); // #nocov end } /** * range based wrap implementation that deals with iterators over * pair where T is a primitive type : int, double ... * * This version is used when T needs to be cast to the associated R * type * * This produces a named R vector of the appropriate type */ template inline SEXP range_wrap_dispatch___impl__cast(InputIterator first, InputIterator last, ::Rcpp::traits::true_type) { size_t size = std::distance(first, last); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); Shield names(Rf_allocVector(STRSXP, size)); typedef typename ::Rcpp::traits::storage_type::type CTYPE; CTYPE* start = r_vector_start(x); size_t i =0; std::string buf; for (; i(first->second); buf = first->first; SET_STRING_ELT(names, i, Rf_mkChar(buf.c_str())); } ::Rf_setAttrib(x, R_NamesSymbol, names); return wrap_extra_steps(x); } /** * range based wrap implementation that deals with iterators over * pair where T is a primitive type : int, double ... * * This dispatches further depending on whether the type needs * a cast to fit into the associated R type * * This produces a named R vector of the appropriate type */ template // #nocov start inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_pairstring_primitive_tag) { return range_wrap_dispatch___impl__cast(first, last, typename ::Rcpp::traits::r_sexptype_needscast()); } // #nocov end /** * Range based wrap implementation that deals with iterators over * pair where U is wrappable. This is the kind of * iterators that are produced by map * * This produces a named generic vector (named list). The first * element of the list contains the result of a call to wrap on the * object of type U, etc ... * * The names are taken from the keys */ template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_pairstring_generic_tag) { size_t size = std::distance(first, last); Shield x(Rf_allocVector(VECSXP, size)); Shield names(Rf_allocVector(STRSXP, size)); size_t i =0; std::string buf; SEXP element = R_NilValue; while(i < size) { // #nocov start element = ::Rcpp::wrap(first->second); buf = first->first; SET_VECTOR_ELT(x, i, element); SET_STRING_ELT(names, i, Rf_mkChar(buf.c_str())); i++; ++first; } // #nocov end ::Rf_setAttrib(x, R_NamesSymbol, names); return x; } /** * Range based wrap for iterators over std::pair * * This is mainly used for wrapping map and friends * which happens to produce iterators over pair * * This produces a character vector containing copies of the * string iterated over. The names of the vector is set to the keys * of the pair */ template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_pairstring_string_tag) { size_t size = std::distance(first, last); Shield x(Rf_allocVector(STRSXP, size)); Shield names(Rf_allocVector(STRSXP, size)); for (size_t i = 0; i < size; i++, ++first) { SET_STRING_ELT(x, i, make_charsexp(first->second)); SET_STRING_ELT(names, i, make_charsexp(first->first)); } ::Rf_setAttrib(x, R_NamesSymbol, names); return x; } /** * iterating over pair * where VALUE is some primitive type */ template inline SEXP range_wrap_dispatch___impl__pair(InputIterator first, InputIterator last, Rcpp::traits::true_type); /** * iterating over pair * where VALUE is a type that needs wrapping */ template inline SEXP range_wrap_dispatch___impl__pair(InputIterator first, InputIterator last, Rcpp::traits::false_type); /** * Range wrap dispatch for iterators over std::pair */ template inline SEXP range_wrap_dispatch___impl(InputIterator first, InputIterator last, ::Rcpp::traits::r_type_pair_tag) { typedef typename T::second_type VALUE; typedef typename T::first_type KEY; return range_wrap_dispatch___impl__pair::rtype >(first, last, typename Rcpp::traits::is_primitive::type()); } // }}} /** * Dispatcher for all range based wrap implementations * * This uses the Rcpp::traits::r_type_traits to perform further dispatch */ template inline SEXP range_wrap_dispatch(InputIterator first, InputIterator last) { #if RCPP_DEBUG_LEVEL > 0 typedef typename ::Rcpp::traits::r_type_traits::r_category categ; #endif RCPP_DEBUG_3("range_wrap_dispatch< InputIterator = \n%s , T = %s, categ = %s>\n", DEMANGLE(InputIterator), DEMANGLE(T), DEMANGLE(categ)); return range_wrap_dispatch___impl(first, last, typename ::Rcpp::traits::r_type_traits::r_category()); } // we use the iterator trait to make the dispatch /** * range based wrap. This uses the std::iterator_traits class * to perform further dispatch */ template inline SEXP range_wrap(InputIterator first, InputIterator last) { return range_wrap_dispatch::value_type>::type >(first, last); } // }}} // {{{ primitive wrap (wrapping a single primitive value) /** * wraps a single primitive value when there is no need for a cast */ template inline SEXP primitive_wrap__impl__cast(const T& object, ::Rcpp::traits::false_type) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, 1)); r_vector_start(x)[0] = object; return x; } /** * wraps a single primitive value when a cast is needed */ template inline SEXP primitive_wrap__impl__cast(const T& object, ::Rcpp::traits::true_type) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; typedef typename ::Rcpp::traits::storage_type::type STORAGE_TYPE; Shield x(Rf_allocVector(RTYPE, 1)); r_vector_start(x)[0] = caster(object); return x; } /** * primitive wrap for 'easy' primitive types: int, double, Rbyte, Rcomplex * * This produces a vector of length 1 of the appropriate type */ template inline SEXP primitive_wrap__impl(const T& object, ::Rcpp::traits::r_type_primitive_tag) { return primitive_wrap__impl__cast(object, typename ::Rcpp::traits::r_sexptype_needscast()); } /** * primitive wrap for types that can be converted implicitely to std::string or std::wstring * * This produces a character vector of length 1 containing the std::string or wstring */ template inline SEXP primitive_wrap__impl(const T& object, ::Rcpp::traits::r_type_string_tag) { Shield x(::Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(x, 0, make_charsexp(object)); return x; } /** * called when T is a primitive type : int, bool, double, std::string, etc ... * This uses the Rcpp::traits::r_type_traits on the type T to perform * further dispatching and wrap the object into an vector of length 1 * of the appropriate SEXP type */ template inline SEXP primitive_wrap(const T& object) { return primitive_wrap__impl(object, typename ::Rcpp::traits::r_type_traits::r_category()); } // }}} // {{{ unknown /** * Called when the type T is known to be implicitely convertible to * SEXP. It uses the implicit conversion to SEXP to wrap the object * into a SEXP */ template inline SEXP wrap_dispatch_unknown(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_unknown<%s>(., false )", DEMANGLE(T)) // here we know (or assume) that T is convertible to SEXP SEXP x = object; return x; } /** * This is the worst case : * - not a primitive * - not implicitely convertible tp SEXP * - not iterable * * so we just give up and attempt to use static_assert to generate * a compile time message if it is available, otherwise we use * implicit conversion to SEXP to bomb the compiler, which will give * quite a cryptic message */ template inline SEXP wrap_dispatch_unknown_iterable(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable<%s>(., false )", DEMANGLE(T)) // here we know that T is not convertible to SEXP static_assert(!sizeof(T), "cannot convert type to SEXP"); return R_NilValue; // -Wall } template inline SEXP wrap_dispatch_unknown_iterable__logical(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable__logical<%s>(., true )", DEMANGLE(T)) size_t size = object.size(); Shield x(Rf_allocVector(LGLSXP, size)); std::copy(object.begin(), object.end(), LOGICAL(x)); return x; } template inline SEXP wrap_range_sugar_expression(const T& object, Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_range_sugar_expression<%s>(., false )", DEMANGLE(T)) return range_wrap(object.begin(), object.end()); } template inline SEXP wrap_range_sugar_expression(const T& object, Rcpp::traits::true_type); template inline SEXP wrap_dispatch_unknown_iterable__logical(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable__logical<%s>(., false )", DEMANGLE(T)) return wrap_range_sugar_expression(object, typename Rcpp::traits::is_sugar_expression::type()); } template inline SEXP wrap_dispatch_unknown_iterable__matrix_interface(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable__matrix_interface<%s>(., false )", DEMANGLE(T)) return wrap_dispatch_unknown_iterable__logical(object, typename ::Rcpp::traits::expands_to_logical::type()); } template inline SEXP wrap_dispatch_matrix_logical(const T& object, ::Rcpp::traits::true_type) { int nr = object.nrow(), nc = object.ncol(); Shield res(Rf_allocVector(LGLSXP, nr * nc)); int k=0; int* p = LOGICAL(res); for (int j=0; j dim(Rf_allocVector(INTSXP, 2)); INTEGER(dim)[0] = nr; INTEGER(dim)[1] = nc; Rf_setAttrib(res, R_DimSymbol , dim); return res; } template inline SEXP wrap_dispatch_matrix_primitive(const T& object) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; int nr = object.nrow(), nc = object.ncol(); Shield res(Rf_allocVector(RTYPE, nr*nc)); int k=0; STORAGE* p = r_vector_start< RTYPE>(res); for (int j=0; j dim(Rf_allocVector(INTSXP, 2)); INTEGER(dim)[0] = nr; INTEGER(dim)[1] = nc; Rf_setAttrib(res, R_DimSymbol , dim); return res; } template inline SEXP wrap_dispatch_matrix_not_logical(const T& object, ::Rcpp::traits::r_type_primitive_tag) { return wrap_dispatch_matrix_primitive(object); } template inline SEXP wrap_dispatch_matrix_not_logical(const T& object, ::Rcpp::traits::r_type_string_tag) { int nr = object.nrow(), nc = object.ncol(); Shield res(Rf_allocVector(STRSXP, nr*nc)); int k=0; for (int j=0; j dim(Rf_allocVector(INTSXP, 2)); INTEGER(dim)[0] = nr; INTEGER(dim)[1] = nc; Rf_setAttrib(res, R_DimSymbol , dim); return res; } template inline SEXP wrap_dispatch_matrix_not_logical(const T& object, ::Rcpp::traits::r_type_generic_tag) { int nr = object.nrow(), nc = object.ncol(); Shield res(Rf_allocVector(VECSXP, nr*nc)); int k=0; for (int j=0; j dim(Rf_allocVector(INTSXP, 2)); INTEGER(dim)[0] = nr; INTEGER(dim)[1] = nc; Rf_setAttrib(res, R_DimSymbol , dim); return res; } template inline SEXP wrap_dispatch_matrix_logical(const T& object, ::Rcpp::traits::false_type) { return wrap_dispatch_matrix_not_logical(object, typename ::Rcpp::traits::r_type_traits::r_category()); } template inline SEXP wrap_dispatch_unknown_iterable__matrix_interface(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable__matrix_interface<%s>(., true )", DEMANGLE(T)) return wrap_dispatch_matrix_logical(object, typename ::Rcpp::traits::expands_to_logical::type()); } /** * Here we know for sure that type T has a T::iterator typedef * so we hope for the best and call the range based wrap with begin * and end * * This works fine for all stl containers and classes T that have : * - T::iterator * - T::iterator begin() * - T::iterator end() * * If someone knows a better way, please advise */ template inline SEXP wrap_dispatch_unknown_iterable(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_iterable<%s>(., true )", DEMANGLE(T)) return wrap_dispatch_unknown_iterable__matrix_interface(object, typename ::Rcpp::traits::matrix_interface::type()); } template inline SEXP wrap_dispatch_importer__impl__prim(const T& object, ::Rcpp::traits::false_type) { int size = object.size(); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); typedef typename ::Rcpp::traits::storage_type::type CTYPE; CTYPE* start = r_vector_start(x); for (int i=0; i inline SEXP wrap_dispatch_importer__impl__prim(const T& object, ::Rcpp::traits::true_type) { int size = object.size(); const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield x(Rf_allocVector(RTYPE, size)); typedef typename ::Rcpp::traits::storage_type::type CTYPE; CTYPE* start = r_vector_start(x); for (int i=0; i(object.get(i)); } return x; } template inline SEXP wrap_dispatch_importer__impl(const T& object, ::Rcpp::traits::r_type_primitive_tag) { return wrap_dispatch_importer__impl__prim(object, typename ::Rcpp::traits::r_sexptype_needscast()); } template inline SEXP wrap_dispatch_importer__impl(const T& object, ::Rcpp::traits::r_type_string_tag) { int size = object.size(); Shield x(Rf_allocVector(STRSXP, size)); for (int i=0; i inline SEXP wrap_dispatch_importer__impl(const T& object, ::Rcpp::traits::r_type_generic_tag) { int size = object.size(); Shield x(Rf_allocVector(VECSXP, size)); for (int i=0; i inline SEXP wrap_dispatch_importer(const T& object) { return wrap_dispatch_importer__impl(object, typename ::Rcpp::traits::r_type_traits::r_category()); } /** * Called when no implicit conversion to SEXP is possible and this is * not tagged as a primitive type, checks whether the type is * iterable */ template inline SEXP wrap_dispatch_unknown(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_unknown<%s>(., false )", DEMANGLE(T)) return wrap_dispatch_unknown_iterable(object, typename ::Rcpp::traits::has_iterator::type()); } // }}} // {{{ wrap dispatch /** * wrapping a __single__ primitive type : int, double, std::string, size_t, * Rbyte, Rcomplex */ template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_primitive_tag) { return primitive_wrap(object); } template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_char_array) { return Rf_mkString(object); } template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_module_object_pointer_tag) { return Rcpp::internal::make_new_object< typename T::object_type >(object.ptr); } template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_module_object_tag) { return Rcpp::internal::make_new_object(new T(object)); } template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_enum_tag) { return wrap((int)object); } template inline SEXP wrap_dispatch_eigen(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_eigen<%s>(., false )", DEMANGLE(T)) return wrap_dispatch_unknown(object, typename ::Rcpp::traits::is_convertible::type()); } template inline SEXP wrap_dispatch_eigen(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_eigen<%s>(., true )", DEMANGLE(T)) return ::Rcpp::RcppEigen::eigen_wrap(object); } /** * called when T is wrap_type_unknown_tag and is not an Importer class * The next step is to try implicit conversion to SEXP */ template inline SEXP wrap_dispatch_unknown_importable(const T& object, ::Rcpp::traits::false_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_importable<%s>(., false )", DEMANGLE(T)) return wrap_dispatch_eigen(object, typename traits::is_eigen_base::type()); } /** * called when T is an Importer */ template inline SEXP wrap_dispatch_unknown_importable(const T& object, ::Rcpp::traits::true_type) { RCPP_DEBUG_1("wrap_dispatch_unknown_importable<%s>(., true )", DEMANGLE(T)) return wrap_dispatch_importer(object); } /** * This is called by wrap when the wrap_type_traits is wrap_type_unknown_tag * * This tries to identify if the object conforms to the Importer class */ template inline SEXP wrap_dispatch(const T& object, ::Rcpp::traits::wrap_type_unknown_tag) { RCPP_DEBUG_1("wrap_dispatch<%s>(., wrap_type_unknown_tag)", DEMANGLE(T)) return wrap_dispatch_unknown_importable(object, typename ::Rcpp::traits::is_importer::type()); } // }}} // {{{ wrap a container that is structured in row major order template inline SEXP rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::r_type_generic_tag) { Shield out(::Rf_allocVector(VECSXP, nrow * ncol)); int i=0, j=0; for (j=0; j dims(::Rf_allocVector(INTSXP, 2)); INTEGER(dims)[0] = nrow; INTEGER(dims)[1] = ncol; ::Rf_setAttrib(out, R_DimSymbol, dims); return out; } template inline SEXP rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::r_type_string_tag) { Shield out(::Rf_allocVector(STRSXP, nrow * ncol)); int i=0, j=0; for (j=0; j dims(::Rf_allocVector(INTSXP, 2)); INTEGER(dims)[0] = nrow; INTEGER(dims)[1] = ncol; ::Rf_setAttrib(out, R_DimSymbol, dims); return out; } template inline SEXP primitive_rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::false_type) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; Shield out(::Rf_allocVector(RTYPE, nrow * ncol)); value_type* ptr = r_vector_start(out); int i=0, j=0; for (j=0; j dims(::Rf_allocVector(INTSXP, 2)); INTEGER(dims)[0] = nrow; INTEGER(dims)[1] = ncol; ::Rf_setAttrib(out, R_DimSymbol, dims); return out; } template inline SEXP primitive_rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::true_type) { const int RTYPE = ::Rcpp::traits::r_sexptype_traits::rtype; typedef typename ::Rcpp::traits::storage_type::type STORAGE; Shield out(::Rf_allocVector(RTYPE, nrow * ncol)); STORAGE* ptr = r_vector_start(out); int i=0, j=0; for (j=0; j(*first); } } Shield dims(::Rf_allocVector(INTSXP, 2)); INTEGER(dims)[0] = nrow; INTEGER(dims)[1] = ncol; ::Rf_setAttrib(out, R_DimSymbol, dims); return out; } template inline SEXP rowmajor_wrap__dispatch(InputIterator first, int nrow, int ncol, ::Rcpp::traits::r_type_primitive_tag) { return primitive_rowmajor_wrap__dispatch(first, nrow, ncol, typename ::Rcpp::traits::r_sexptype_needscast()); } template inline SEXP rowmajor_wrap(InputIterator first, int nrow, int ncol) { typedef typename std::iterator_traits::value_type VALUE_TYPE; return rowmajor_wrap__dispatch(first, nrow, ncol, typename ::Rcpp::traits::r_type_traits::r_category()); } // }}} } // internal /** * wraps an object of type T in a SEXP * * This method depends on the Rcpp::traits::wrap_type_traits trait * class to dispatch to the appropriate internal implementation * method * */ template inline SEXP wrap(const T& object); template <> inline SEXP wrap(const Rcpp::String& object); template inline SEXP module_wrap_dispatch(const T& obj, Rcpp::traits::void_wrap_tag) { return R_NilValue; } // these are defined in wrap_end.h template inline SEXP module_wrap_dispatch(const T& obj, Rcpp::traits::pointer_wrap_tag); template inline SEXP module_wrap_dispatch(const T& obj, Rcpp::traits::normal_wrap_tag); template inline SEXP module_wrap(const T& obj) { return module_wrap_dispatch(obj, typename Rcpp::traits::module_wrap_traits::category()); } template <> inline SEXP module_wrap(const SEXP& obj) { return obj; } inline SEXP wrap(const char* const v) { if (v != NULL) return Rf_mkString(v); else return R_NilValue; // #nocov } /** * Range based version of wrap */ template inline SEXP wrap(InputIterator first, InputIterator last) { return internal::range_wrap(first, last); } } // Rcpp #endif Rcpp/inst/include/Rcpp/internal/caster.h0000644000176200001440000000357015126566764017757 0ustar liggesusers // caster.h: Rcpp R/C++ interface class library -- // // 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 . #ifndef Rcpp__internal__caster__h #define Rcpp__internal__caster__h namespace Rcpp{ namespace internal{ template TO caster(FROM from){ // #nocov start return static_cast(from) ; } // #nocov end template inline Rcomplex Rcomplex_caster( std::complex from ){ Rcomplex cx ; cx.r = (double)from.real() ; cx.i = (double)from.imag() ; return cx ; } template <> inline Rcomplex caster, Rcomplex>( std::complex from){ return Rcomplex_caster(from) ; } template<> inline Rcomplex caster, Rcomplex>( std::complex from){ return Rcomplex_caster(from) ; } template inline std::complex std_complex_caster( Rcomplex from ){ return std::complex( static_cast(from.r), static_cast(from.i) ) ; } template <> inline std::complex caster >( Rcomplex from){ return std_complex_caster(from); } template<> inline std::complex caster >( Rcomplex from){ return std_complex_caster(from) ; } } } #endif Rcpp/inst/include/Rcpp/StringTransformer.h0000644000176200001440000000301314771021271020323 0ustar liggesusers // clone.h: Rcpp R/C++ interface class library -- clone RObject's // // Copyright (C) 2010 - 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 . #ifndef Rcpp__StringTransformer_h #define Rcpp__StringTransformer_h #include namespace Rcpp{ template class StringTransformer : public std::function { public: StringTransformer( const UnaryOperator& op_ ): op(op_), buffer(){} ~StringTransformer(){} const char* operator()(const char* input ) { buffer = input; std::transform( buffer.begin(), buffer.end(), buffer.begin(), op ); return buffer.c_str(); } private: const UnaryOperator& op; std::string buffer; }; template StringTransformer make_string_transformer( const UnaryOperator& fun){ return StringTransformer( fun ); } } #endif Rcpp/inst/include/Rcpp/routines.h0000644000176200001440000002345515122260323016510 0ustar liggesusers // routines.h: Rcpp R/C++ interface class library -- callable function setup // // Copyright (C) 2013 - 2014 Romain Francois // Copyright (C) 2015 - 2020 Romain Francois and Dirk Eddelbuettel // Copyright (C) 2021 Romain Francois, Dirk Eddelbuettel 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 . #ifndef RCPP_ROUTINE_H #define RCPP_ROUTINE_H #include #if defined(COMPILING_RCPP) // the idea is that this file should be generated automatically by Rcpp::register namespace Rcpp{ const char* type2name(SEXP x); namespace internal{ unsigned long enterRNGScope(); unsigned long exitRNGScope(); unsigned long beginSuspendRNGSynchronization(); unsigned long endSuspendRNGSynchronization(); char* get_string_buffer(); SEXP get_Rcpp_namespace(); } double mktime00(struct tm &); struct tm * gmtime_(const time_t * const); void Rcpp_precious_init(); void Rcpp_precious_teardown(); SEXP Rcpp_precious_preserve(SEXP object); void Rcpp_precious_remove(SEXP token); Rostream& Rcpp_cout_get(); Rostream& Rcpp_cerr_get(); } SEXP rcpp_get_stack_trace(); SEXP rcpp_set_stack_trace(SEXP); std::string demangle(const std::string& name); const char* short_file_name(const char* ); int* get_cache(int n); SEXP stack_trace( const char *file = "", int line = -1); SEXP get_string_elt(SEXP s, R_xlen_t i); const char* char_get_string_elt(SEXP s, R_xlen_t i); void set_string_elt(SEXP s, R_xlen_t i, SEXP v); void char_set_string_elt(SEXP s, R_xlen_t i, const char* v); SEXP* get_string_ptr(SEXP s); SEXP get_vector_elt(SEXP v, R_xlen_t i); void set_vector_elt(SEXP v, R_xlen_t i, SEXP x); SEXP* get_vector_ptr(SEXP v); const char* char_nocheck(SEXP x); void* dataptr(SEXP x); Rcpp::Module* getCurrentScope(); void setCurrentScope( Rcpp::Module* mod ); SEXP reset_current_error(); int error_occured(); SEXP rcpp_get_current_error(); // void print(SEXP s); #else namespace Rcpp { #define GET_CALLABLE(__FUN__) (Fun) R_GetCCallable( "Rcpp", __FUN__ ) inline attribute_hidden const char* type2name(SEXP x){ typedef const char* (*Fun)(SEXP); static Fun fun = GET_CALLABLE("type2name"); return fun(x); } namespace internal{ inline attribute_hidden unsigned long enterRNGScope(){ typedef unsigned long (*Fun)(void); static Fun fun = GET_CALLABLE("enterRNGScope"); return fun(); } inline attribute_hidden unsigned long exitRNGScope(){ typedef unsigned long (*Fun)(void); static Fun fun = GET_CALLABLE("exitRNGScope"); return fun(); } inline attribute_hidden unsigned long beginSuspendRNGSynchronization(){ typedef unsigned long (*Fun)(void); static Fun fun = GET_CALLABLE("beginSuspendRNGSynchronization"); return fun(); } inline attribute_hidden unsigned long endSuspendRNGSynchronization(){ typedef unsigned long (*Fun)(void); static Fun fun = GET_CALLABLE("endSuspendRNGSynchronization"); return fun(); } inline attribute_hidden char* get_string_buffer(){ typedef char* (*Fun)(void); static Fun fun = GET_CALLABLE("get_string_buffer"); return fun(); } inline attribute_hidden SEXP get_Rcpp_namespace() { typedef SEXP (*Fun)(void); static Fun fun = GET_CALLABLE("get_Rcpp_namespace"); return fun(); } } inline attribute_hidden double mktime00(struct tm &tm){ typedef double (*Fun)(struct tm&); static Fun fun = GET_CALLABLE("mktime00"); return fun(tm); } inline attribute_hidden struct tm * gmtime_(const time_t * const x){ typedef struct tm* (*Fun)(const time_t* const); static Fun fun = GET_CALLABLE("gmtime_"); return fun(x); } inline attribute_hidden void Rcpp_precious_init() { typedef void (*Fun)(void); static Fun fun = GET_CALLABLE("Rcpp_precious_init"); fun(); } inline attribute_hidden void Rcpp_precious_teardown() { typedef void (*Fun)(void); static Fun fun = GET_CALLABLE("Rcpp_precious_teardown"); fun(); } inline attribute_hidden SEXP Rcpp_precious_preserve(SEXP object) { typedef SEXP (*Fun)(SEXP); static Fun fun = GET_CALLABLE("Rcpp_precious_preserve"); return fun(object); } inline attribute_hidden void Rcpp_precious_remove(SEXP token) { typedef void (*Fun)(SEXP); static Fun fun = GET_CALLABLE("Rcpp_precious_remove"); fun(token); } inline attribute_hidden Rostream& Rcpp_cout_get() { typedef Rostream& (*Fun)(); static Fun fun = GET_CALLABLE("Rcpp_cout_get"); return fun(); } inline attribute_hidden Rostream& Rcpp_cerr_get() { typedef Rostream& (*Fun)(); static Fun fun = GET_CALLABLE("Rcpp_cerr_get"); return fun(); } } // The 'attribute_hidden' used here is a simple precessor defined from // ${R_HOME}/include/R_ext/Visibility.h -- it is empty when not supported // by the compiler and otherwise '__attribute__ ((visibility ("hidden")))' inline attribute_hidden SEXP rcpp_get_stack_trace(){ typedef SEXP (*Fun)(void); static Fun fun = GET_CALLABLE("rcpp_get_stack_trace"); return fun(); } inline attribute_hidden SEXP rcpp_set_stack_trace(SEXP e){ typedef SEXP (*Fun)(SEXP); static Fun fun = GET_CALLABLE("rcpp_set_stack_trace"); return fun(e); } inline attribute_hidden std::string demangle( const std::string& name){ typedef std::string (*Fun)( const std::string& ); static Fun fun = GET_CALLABLE("demangle"); return fun(name); } inline attribute_hidden const char* short_file_name(const char* file) { typedef const char* (*Fun)(const char*); static Fun fun = GET_CALLABLE("short_file_name"); return fun(file); } inline attribute_hidden SEXP stack_trace( const char *file = "", int line = -1){ typedef SEXP (*Fun)(const char*, int); static Fun fun = GET_CALLABLE("stack_trace"); return fun(file, line); } inline attribute_hidden SEXP get_string_elt(SEXP s, R_xlen_t i){ typedef SEXP (*Fun)(SEXP, R_xlen_t); static Fun fun = GET_CALLABLE("get_string_elt"); return fun(s, i); } inline attribute_hidden const char* char_get_string_elt(SEXP s, R_xlen_t i){ typedef const char* (*Fun)(SEXP, R_xlen_t); static Fun fun = GET_CALLABLE("char_get_string_elt"); return fun(s, i); } inline attribute_hidden void set_string_elt(SEXP s, R_xlen_t i, SEXP v){ typedef void (*Fun)(SEXP, R_xlen_t, SEXP); static Fun fun = GET_CALLABLE("set_string_elt"); fun(s, i, v); } inline attribute_hidden void char_set_string_elt(SEXP s, R_xlen_t i, const char* v){ typedef void (*Fun)(SEXP, R_xlen_t, const char*); static Fun fun = GET_CALLABLE("char_set_string_elt"); fun(s, i, v ); } inline attribute_hidden SEXP* get_string_ptr(SEXP s){ typedef SEXP* (*Fun)(SEXP); static Fun fun = GET_CALLABLE("get_string_ptr"); return fun(s); } inline attribute_hidden SEXP get_vector_elt(SEXP v, R_xlen_t i){ typedef SEXP (*Fun)(SEXP, R_xlen_t); static Fun fun = GET_CALLABLE("get_vector_elt"); return fun(v, i); } inline attribute_hidden void set_vector_elt(SEXP v, R_xlen_t i, SEXP x){ typedef void (*Fun)(SEXP, R_xlen_t, SEXP); static Fun fun = GET_CALLABLE("set_vector_elt"); fun(v, i, x); } inline attribute_hidden SEXP* get_vector_ptr(SEXP v){ typedef SEXP* (*Fun)(SEXP); static Fun fun = GET_CALLABLE("get_vector_ptr"); return fun(v); } inline attribute_hidden const char* char_nocheck( SEXP x){ typedef const char* (*Fun)(SEXP); static Fun fun = GET_CALLABLE("char_nocheck"); return fun(x); } inline attribute_hidden void* dataptr(SEXP x){ typedef void* (*Fun)(SEXP); static Fun fun = GET_CALLABLE("dataptr"); return fun(x); } inline attribute_hidden Rcpp::Module* getCurrentScope(){ typedef Rcpp::Module* (*Fun)(void); static Fun fun = GET_CALLABLE("getCurrentScope"); return fun(); } inline attribute_hidden void setCurrentScope( Rcpp::Module* mod ){ typedef void (*Fun)(Rcpp::Module*); static Fun fun = GET_CALLABLE("setCurrentScope"); fun(mod); } inline attribute_hidden int* get_cache( int n ){ typedef int* (*Fun)(int); static Fun fun = GET_CALLABLE("get_cache"); return fun(n); } inline attribute_hidden SEXP reset_current_error(){ typedef SEXP (*Fun)(void); static Fun fun = GET_CALLABLE("reset_current_error"); return fun(); } inline attribute_hidden int error_occured(){ typedef int (*Fun)(void); static Fun fun = GET_CALLABLE("error_occured"); return fun(); } inline attribute_hidden SEXP rcpp_get_current_error(){ typedef SEXP (*Fun)(void); static Fun fun = GET_CALLABLE("rcpp_get_current_error"); return fun(); } // inline attribute_hidden void print(SEXP s) { // typedef void (*Fun)(SEXP); // static Fun fun = GET_CALLABLE("print"); // fun(s); // } #endif #endif Rcpp/inst/include/Rcpp/api/0000755000176200001440000000000012253723677015251 5ustar liggesusersRcpp/inst/include/Rcpp/api/meat/0000755000176200001440000000000015127275607016175 5ustar liggesusersRcpp/inst/include/Rcpp/api/meat/S4.h0000644000176200001440000000300412316773510016622 0ustar liggesusers// Copyright (C) 2013 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 . #ifndef Rcpp_api_meat_S4_h #define Rcpp_api_meat_S4_h namespace Rcpp{ template