euslisp / EusLisp

EusLisp is an integrated programming system for the research on intelligent robots based on Common Lisp and Object-Oriented programming. [Manual](http://euslisp.github.io/EusLisp/manual.html ) [マニュアル](http://euslisp.github.io/EusLisp/jmanual.html )
Other
57 stars 50 forks source link

Add sys:list-all-blocks #403

Open Affonso-Gui opened 5 years ago

Affonso-Gui commented 5 years ago

Apparently it can be difficult to know when you can return and when you must use return-from, and in the latter case which blocks are available to be returned from.

I'm not sure if we have demand for this, but I added a sys:list-all-blocks so am sending a PR.

1.eus$ (sys:list-all-blocks)
nil
2.eus$ (block test (sys:list-all-blocks))
(test)
3.eus$ (defun foo () (sys:list-all-blocks))
foo
4.eus$ (foo)
(foo)
5.eus$ (while t (return (sys:list-all-blocks) ))
(nil)
6.eus$ (defclass guiga)
guiga
7.eus$ (defmethod guiga (:foo () (sys:list-all-blocks)))
guiga
8.eus$ (send (instance guiga) :foo)
(:foo)
9.eus$ (block test1 (block test2 (block test3 (sys:list-all-blocks))))
(test3 test2 test1)

@koga-yu