From: <li...@us...> - 2007-09-13 16:53:07
|
Revision: 48 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=48&view=rev Author: ligges Date: 2007-09-13 09:53:03 -0700 (Thu, 13 Sep 2007) Log Message: ----------- We need to overwrite sQuote within the Namespace: R-alpha has a fancy sQuote intended for human readable fancy quoting only. We do NOT export this version of sQuote!!! Modified Paths: -------------- trunk/BRugs/R/zzz.R Modified: trunk/BRugs/R/zzz.R =================================================================== --- trunk/BRugs/R/zzz.R 2007-09-13 16:47:55 UTC (rev 47) +++ trunk/BRugs/R/zzz.R 2007-09-13 16:53:03 UTC (rev 48) @@ -1,51 +1,56 @@ if (is.R()){ -".onLoad" <- function(lib, pkg){ - ## Don't know whether we have to do this before useDynLib()??? - #Sys.putenv("LD_ASSUME_KERNEL"="2.4.1") - ## sets path / file variables and initializes subsystems - root <- file.path(system.file("OpenBUGS", package=pkg)) - ## we do have a NAMESPACE now: library.dynam("BRugs", pkg, lib) - len <- nchar(root) - tempDir <- gsub("\\\\", "/", tempdir()) - .C("SetRoot", as.character(root), len, PACKAGE="BRugs") - .C("SetTempDir", as.character(tempDir), nchar(tempDir), PACKAGE="BRugs") - command <- "BugsMappers.SetDest(2)" - .C("CmdInterpreter", as.character(command), nchar(command), integer(1), PACKAGE="BRugs") - #.C("Initialize", as.character(root), as.character(tempDir), - # as.integer(len), nchar(tempDir), PACKAGE="BRugs") - if(is.null(getOption("BRugsVerbose"))) - options("BRugsVerbose" = TRUE) -} + ".onLoad" <- function(lib, pkg){ + ## Don't know whether we have to do this before useDynLib()??? + #Sys.putenv("LD_ASSUME_KERNEL"="2.4.1") + ## sets path / file variables and initializes subsystems + root <- file.path(system.file("OpenBUGS", package=pkg)) + ## we do have a NAMESPACE now: library.dynam("BRugs", pkg, lib) + len <- nchar(root) + tempDir <- gsub("\\\\", "/", tempdir()) + .C("SetRoot", as.character(root), len, PACKAGE="BRugs") + .C("SetTempDir", as.character(tempDir), nchar(tempDir), PACKAGE="BRugs") + command <- "BugsMappers.SetDest(2)" + .C("CmdInterpreter", as.character(command), nchar(command), integer(1), PACKAGE="BRugs") + #.C("Initialize", as.character(root), as.character(tempDir), + # as.integer(len), nchar(tempDir), PACKAGE="BRugs") + if(is.null(getOption("BRugsVerbose"))) + options("BRugsVerbose" = TRUE) + } + + ".onAttach" <- function(lib, pkg){ + message("Welcome to BRugs running on OpenBUGS version 3.0.1") + } + + ".onUnload" <- function(libpath){ + library.dynam.unload("BRugs", libpath) + } -".onAttach" <- function(lib, pkg){ - message("Welcome to BRugs running on OpenBUGS version 3.0.1") -} + ## Overwriting new (from R-2.6.0) sQuote (for typing human readable text) in R within the BRugs Namespace! + ## we cannot use sQuote that uses fancy quotes! + sQuote <- function(x) paste("'", x, "'", sep="") + -".onUnload" <- function(libpath){ - library.dynam.unload("BRugs", libpath) -} - } else { # ends if (is.R()) -".First.lib" <- function(lib.loc, section) -{ - dyn.open(system.file("OpenBUGS", "brugs.dll", package="BRugs")) - ## sets path / file variables and initializes subsystems - root <- file.path(system.file("OpenBUGS", package="BRugs")) - len <- nchar(root) - tempDir <- gsub("\\\\", "/", tempdir()) - .C("SetRoot", as.character(root), len) - .C("SetTempDir", as.character(tempDir), nchar(tempDir)) - command <- "BugsMappers.SetDest(2)" - .C("CmdInterpreter", as.character(command), nchar(command), integer(1)) - if(is.null(getOption("BRugsVerbose"))) - options("BRugsVerbose" = TRUE) - invisible() -} + ".First.lib" <- function(lib.loc, section) + { + dyn.open(system.file("OpenBUGS", "brugs.dll", package="BRugs")) + ## sets path / file variables and initializes subsystems + root <- file.path(system.file("OpenBUGS", package="BRugs")) + len <- nchar(root) + tempDir <- gsub("\\\\", "/", tempdir()) + .C("SetRoot", as.character(root), len) + .C("SetTempDir", as.character(tempDir), nchar(tempDir)) + command <- "BugsMappers.SetDest(2)" + .C("CmdInterpreter", as.character(command), nchar(command), integer(1)) + if(is.null(getOption("BRugsVerbose"))) + options("BRugsVerbose" = TRUE) + invisible() + } + + .tempDir <- getwd() + + tempdir <- function(){ .tempDir } -.tempDir <- getwd() - -tempdir <- function(){ .tempDir } - } # ends else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |