Initial Commit
[packages] / xemacs-packages / ilisp / ilisp-chs.el
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-chs.el --
4 ;;; CLISP Common Lisp by Bruno Haible and Michael Stoll dialect definition.
5 ;;;
6 ;;; This file is part of ILISP.
7 ;;; Please refer to the file COPYING for copyrights and licensing
8 ;;; information.
9 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
10 ;;; of present and past contributors.
11 ;;;
12 ;;; $Id: ilisp-chs.el,v 1.4 2002-06-03 23:36:59 wbd Exp $
13
14 (require 'cl)
15
16 ;;; clisp-hs-check-prompt doesn't after the first break because the
17 ;;; number of ">" characters doesn't increase.
18
19 ;;; (defun clisp-hs-check-prompt (old new)
20 ;;;  "Compare the break level printed at the beginning of the prompt."
21 ;;;  (let* ((was-in-break (and old (string-match "Break>" old)))
22 ;;;      (old-level (if was-in-break
23 ;;;                     (- (match-end 0) (match-beginning 0))
24 ;;;                     0))
25 ;;;      (is-in-break (string-match "Break>" new))
26 ;;;      (new-level (if is-in-break
27 ;;;                     (- (match-end 0) (match-beginning 0))
28 ;;;                     0)))
29 ;;;    (<= new-level old-level)))
30
31 ;;; clisp-hs-check-prompt -- New version
32 ;;; (according to the description in comint-ipc, this should be the
33 ;;; correct behavior)
34 ;;;
35 ;;; 19990912 Martin Atzmuller
36
37 (defun clisp-hs-check-prompt (old new)
38   "Compare the break level printed at the beginning of the prompt."
39   (let* ((was-in (and old
40                       (string-match "Break" old)
41                       (string-match "[0-9]+" old)))
42          (old-level (if was-in
43                         (string-to-int
44                          (substring old (match-beginning 0)
45                                     (match-end 0)))
46                       0))
47          (is-in (and
48                  (string-match "Break" new)
49                  (string-match "[0-9]+" new)))
50          (new-level (if is-in
51                         (string-to-int
52                          (substring new (match-beginning 0)
53                                     (match-end 0)))
54                       0)))
55     (<= new-level old-level)))
56
57
58 ;;; clisp-hs --
59 ;;;
60 ;;; Notes:
61 ;;; 19991219 Martin Atzmueller
62 ;;; replaced clisp-hs-check-prompt again.
63 ;;;
64 ;;; 19990912 Martin Atzmueller
65 ;;; replaced clisp-hs-check-prompt with new function
66 ;;;
67 ;;; 19990828 Paolo Amoroso
68 ;;; Added initial support for ILD and modified COMINT-PROMPT-REGEXP (the
69 ;;; previous value didn't take into account the space which is the last
70 ;;; character of the prompt).
71 ;;;
72 ;;; 19990806 Martin Atzmueller
73 ;;; Various changes to make the dialect definition friendlier.
74 ;;;
75 ;;; 19990806 Marco Antoniotti
76 ;;; Since I changed the name of the main dialect, I could conceivably
77 ;;; change the name of the CLISP dialect.
78
79 (defvar ilisp-clisp-hs-init-file "cl-chs-init.lisp")
80
81 (defdialect clisp-hs "CLISP H.S." common-lisp
82   (ilisp-load-init 'clisp-hs ilisp-clisp-hs-init-file)
83   (setq
84    ilisp-load-or-send-command "(and (or (print \"%s\") t) (load \"%s\"))"
85    ilisp-error-regexp
86    "\\(ILISP:[^\"]*\\)\\|\\(\\*\\*[^\n]*\\)"
87
88    ilisp-reset "(sys::debug-unwind)"
89    ilisp-block-command "(progn %s)"
90    ilisp-find-source-command nil
91    ilisp-callers-command nil
92
93    ;; Note:
94    ;; 19990920
95    ;; The global definition should now take care to find out the
96    ;; proper extension.  See file 'ilisp-cl.el'.
97    ;; ilisp-binary-extension "fas"
98
99    comint-prompt-regexp "^\\([0-9]+\\. Break \\[[0-9]+\\]> \\|[^>]*> \\)"
100    comint-interrupt-regexp "\\(\\*\\*\\* - [A-Za-z]*: User break\\)"
101    comint-fix-error "(sys::debug-unwind)"
102    comint-continue "continue"
103    comint-prompt-status
104    (function
105     (lambda (old line)
106      (comint-prompt-status old line 'clisp-hs-check-prompt))))
107
108   ;; ILD Support. NIL values mean that more work is needed or that the
109   ;; particular command is not available
110
111   (setq ild-abort-string "(sys::debug-unwind)"
112         ild-continue-string "continue"
113         ild-next-string "up"
114         ild-next-string-arg nil
115         ild-previous-string "down"
116         ild-previous-string-arg nil
117         ild-top-string "top"
118         ild-bottom-string "bottom"
119         ild-backtrace-string "backtrace"
120         ild-locals-string nil
121         ild-local-string-arg nil
122         ild-return-string "return"
123         ild-retry-string "redo"
124         ild-trap-on-exit-string "break+" ; I'm not sure about this
125         ))
126
127 (unless clisp-hs-program
128   (setq clisp-hs-program "clisp -ansi -I")) ; ANSI mode, ILISP friendly
129
130 (provide 'ilisp-chs)
131
132 ;;; end of file -- ilisp-chs.el --