Fix error in @table
[maxima.git] / src / autol.lisp
blobd66a589b0b1eb1567c5e405f1231f7c2e8ec8e59
1 (in-package :maxima)
3 ;; These are the helper functions for autoloading.
4 ;; The actual autoloading data is in src/max_ext.lisp
5 ;;(aload "plot.o")
7 (defun aload (file &aux *load-verbose* tem)
8 (let ((*read-base* 10.)
9 ($system (list '(mlist)
10 #+kcl (concatenate 'string si::*system-directory*
11 "../src/foo.{o,lsp,lisp}"))))
12 (declare (special $system))
13 (setq tem ($file_search1 file '((mlist)
14 $file_search_lisp
15 $system)))
16 (and tem #-sbcl (load tem) #+sbcl (with-compilation-unit nil (load tem)))))
18 (defmfun $aload_mac (file)
19 (let ((tem ($file_search1 file '((mlist) $file_search_maxima))))
20 (when tem
21 (with-open-file (in-stream tem)
22 (batchload-stream in-stream :autoloading-p t)))))
24 ;;for defun,defmfun
25 (defun autof (fun file)
26 (unless (fboundp fun)
27 (setf (symbol-function fun)
28 #'(lambda (&rest l)
29 (aload file)
30 (apply fun l)))))
32 ;;for defmacro
33 (defun autom (fun file)
34 (unless (fboundp fun)
35 (setf (macro-function fun)
36 #'(lambda (&rest l)
37 (aload file)
38 (funcall (macro-function fun)
39 (cons fun l) nil)))))
40 ;;for defmspec
41 (defun auto-mspec (fun file )
42 (unless (get fun 'mfexpr*)
43 (setf (get fun 'mfexpr*)
44 #'(lambda (l)
45 (aload file)
46 (funcall (get fun 'mfexpr*) l)))))
48 ;;foo(x,y):=..
49 (defun auto-mexpr (fun file)
50 (unless (mget fun 'mexpr)
51 (mputprop fun
52 `((lambda) ((mlist) ((mlist) |_l|))
53 ((mprogn) ((aload) ((mquote) ,file)) (($apply) ((mquote) ,fun) |_l|)))
54 'mexpr)))
56 ;;foo(x,y):=..
57 (defmfun $auto_mexpr (fun file)
58 (unless (mget fun 'mexpr)
59 (mputprop fun
60 `((lambda) ((mlist) ((mlist) |_l|))
61 ((mprogn) (($aload_mac) ((mquote) ,file)) (($apply) ((mquote) ,fun) |_l|)))
62 'mexpr)))