From: <li...@us...> - 2007-09-14 09:44:25
|
Revision: 51 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=51&view=rev Author: ligges Date: 2007-09-14 02:44:27 -0700 (Fri, 14 Sep 2007) Log Message: ----------- modelNames rewritten to work with OpenBUGS 3.x.y Modified Paths: -------------- trunk/BRugs/R/model.names.R Modified: trunk/BRugs/R/model.names.R =================================================================== --- trunk/BRugs/R/model.names.R 2007-09-14 09:43:56 UTC (rev 50) +++ trunk/BRugs/R/model.names.R 2007-09-14 09:44:27 UTC (rev 51) @@ -2,8 +2,19 @@ function() { # gets names in OpenBUGS model - command <- "BugsRobjects.Names" - .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") - buffer <- file.path(tempdir(), "buffer.txt") - readLines(buffer) + command <- "BugsRobjects.GetNumberNames" + number <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]] + name <- character(number) + if(length(number)){ + for(i in 1:number){ + command <- paste("BugsRobjects.SetIndex(", i-1, ")", sep="") + .C("CmdInterpreter", command, nchar(command), integer(1), PACKAGE="BRugs") + command <- "BugsRobjects.GetStringLength" + numchar <- .C("Integer", command, nchar(command), integer(1), integer(1), PACKAGE="BRugs")[[3]] + command <- "BugsRobjects.GetVariable" + char <- paste(rep(" ", numchar), collapse="") + name[i] <- .C("CharArray", command, nchar(command), char, numchar, integer(1), PACKAGE="BRugs")[[3]] + } + } + return(name) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |