Christophe Weblog Wiki Code Publications Music
Add licence information to swank.R
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index 0684ab071366fca918bd5541c5aa2ed6e76f5b46..6dca4556d1bb69e787cb4622b8aef2ecd484199c 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -1,3 +1,18 @@
+### This program is free software; you can redistribute it and/or
+### modify it under the terms of the GNU General Public Licence as
+### published by the Free Software Foundation; either version 2 of the
+### Licence, or (at your option) any later version.
+###
+### This program 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 Licence for more details.
+###
+### A copy of version 2 of the GNU General Public Licence is available
+### at <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>; the
+### latest version of the GNU General Public Licence is available at
+### <http://www.gnu.org/licenses/gpl.txt>.
+
 swank <- function(port=4005) {
   acceptConnections(port, FALSE)
 }
@@ -284,6 +299,21 @@ computeRestartsForEmacs <- function (sldbState) {
   }
 }
 
+`swank:frame-source-location` <- function(io, sldbState, n) {
+  call <- sldbState$calls[[n+1]]
+  srcref <- attr(call, "srcref")
+  srcfile <- attr(srcref, "srcfile")
+  if(is.null(srcfile)) {
+    list(quote(`:error`), "no srcfile")
+  } else {
+    filename <- get("filename", srcfile)
+    list(quote(`:location`),
+         list(quote(`:file`), filename),
+         list(quote(`:line`), srcref[[1]], srcref[[2]]-1),
+         FALSE)
+  }
+}
+
 `swank:buffer-first-change` <- function(io, sldbState, filename) {
   FALSE
 }