SRRAT: use MRAT reader functions instead of CADDAR, etc.
[maxima.git] / archive / src / compile-cmulisp.lisp
blob794f39340e3f81ec4aaeeb597f319f01c8b48596
1 ;;;
2 ;;; To compile Maxima with CMUCL, load this file. Then
3 ;;; (compile-maxima) to compile everything. Then (save-maxima)
4 ;;; to save a core file.
5 ;;;
6 ;;; If you want support for maxima describe command, you need to get a
7 ;;; copy of GNU regex and compile and install it. Change the path
8 ;;; user::run in init_max1.lisp to the appropriate location of
9 ;;; regex.o.
10 ;;;
11 ;;; Also, for things to work, you really need to have a dir file in
12 ;;; the same location as the maxima.info file.
13 ;;;
14 ;;; Finally, you need to set MAXIMA_DIRECTORY appropriately before
15 ;;; running maxima. This should be the top-level directory of the
16 ;;; maxima sources. Either here or wherever you installed maxima.
17 ;;; (See the maxima shell script if you installed maxima with gcl for
18 ;;; an appropriate value.)
19 ;;;
21 ;; this is now in maxima package
22 (defpackage "REGEXP"
23 (:use "COMMON-LISP" "ALIEN" "C-CALL")
24 (:export
25 ;; Constants
26 "+RE-BACKSLASH-ESCAPE-IN-LISTS+"
27 "+RE-BK-PLUS-QM+"
28 "+RE-CHAR-CLASSES+"
29 "+RE-CONTEXT-INDEP-ANCHORS+"
30 "+RE-CONTEXT-INDEP-OPS+"
31 "+RE-CONTEXT-INVALID-OPS+"
32 "+RE-DOT-NEWLINE+"
33 "+RE-DOT-NOT-NULL+"
34 "+RE-HAT-LISTS-NOT-NEWLINE+"
35 "+RE-INTERVALS+"
36 "+RE-LIMITED-OPS+"
37 "+RE-NEWLINE-ALT+"
38 "+RE-NO-BK-BRACES+"
39 "+RE-NO-BK-PARENS+"
40 "+RE-NO-BK-REFS+"
41 "+RE-NO-BK-VBAR+"
42 "+RE-NO-EMPTY-RANGES+"
43 "+RE-UNMATCHED-RIGHT-PAREN-ORD+"
44 ;; Common regexp syntaxes
45 "+RE-SYNTAX-EMACS+"
46 "+RE-SYNTAX-EGREP+"
47 "+RE-SYNTAX-POSIX-COMMON+"
48 "+RE-SYNTAX-POSIX-BASIC+"
49 "+RE-SYNTAX-POSIX-EXTENDED+"
50 "+RE-SYNTAX-SPENCER+"
51 ;; Variables
52 "*MATCH-DATA*"
53 "*CASE-FOLD-SEARCH*"
54 ;; Functions
55 "MATCH-DATA-START"
56 "MATCH-DATA-END"
57 "RE-SET-SYNTAX"
58 "COMPILE-PATTERN"
59 "ALLOCATE-RE-REGS"
60 "FREE-RE-REGS"
61 "RE-NSUB"
62 "LISPIFY-MATCH-DATA"
63 "RE-SEARCH"
64 "RE-REGFREE"
65 "STRING-MATCH"
66 "MATCH-BEGINNING"
67 "MATCH-END"
70 (defpackage "SI"
71 (:use "COMMON-LISP" "REGEXP" "ALIEN"))
72 (defvar si::*info-paths* nil)
75 (push :main-files-loaded *features*)
76 (load "sysdef.lisp")
77 (load "make.lisp")
81 (defun compile-maxima ()
82 (compile-file "cmulisp-regex")
83 (compile-file "cl-info")
84 (make::make :maxima :compile t))
87 (defun save-maxima ()
88 ;;(load "cmulisp-regex" :if-source-newer :compile)
89 ;;(load "cl-info" :if-source-newer :compile)
90 (make::make :maxima)
91 (setq maxima::*maxima-directory* (namestring (truename "../")))
92 (load "init_max1")
93 (ext:gc)
94 (ext:save-lisp "maxima.core" :init-function #'user::run
95 :load-init-file nil :site-init nil))
97 (in-package "MAXIMA")
98 (shadow '(lisp::compiled-function-p) (find-package "MAXIMA"))
100 (defun getpid () (unix:unix-getpid))
102 (defun compiled-function-p (x)
103 (and (functionp x) (not (symbolp x))
104 (not (eval:interpreted-function-p x))))
106 (defmacro clines (x) nil)
107 (defun getenv (x)
108 (cdr (assoc (intern x (find-package "KEYWORD")) ext:*environment-list*)))
110 (defun $system (&rest x)
111 (let ((cmdline (apply '$sconcat x)))
112 (ext:run-program "/bin/sh" (list "-c" cmdline) :output t)
115 (defvar *init-run* nil)
116 (defun init-maxima ()
117 ;; Turn off gc messages
118 (unless *init-run*
119 (setq *init-run* t)
120 (setf ext:*gc-verbose* nil)
121 ;; Reload the documentation stuff.
122 (handler-case
123 (progn
124 (ext:load-foreign *regex-lib*)
125 (load (maxima-path "src" "cmulisp-regex") :if-source-newer :compile)
126 (load (maxima-path "src" "cl-info") :if-source-newer :compile))
127 (file-error ()
128 (format t "~&Regex support files not found. Skipping regexp stuff for describe~%")))
131 (defvar *maxima-directory* nil)
134 ;; Set this to where GNU regex.o can be found.
135 (defvar *regex-lib*
136 "/apps/src/regex-0.12/regex.o")
137 #+nil
138 (ext:defswitch "dir"
139 #'(lambda (switch)
140 (let ((dirpath (ext:cmd-switch-arg switch)))
141 ;; Make sure it ends with a slash
142 (setf *maxima-directory*
143 (if (eql (aref dirpath (1- (length dirpath))) #\/)
144 dirpath
145 (concatenate 'string dirpath "/"))))))
147 ;; define bye so that quit() will work in maxima
148 (defun bye () (ext:quit))
149 (defun quit () (ext:quit))