Initial Commit
[packages] / xemacs-packages / ilisp / ilisp-hlw.el
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-hlw.el --
4 ;;; ILISP LispWorks Common Lisp dialect definition
5 ;;;
6 ;;; Independently written by:
7 ;;;
8 ;;; Jason Trenouth: jason@harlequin.co.uk
9 ;;; Qiegang Long: qlong@cs.umass.edu
10 ;;;
11 ;;; Upgraded for LW 4 and bugs fixed by Pekka P. Pirinen
12 ;;; (pekka@harlequin.co.uk) and later merged together by Jason.
13 ;;;
14 ;;; This file is part of ILISP.
15 ;;; Please refer to the file COPYING for copyrights and licensing
16 ;;; information.
17 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
18 ;;; of present and past contributors.
19 ;;;
20 ;;; $Id: ilisp-hlw.el,v 1.4 2002-06-03 23:37:00 wbd Exp $
21
22
23 (defvar ilisp-lispworks-init-file "lispworks.lisp")
24
25 ;; may use Qiegang's instead? "[-A-Z]+ [0-9]+ : \\([0-9]+\\) >"
26
27 (defun lispworks-break-level (prompt)
28   (let ((position nil))
29     (if (and prompt (setq position (string-match ": [0-9]+" prompt)))
30         (string-to-int (substring prompt (+ 2 position)))
31       0)))
32
33
34 ;;; lispworks-check-prompt --
35 ;;;
36 ;;; Notes:
37 ;;; 19990806 Marco Antoniotti
38 ;;; Many Changes form Harlequin and other sources have been
39 ;;; included. Mostly dealing with LW 4.x.
40
41 (defun lispworks-check-prompt (old new)
42   "Compare the break level printed at the beginning of the prompt."
43   (<= (lispworks-break-level new) (lispworks-break-level old)))
44
45 ;;; Qiegang's prompt matcher "^\\([-A-Z]+ [0-9]+ >\\)\\|\\([-A-Z]+ [0-9]+ : [0-9]+ >\\) "
46 ;;; Qiegang's error matcher "\\(ILISP:[^\"]*\\)\\|\\(Error: [^\n]*\\)\\|\\(Break.[^\n]*\\)"
47
48 (defdialect lispworks "LispWorks"
49   common-lisp
50   (ilisp-load-init 'lispworks ilisp-lispworks-init-file)
51   (setq comint-fix-error ":a"
52         ;; ilisp-reset ":a" ; LW doesn't have a multi-level abort yet.
53         ilisp-reset ":a :t" ; LW 4 (In LW 3.2 this only anorts one level)
54         comint-continue ":c"
55         comint-interrupt-regexp  "Break\\.\n.*")
56   (setq comint-prompt-status 
57         (function (lambda (old line)
58           (comint-prompt-status old line 'lispworks-check-prompt))))
59   ;; <cl> or package> at top-level
60   ;; [0-9c] <cl> or package> in error
61   ;; (setq comint-prompt-regexp "^\\(\\[[0-9]*c*\\] \\|\\)\\(<\\|\\)[^>]*> ")
62   (setq comint-prompt-regexp "^[A-Z=][-a-z0-9A-Z:= ]*[$%#>]+ *") 
63
64   ;; 19990806 Marco Antoniotti
65   ;; You may want to use the commented one instead.
66   ;; (setq ilisp-error-regexp "ILISP:[^\"]*\\|Error: [^\n]*\\|Break\\.[^\n]*")
67   (setq ilisp-error-regexp "ILISP [0-9]* : [0-9]* > ")
68
69   (setq ilisp-source-types (append ilisp-source-types '(("any"))))
70   (setq ilisp-directory-command "(lw:current-pathname)")
71   (setq ilisp-set-directory-command "(hcl:change-directory \"%s\")")
72   (setq ilisp-find-source-command 
73         "(ILISP:ilisp-source-files \"%s\" \"%s\" \"%s\")")
74
75   ;;; 19990806 Unknown Author (blame Marco Antoniotti for this)
76   (setq ilisp-package-command
77         "(let ((*package* *package*)
78                 #+LispWorks3 (lw::*handle-old-in-package* :quiet)
79                 #-LispWorks3 (hcl:*handle-old-in-package* :quiet))
80             %s (package-name *package*))")
81
82   ;;; 19990806 Unknown Author (blame Marco Antoniotti for this)
83   ;;;
84   ;;; Notes:
85   ;;; 19990806 Marco Antoniotti
86   ;;; I inserted these here, but I have not throughly checked them.
87   ;;; In particular, the value for ILISP-RESTORE-COMMAND looks funny.
88   (setq ilisp-save-command ":ilisp-send %s"
89         ilisp-restore-command (function (lambda ())))
90
91   ;; Note:
92   ;; 19990920
93   ;; The global definition should now take care to find out the
94   ;; proper extension.  See file 'ilisp-cl.el'.
95   ;; (setq ilisp-binary-command "system::*binary-file-type*")
96   ;; (setq ilisp-init-binary-command "system::*binary-file-type*")
97   
98   )
99
100
101 (unless lispworks-program
102   (setq lispworks-program "lispworks"))
103
104 (provide 'ilisp-lw)
105
106 ;;; end of file -- ilisp-hlw.el --