Christophe Weblog Wiki Code Publications Music
swankr.git
13 years agofactor out backtraceForEmacs() into `swank:backtrace`
Christophe Rhodes [Wed, 25 Aug 2010 17:14:19 +0000 (18:14 +0100)]
factor out backtraceForEmacs() into `swank:backtrace`

write `swank:debugger-info-for-emacs` out, and hence delete
debuggerInfoForEmacs().

Now wandering past the --more-- prompt in sldb gives an infinite
sequence of NULLs, but at least it's not a cascade of errors any more.

13 years agoimplement swank:interactive-eval and swank:eval-and-grab-output
Christophe Rhodes [Wed, 25 Aug 2010 14:57:56 +0000 (15:57 +0100)]
implement swank:interactive-eval and swank:eval-and-grab-output

This allows C-c : and C-u C-c : to work, modulo the printing of an
unnecessary [1].  The evaluation semantics of R are not what a Lisper might
expect; printToString(eval(parse(...))) does not necessarily perform the
evaluation before altering the output stream with sink() -- so capturing
all sorts of incidental output if something goes wrong.

This commit brought to you using C-c C-c.

13 years agoensure that the fifo is closed in printToString()
Christophe Rhodes [Wed, 25 Aug 2010 14:55:41 +0000 (15:55 +0100)]
ensure that the fifo is closed in printToString()

Whoops.  Good to know that I can make the same basic stream mistakes
in any language.

13 years agoimplement swank:compile-string-for-emacs
Christophe Rhodes [Tue, 24 Aug 2010 17:06:48 +0000 (18:06 +0100)]
implement swank:compile-string-for-emacs

As long as my defun-prompt-regexp is set up right, I can now use C-c
C-c to develop swankr.  Go me.

13 years agoimplement swank:simple-completions
Christophe Rhodes [Fri, 20 Aug 2010 19:17:02 +0000 (20:17 +0100)]
implement swank:simple-completions

Probably fails as soon as slime and R disagree about what are token
constituents, or if an R token contains regexp metacharacters.

13 years agostub for swank:operator-arglist
Christophe Rhodes [Fri, 20 Aug 2010 19:16:00 +0000 (20:16 +0100)]
stub for swank:operator-arglist

13 years agoreturn properly from sldbLoop()
Christophe Rhodes [Thu, 19 Aug 2010 07:59:42 +0000 (08:59 +0100)]
return properly from sldbLoop()

Always emit a :debug-return message.  The extra :sldb-return stuff in
swank.lisp is (I think) only needed for multiple threads.

13 years agoput abort restarts around the main and sldb loops
Christophe Rhodes [Sun, 15 Aug 2010 15:46:13 +0000 (16:46 +0100)]
put abort restarts around the main and sldb loops

Also hide the abort restart imposed on us by the R interpreter itself,
which has the side-effect of aborting swank completely.

13 years agoThe beginnings of a vaguely-useful sldb
Christophe Rhodes [Sat, 14 Aug 2010 20:55:14 +0000 (21:55 +0100)]
The beginnings of a vaguely-useful sldb

Implement swank:frame-locals-and-catch-tags.  There are problems:

1. it seems that some names can be present in an environment but not have
   a value, causing eval to blow up;
2. the default printing routines aren't really adapted to the constraints
   of rendering in sldb;
3. trying to display locals of some of the swank frames (perhaps anything
   with a tryCatch or similar block?) causes R to complain about a promise
   already in the process of evaluation;
4. (probably) other things I haven't yet found

13 years agostore calls and frames on entry to sldb itself
Christophe Rhodes [Sat, 14 Aug 2010 20:12:20 +0000 (21:12 +0100)]
store calls and frames on entry to sldb itself

Rather than do complicated stuff to keep track of where we are in the
stack, simply store the interesting frames and calls in the sldb state
structure.

13 years agoimplement swank:buffer-first-change
Christophe Rhodes [Fri, 13 Aug 2010 16:24:02 +0000 (17:24 +0100)]
implement swank:buffer-first-change

Simply stub it in, to stop things whining at me when I type into the
wrong window and edit a Lisp file (which happens to be in slime
mode...)

13 years agoreturn stack frames in slime's order (most recent first)
Christophe Rhodes [Fri, 13 Aug 2010 16:10:16 +0000 (17:10 +0100)]
return stack frames in slime's order (most recent first)

13 years agoget definitions (use of <-) to work in the REPL
Christophe Rhodes [Fri, 13 Aug 2010 16:00:22 +0000 (17:00 +0100)]
get definitions (use of <-) to work in the REPL

the REPL now evaluates with envir=globalenv(), rather than in the
environment of `swank:listener-eval`...

13 years agosupport invoking restarts from sldb
Christophe Rhodes [Fri, 13 Aug 2010 15:03:51 +0000 (16:03 +0100)]
support invoking restarts from sldb

13 years agouse a restart description for restart printing, if available
Christophe Rhodes [Fri, 13 Aug 2010 14:22:58 +0000 (15:22 +0100)]
use a restart description for restart printing, if available

13 years agorework to support sldb
Christophe Rhodes [Fri, 13 Aug 2010 10:49:48 +0000 (11:49 +0100)]
rework to support sldb

R doesn't have much in the way of dynamic binding; you can fake it by
messing with environments, but that's not fun.

So instead, pass around the connection (`io') and an object
representing the SLDB state (`sldbState') to all functions.
Poor-man's explicit continuation-passing-style...

We need to call some of the mainLoop internal functions from elsewhere
now, so make them not-internal any more.

Fix ridiculous thinko in the logical branch of writeSexpToString

use simpleCondition rather than simpleError in swank:throw-to-toplevel

implement swank:debugger-info-for-emacs

Now `q' in sldb (sldb-quit) works.  Things that don't work:
1. the backtrace is the wrong way up.
2. calling any restarts
3. frame locals
4. returning from frames (dunno if R actually supports this)
5. zoom to source
6. probably other things

13 years agoimplement swank:throw-to-toplevel
Christophe Rhodes [Wed, 11 Aug 2010 14:58:47 +0000 (15:58 +0100)]
implement swank:throw-to-toplevel

13 years agoinclude swank.R hacks from today
Christophe Rhodes [Wed, 11 Aug 2010 14:02:47 +0000 (15:02 +0100)]
include swank.R hacks from today

We get far enough to start up a swank server in R and connect to it from
emacs; we get a REPL which formats the R-style results from parsing and
evaluating the input it receives.  Debugging, stepping, documentation,
arglist and so on is basically entirely missing.