01: package gnu.jemacs.buffer;
02:
03: public class Signal extends RuntimeException {
04: String name;
05: Object data;
06:
07: public Signal(String name, Object data) {
08: this .name = name;
09: this .data = data;
10: }
11:
12: public static void signal(String name, Object data) {
13: throw new Signal(name, data);
14: }
15:
16: public static void signal(String name) {
17: throw new Signal(name, null);
18: }
19:
20: public static void error(Object data) {
21: throw new Signal("error", data);
22: }
23:
24: public static void message(String msg) {
25: System.err.println(msg);
26: }
27:
28: public String toString() {
29: if (data == null)
30: return name;
31: else
32: return name + ": " + data;
33: }
34:
35: public static void checkQuit() {
36: if (Thread.interrupted())
37: throw new gnu.mapping.WrappedException(
38: new InterruptedException());
39: }
40: }
|