Christophe
Weblog
Wiki
Code
Publications
Music
projects
/
swankr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new function `swank:init-presentations`
[swankr.git]
/
swank-presentations.R
diff --git
a/swank-presentations.R
b/swank-presentations.R
index 0832fafd931b59bcb6177f4b13781d8a9bec4417..22ce24c2b9a4d56dce5ef4f1f558896aac876a0b 100644
(file)
--- a/
swank-presentations.R
+++ b/
swank-presentations.R
@@
-4,6
+4,8
@@
savePresentedObject <- function(slimeConnection, value) {
if(!exists("idToObject", envir=slimeConnection)) {
assign("idToObject", new.env(), envir=slimeConnection)
}
if(!exists("idToObject", envir=slimeConnection)) {
assign("idToObject", new.env(), envir=slimeConnection)
}
+ ## FIXME this should check for value already being present in the
+ ## idToObject map
presentationCounter <<- presentationCounter + 1
assign(as.character(presentationCounter), value, envir=slimeConnection$idToObject)
presentationCounter
presentationCounter <<- presentationCounter + 1
assign(as.character(presentationCounter), value, envir=slimeConnection$idToObject)
presentationCounter
@@
-20,14
+22,11
@@
presentReplResult <- function(slimeConnection, value) {
list(quote(`:write-string`), "\n", quote(`:repl-result`)))
}
list(quote(`:write-string`), "\n", quote(`:repl-result`)))
}
-sendReplResultFunction <- presentReplResult
-
`cl:nth-value` <- function(slimeConnection, sldbState, n, values) {
values[[n+1]]
}
`swank:lookup-presented-object` <- function(slimeConnection, sldbState, id) {
`cl:nth-value` <- function(slimeConnection, sldbState, n, values) {
values[[n+1]]
}
`swank:lookup-presented-object` <- function(slimeConnection, sldbState, id) {
- str(ls(slimeConnection))
if(exists(as.character(id), envir=slimeConnection$idToObject)) {
value <- get(as.character(id), envir=slimeConnection$idToObject)
list(value, TRUE)
if(exists(as.character(id), envir=slimeConnection$idToObject)) {
value <- get(as.character(id), envir=slimeConnection$idToObject)
list(value, TRUE)
@@
-44,7
+43,12
@@
sendReplResultFunction <- presentReplResult
stop(sprintf("attempt to access unrecorded object (id %d)", id))
}
}
stop(sprintf("attempt to access unrecorded object (id %d)", id))
}
}
-
+
+`swank:lookup-and-save-presented-object-or-lose` <- function(slimeConnection, sldbState, id) {
+ obj <- `swank:lookup-presented-object-or-lose`(slimeConnection, sldbState, id)
+ savePresentedObject(slimeConnection, obj)
+}
+
`swank:clear-repl-results` <- function(slimeConnection, sldbState) {
if(!exists("idToObject", envir=slimeConnection)) {
assign("idToObject", new.env(), envir=slimeConnection)
`swank:clear-repl-results` <- function(slimeConnection, sldbState) {
if(!exists("idToObject", envir=slimeConnection)) {
assign("idToObject", new.env(), envir=slimeConnection)
@@
-52,3
+56,8
@@
sendReplResultFunction <- presentReplResult
rm(list=ls(slimeConnection$idToObject), envir=slimeConnection$idToObject)
TRUE
}
rm(list=ls(slimeConnection$idToObject), envir=slimeConnection$idToObject)
TRUE
}
+
+`swank:init-presentations` <- function(slimeConnection, sldbState) {
+ sendReplResultFunction <<- presentReplResult
+ TRUE
+}