Remove some code duplication in TRANSLATE-PREDICATE
[maxima.git] / src / autol.lisp
blob365ff741ab2fdf8a4dcd554ef06a63e0c002f5ce
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 &aux *load-verbose* tem)
19 (let (($system (list '(mlist)
20 #+kcl (concatenate 'string si::*system-directory*
21 "../{src,share,share1,sharem}/foo.{mc,mac}"))))
22 (declare (special $system))
23 (setq tem ($file_search1 file '((mlist)
24 $file_search_maxima
25 $system)))
26 (and tem ($load tem))))
29 ;;for defun,defmfun
30 (defun autof (fun file)
31 (unless (fboundp fun)
32 (setf (symbol-function fun)
33 #'(lambda (&rest l)
34 (aload file)
35 (apply fun l)))))
37 ;;for defmacro
38 (defun autom (fun file)
39 (unless (fboundp fun)
40 (setf (macro-function fun)
41 #'(lambda (&rest l)
42 (aload file)
43 (funcall (macro-function fun)
44 (cons fun l) nil)))))
45 ;;for defmspec
46 (defun auto-mspec (fun file )
47 (unless (get fun 'mfexpr*)
48 (setf (get fun 'mfexpr*)
49 #'(lambda (l)
50 (aload file)
51 (funcall (get fun 'mfexpr*) l)))))
53 ;;foo(x,y):=..
54 (defun auto-mexpr (fun file)
55 (unless (mget fun 'mexpr)
56 (mputprop fun
57 `((lambda) ((mlist) ((mlist) |_l|))
58 ((mprogn) ((aload) ((mquote) ,file)) (($apply) ((mquote) ,fun) |_l|)))
59 'mexpr)))
61 ;;foo(x,y):=..
62 (defmfun $auto_mexpr (fun file)
63 (unless (mget fun 'mexpr)
64 (mputprop fun
65 `((lambda) ((mlist) ((mlist) |_l|))
66 ((mprogn) (($aload_mac) ((mquote) ,file)) (($apply) ((mquote) ,fun) |_l|)))
67 'mexpr)))