~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to src/maxmac.lisp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
;;;  (c) Copyright 1976, 1983 Massachusetts Institute of Technology      ;;;
9
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10
10
 
11
 
(in-package "MAXIMA")
 
11
(in-package :maxima)
12
12
(macsyma-module maxmac #-lispm macro)
13
13
 
14
14
;; This file contains miscellaneous macros used in Macsyma source files.
31
31
  (if (and (not (atom form))
32
32
           (symbolp (car form))
33
33
           ;; we want an fboundp which gives T for special forms too.
34
 
           (OR (fboundp (car form))
35
 
               #+NIL (SI:MACRO-DEFINITION (CAR FORM))
36
 
               #+NIL (EQ (CAR FORM) 'SPECIAL)))
 
34
           (or (fboundp (car form))
 
35
               #+nil (si:macro-definition (car form))
 
36
               #+nil (eq (car form) 'special)))
37
37
      (eval form)))
38
38
 
39
39
 
40
 
(defmacro optimizing-declarations (dcls &body body) dcls
41
 
  #+NIL `(locally (declare (optimize ,@dcls)) ,@body)
42
 
  #-NIL `(progn ,@body))
 
40
;;(defmacro optimizing-declarations (dcls &body body) dcls
 
41
;;  #+NIL `(locally (declare (optimize ,@dcls)) ,@body)
 
42
;;  #-NIL `(progn ,@body))
43
43
 
44
44
;; All these updating macros should be made from the same generalized
45
45
;; push/pop scheme as I mentioned to LispForum. As they are defined now
46
46
;; they have inconsistent return-values and multiple-evaluations of
47
47
;; arguments. -gjc
48
48
 
49
 
(DEFMACRO ADDL (ITEM LIST)
50
 
          `(OR (MEMQ ,ITEM ,LIST) (SETQ ,LIST (CONS ,ITEM ,LIST))))
51
 
 
52
 
#-Multics (PROGN 'COMPILE
53
 
 
54
 
 
55
 
(DEFMACRO INCREMENT (COUNTER &OPTIONAL INCREMENT)
56
 
  (IF INCREMENT
57
 
      `(SETF ,COUNTER (f+ ,COUNTER ,INCREMENT))
58
 
      `(SETF ,COUNTER (f1+ ,COUNTER))))
59
 
 
60
 
 
61
 
(DEFMACRO DECREMENT (COUNTER &OPTIONAL DECREMENT)
62
 
  (IF DECREMENT
63
 
      `(SETF ,COUNTER (f- ,COUNTER ,DECREMENT))
64
 
      `(SETF ,COUNTER (f1- ,COUNTER))))
65
 
 
66
 
(DEFMACRO COMPLEMENT (SWITCH) `(SETF ,SWITCH (NOT ,SWITCH)))
67
 
 
68
 
) ;; End of Lispm conditionalization.
 
49
(defmacro addl (item list)
 
50
  `(or (memq ,item ,list) (setq ,list (cons ,item ,list))))
 
51
 
 
52
#-multics (progn 'compile
 
53
                 (defmacro increment (counter &optional increment)
 
54
                   (if increment
 
55
                       `(setf ,counter (f+ ,counter ,increment))
 
56
                       `(setf ,counter (f1+ ,counter))))
 
57
 
 
58
 
 
59
                 (defmacro decrement (counter &optional decrement)
 
60
                   (if decrement
 
61
                       `(setf ,counter (f- ,counter ,decrement))
 
62
                       `(setf ,counter (f1- ,counter))))
 
63
 
 
64
                 (defmacro complement (switch)
 
65
                   `(setf ,switch (not ,switch)))
 
66
 
 
67
                 ) ;; End of Lispm conditionalization.
69
68
 
70
69
 
71
70
;; 'writefilep' and 'ttyoff' are system independent ways of expressing
75
74
;; it works in most cases.  
76
75
;;
77
76
(eval-when (compile eval load)
78
 
   (defvar writefilep #-Franz '^R #+Franz 'ptport)
79
 
   (defvar ttyoff    '^W))
 
77
  (defvar writefilep #-franz '^r #+franz 'ptport)
 
78
  (defvar ttyoff    '^w))
80
79
 
81
80
;; (IFN A B) --> (COND ((NOT A) B))
82
81
;; (IFN A B C D) --> (COND ((NOT A) B) (T C D))
83
82
;; (IFN A B) is equivalent to (OR A B) as (IF A B) is equivalent to (AND A B).
84
83
 
85
 
(DEFMACRO IFN (PREDICATE THEN . ELSE)
86
 
          (COND ((NULL ELSE) `(COND ((NOT ,PREDICATE) ,THEN)))
87
 
                (T `(COND ((NOT ,PREDICATE) ,THEN) (T . ,ELSE)))))
 
84
(defmacro ifn (predicate then . else)
 
85
  (cond ((null else) `(cond ((not ,predicate) ,then)))
 
86
        (t `(cond ((not ,predicate) ,then) (t . ,else)))))
88
87
 
89
 
(DEFMACRO FN (BVL &REST BODY)
90
 
          `(FUNCTION (LAMBDA ,BVL . ,BODY)))
 
88
(defmacro fn (bvl &rest body)
 
89
  `(function (lambda ,bvl . ,body)))
91
90
 
92
91
;; Like PUSH, but works at the other end.
93
92
 
94
 
(DEFMACRO TUCHUS (LIST OBJECT)
95
 
          `(SETF ,LIST (NCONC ,LIST (NCONS ,OBJECT))))
 
93
(defmacro tuchus (list object)
 
94
  `(setf ,list (nconc ,list (ncons ,object))))
96
95
 
97
96
;; Copy a single cons, the top level and all levels (repectively) of a piece of
98
97
;; list structure.  Something similar for strings, structures, etc. would be
99
98
;; useful.  These functions should all be open-coded subrs.
100
99
 
101
 
(DEFMACRO COPY-CONS (CONS)
102
 
  (IF (ATOM CONS)
103
 
      `(CONS (CAR ,CONS) (CDR ,CONS))
104
 
      (LET ((VAR (GENSYM)))
105
 
           `(LET ((,VAR ,CONS)) `(CONS (CAR ,VAR) (CDR ,VAR))))))
 
100
(defmacro copy-cons (cons)
 
101
  (if (atom cons)
 
102
      `(cons (car ,cons) (cdr ,cons))
 
103
      (let ((var (gensym)))
 
104
        `(let ((,var ,cons)) `(cons (car ,var) (cdr ,var))))))
106
105
 
107
 
(DEFMACRO COPY-TOP-LEVEL (LIST)
108
 
  #+(or cl NIL) `(COPY-LIST ,LIST)
109
 
  #-(or cl NIL) `(APPEND ,LIST NIL))
 
106
(defmacro copy-top-level (list)
 
107
  #+(or cl nil) `(copy-list ,list)
 
108
  #-(or cl nil) `(append ,list nil))
110
109
 
111
110
;; (DEFMACRO COPY-ALL-LEVELS (LIST)
112
111
;;   #+(or cl NIL) `(COPY-TREE ,LIST)
114
113
 
115
114
;; Old names kept around for compatibility.
116
115
 
117
 
(DEFMACRO COPY1* (LIST)
118
 
  #+(or cl NIL) `(COPY-LIST ,LIST)
119
 
  #-(or cl NIL) `(APPEND ,LIST NIL))
120
 
(DEFMACRO COPY1 (LIST)
121
 
  #+(or cl NIL) `(COPY-LIST ,LIST)
122
 
  #-(or cl NIL) `(APPEND ,LIST NIL))
123
 
#-Franz
124
 
(DEFMACRO COPY (LIST)
125
 
  #+(or cl nil  symbolics) `(COPY-TREE ,LIST)
126
 
  #-(or cl nil symbolics) `(SUBST NIL NIL ,LIST))
 
116
(defmacro copy1* (list)
 
117
  #+(or cl nil) `(copy-list ,list)
 
118
  #-(or cl nil) `(append ,list nil))
 
119
(defmacro copy1 (list)
 
120
  #+(or cl nil) `(copy-list ,list)
 
121
  #-(or cl nil) `(append ,list nil))
 
122
#-franz
 
123
(defmacro copy (list)
 
124
  #+(or cl nil  symbolics) `(copy-tree ,list)
 
125
  #-(or cl nil symbolics) `(subst nil nil ,list))
127
126
 
128
127
;; Use this instead of GETL when looking for "function" properties,
129
128
;; i.e. one of EXPR, SUBR, LSUBR, FEXPR, FSUBR, MACRO.
130
129
;; Use FBOUNDP, SYMBOL-FUNCTION, or FMAKUNBOUND if possible.
131
130
 
132
 
(DEFMACRO GETL-FUN (FUN L)
133
 
          #+MacLisp `(GETL ,FUN ,L)
134
 
          #+CL   `(GETL-LM-FCN-PROP ,FUN ,L)
135
 
          #+Franz   `(GETL-FRANZ-FCN-PROP ,FUN ,L)
136
 
          #+NIL     `(GETL-NIL-FCN-PROP ,FUN ,L)
137
 
          )
 
131
(defmacro getl-fun (fun l)
 
132
  #+maclisp `(getl ,fun ,l)
 
133
  #+cl   `(getl-lm-fcn-prop ,fun ,l)
 
134
  #+franz   `(getl-franz-fcn-prop ,fun ,l)
 
135
  #+nil     `(getl-nil-fcn-prop ,fun ,l)
 
136
  )
138
137
 
139
138
;; Non-destructive versions of DELQ and DELETE.  Already part of NIL
140
139
;; and LMLisp.  These should be rewritten as SUBRS and placed
141
140
;; in UTILS.  The subr versions can be more memory efficient.
142
141
 
143
 
;#-(OR Lispm NIL Multics Franz cl)
144
 
;(DEFMACRO REMQ (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
145
 
;         (IF COUNTING? `(DELQ ,ITEM (APPEND ,LIST NIL) ,COUNT)
146
 
;             `(DELQ ,ITEM (APPEND ,LIST NIL))))
147
 
 
148
 
 
149
 
(DEFMACRO REMQ (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
150
 
 `(remove ,item ,list :test 'eq ,@ (and counting? `(:count ,count))))
151
 
 
152
 
;#+cl ;in clmacs
153
 
;(DEFMACRO ZL-REMOVE (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
154
 
; `(remove ,item ,list :test 'equal ,@ (and counting? `(:count ,count))))       
155
 
 
156
 
;#-(OR Lispm NIL Multics Franz)
157
 
;(DEFMACRO zl-REMOVE (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
158
 
;         (IF COUNTING? `(zl-DELETE ,ITEM (APPEND ,LIST NIL) ,COUNT)
159
 
;             `(zl-DELETE ,ITEM (APPEND ,LIST NIL))))
160
 
 
161
 
#-Lispm (DEFMACRO CATCH-ALL (FORM) `(CATCH NIL ,FORM))
 
142
;;#-(OR Lispm NIL Multics Franz cl)
 
143
;;(DEFMACRO REMQ (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
 
144
;;        (IF COUNTING? `(DELQ ,ITEM (APPEND ,LIST NIL) ,COUNT)
 
145
;;            `(DELQ ,ITEM (APPEND ,LIST NIL))))
 
146
 
 
147
 
 
148
(defmacro remq (item list &optional (count () counting?))
 
149
  `(remove ,item ,list :test 'eq ,@ (and counting? `(:count ,count))))
 
150
 
 
151
;;#+cl ;in clmacs
 
152
;;(DEFMACRO ZL-REMOVE (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
 
153
;; `(remove ,item ,list :test 'equal ,@ (and counting? `(:count ,count))))      
 
154
 
 
155
;;#-(OR Lispm NIL Multics Franz)
 
156
;;(DEFMACRO zl-REMOVE (ITEM LIST &OPTIONAL (COUNT () COUNTING?))
 
157
;;        (IF COUNTING? `(zl-DELETE ,ITEM (APPEND ,LIST NIL) ,COUNT)
 
158
;;            `(zl-DELETE ,ITEM (APPEND ,LIST NIL))))
 
159
 
 
160
#-lispm (defmacro catch-all (form) `(catch nil ,form))
162
161
 
163
162
;; (EXCH A B) exchanges the bindings of A and B
164
163
;; Maybe it should turn into (PSETF A B B A)?
165
164
 
166
 
(DEFMACRO EXCH (X Y) `(SETF ,X (PROG1 ,Y (SETF ,Y ,X))))
 
165
(defmacro exch (x y) `(setf ,x (prog1 ,y (setf ,y ,x))))
167
166
 
168
167
;; These are here for old code only.
169
168
;; Use FIFTH rather than CADDDDR.  Better, use DEFSTRUCT.
170
169
 
171
 
#-Franz (DEFMACRO CADDADR (X) `(CAR (CDDADR ,X)))
172
 
#-Franz (DEFMACRO CADDDDR (X) `(CAR (CDDDDR ,X)))
 
170
#-franz (defmacro caddadr (x) `(car (cddadr ,x)))
 
171
#-franz (defmacro caddddr (x) `(car (cddddr ,x)))
173
172
 
174
173
;; The following is a bit cleaner than the kludgy (PROGN 'COMPILE . <FORMS>)
175
174
 
176
 
(DEFMACRO COMPILE-FORMS (&REST <FORMS>) `(PROGN 'COMPILE . ,<FORMS>))
 
175
(defmacro compile-forms (&rest <forms>) `(progn 'compile . ,<forms>))
177
176
 
178
 
 
179
177
;; The following macros pertain only to Macsyma.
180
178
 
181
179
;; Widely used macro for printing error messages.  We should be able
185
183
 
186
184
;; Obsolete.  Use MERROR.
187
185
 
188
 
(DEFMACRO ERLIST (MESSAGE)
189
 
  (MAXIMA-ERROR "ERLIST is obsolete, all calls to it have been removed, so where
 
186
(defmacro erlist (message)
 
187
  (maxima-error "ERLIST is obsolete, all calls to it have been removed, so where
190
188
         did you dig this one up loser?" message))
191
189
 
192
190
;; All functions are present on non-autoloading systems.  Definition
193
191
;; for autoloading systems is in SUPRV.
194
192
;; If you have dynamic linking you might as well take advantage of it.
195
193
 
196
 
#-(OR PDP10 NIL)
197
 
(DEFMACRO FIND-FUNCTION (FUNCTION) FUNCTION NIL)
 
194
#-(or pdp10 nil)
 
195
(defmacro find-function (function) function nil)
198
196
 
199
197
;; Facility for loading auxilliary macro files such as RATMAC or MHAYAT.
200
198
;; Global macro files are loaded by the prelude file.
201
199
 
202
 
#+LISPM (DEFUN MACRO-DIR (X) (FORMAT NIL "LMMAXQ;~A QFASL" X))
203
 
#+PDP10 (DEFUN MACRO-DIR (X) `((LIBMAX) ,X))
204
 
#+Franz (defun macro-dir (x)  (cond ((cdr (zl-ASSOC x '((rzmac  . "rz//macros")
205
 
                                                     (mhayat . "rat//mhayat")
206
 
                                                     (ratmac . "rat//ratmac")))))
 
200
#+lispm (defun macro-dir (x) (format nil "LMMAXQ;~A QFASL" x))
 
201
#+pdp10 (defun macro-dir (x) `((libmax) ,x))
 
202
#+franz (defun macro-dir (x)  (cond ((cdr (zl-assoc x '((rzmac  . "rz//macros")
 
203
                                                        (mhayat . "rat//mhayat")
 
204
                                                        (ratmac . "rat//ratmac")))))
207
205
                                    (t (concat "libmax//" x))))
208
 
#+NIL (defun macro-dir (x) (merge-pathname-defaults x "[VASL]"))
 
206
#+nil (defun macro-dir (x) (merge-pathname-defaults x "[VASL]"))
209
207
 
210
 
(comment Sample definition only on
211
 
         ITS   see "LIBMAX;MODULE"
212
 
         LISPM see "LMMAX;SYSDEF"
213
 
         NIL   see   "VAXMAX;VAXCL"
214
 
         Multics see "???"
215
 
         Franz see "/usr/lib/lisp/machacks.l"
216
 
()
217
 
(defmacro macsyma-module (name &rest options)
218
 
  (maybe-load-macros options)
219
 
  (maybe-load-declarations options)
220
 
  `(eval-when (compile eval load)
221
 
          (print '(loading ,name) msgfiles)
222
 
          (defprop ,name t loaded?)
223
 
          ,@(maybe-have-some-runtime-options options)))
224
 
)
 
208
(comment sample definition only on
 
209
         its   see "LIBMAX;MODULE"
 
210
         lispm see "LMMAX;SYSDEF"
 
211
         nil   see   "VAXMAX;VAXCL"
 
212
         multics see "???"
 
213
         franz see "/usr/lib/lisp/machacks.l"
 
214
         ()
 
215
         (defmacro macsyma-module (name &rest options)
 
216
           (maybe-load-macros options)
 
217
           (maybe-load-declarations options)
 
218
           `(eval-when (compile eval load)
 
219
             (print '(loading ,name) msgfiles)
 
220
             (defprop ,name t loaded?)
 
221
             ,@(maybe-have-some-runtime-options options)))
 
222
         )
225
223
 
226
224
;; Except on the Lisp Machine, load the specified macro files.
227
225
;; On the Lisp Machine, the DEFSYSTEM facility is used for loading
230
228
;; is far from fool-proof. See LMMAX;SYSDEF for the Lispm
231
229
;; definition of MACSYMA-MODULE.
232
230
 
233
 
#+CL
234
 
(DEFUN LOAD-MACSYMA-MACROS-AT-RUNTIME (&REST L)
235
 
  (MAPCAR #'(LAMBDA (X)
236
 
              (IF (GET X 'MACSYMA-MODULE)
237
 
                   X 
238
 
                   (ERROR  "Missing Macsyma macro file -- ~A" X)))
239
 
          L))
240
 
#-CL
241
 
(DEFUN LOAD-MACSYMA-MACROS-AT-RUNTIME (&REST L)
242
 
  (MAPCAR #'load-when-needed L))
243
 
 
244
 
(DEFMACRO LOAD-MACSYMA-MACROS (&REST MACRO-FILES)
245
 
  `(COMMENT *MACRO*FILES*
246
 
            ,(APPLY #'LOAD-MACSYMA-MACROS-AT-RUNTIME MACRO-FILES)))
247
 
 
248
 
 
249
 
#+Multics
 
231
#+cl
 
232
(defun load-macsyma-macros-at-runtime (&rest l)
 
233
  (mapcar #'(lambda (x)
 
234
              (if (get x 'macsyma-module)
 
235
                  x 
 
236
                  (error  "Missing Maxima macro file -- ~A" x)))
 
237
          l))
 
238
#-cl
 
239
(defun load-macsyma-macros-at-runtime (&rest l)
 
240
  (mapcar #'load-when-needed l))
 
241
 
 
242
(defmacro load-macsyma-macros (&rest macro-files)
 
243
  `(comment *macro*files*
 
244
    ,(apply #'load-macsyma-macros-at-runtime macro-files)))
 
245
 
 
246
 
 
247
#+multics
250
248
(defmacro find-documentation-file (x)
251
249
  (cond ((eq x 'manual)
252
250
         `(let ((filep (probe-file (list (catenate macsyma-dir ">documentation")
253
 
                                     "macsyma.manual"))))
254
 
            (cond (filep filep)
255
 
                  (t (MAXIMA-ERROR "Cannot MAXIMA-FIND the Macsyma manual")))))
 
251
                                         "macsyma.manual"))))
 
252
           (cond (filep filep)
 
253
                 (t (maxima-error "Cannot `maxima-find' the Macsyma manual")))))
256
254
        ((eq x 'manual-index)
257
255
         `(let ((filep (probe-file (list (catenate macsyma-dir ">documentation")
258
 
                                     "macsyma.index.lisp"))))
259
 
            (cond (filep filep)
260
 
                  (t (MAXIMA-ERROR "Cannot MAXIMA-FIND the Macsyma manual index")))))
261
 
        (t (MAXIMA-ERROR "Unknown documentation: " x))))
 
256
                                         "macsyma.index.lisp"))))
 
257
           (cond (filep filep)
 
258
                 (t (maxima-error "Cannot `maxima-find' the Macsyma manual index")))))
 
259
        (t (maxima-error "Unknown documentation: " x))))
262
260
 
263
 
#+Multics
 
261
#+multics
264
262
(defmacro load-documentation-file (x)
265
263
  `(load (find-documentation-file ,x)))
266
264
 
267
265
;;;Reset the stream to its starting position.
268
266
(defmacro rewind-stream (stream)
269
267
  
270
 
#-(or LispM NIL) `(filpos ,stream 0)
271
 
;#+LispM          `(send ,stream ':rewind)
272
 
#+cl `(file-position ,stream 0)
273
 
#+NIL            `(open ,stream))
 
268
  #-(or lispm nil) `(filpos ,stream 0)
 
269
  ;;#+LispM          `(send ,stream ':rewind)
 
270
  #+cl `(file-position ,stream 0)
 
271
  #+nil            `(open ,stream))
274
272
 
275
273
;; Used to temporarily bind contexts in such a way as to not cause
276
274
;; the context garbage collector to run. Used when you don't want to
281
279
 
282
280
(defmacro with-new-context (sub-context &rest forms)
283
281
  `(let ((context (context ,@sub-context)))
284
 
     (prog1 ,@forms
285
 
            (context-unwinder))))
 
282
    (prog1 ,@forms
 
283
      (context-unwinder))))
286
284
 
287
 
 
288
285
;; For creating a macsyma evaluator variable binding context.
289
286
;; (MBINDING (VARIABLES &OPTIONAL VALUES FUNCTION-NAME)
290
287
;;    ... BODY ...)
291
288
 
292
 
(DEFMACRO MBINDING (VARIABLE-SPECIFICATION &REST BODY &AUX (TEMP (GENSYM)))
293
 
  `(LET ((,TEMP ,(CAR VARIABLE-SPECIFICATION)))
294
 
     ;; Don't optimize out this temporary, even if (CAR VARIABLE-SPECICIATION)
295
 
     ;; is an ATOM. We don't want to risk side-effects.
296
 
     ,(CASE (LENGTH VARIABLE-SPECIFICATION)
297
 
        ((1)
298
 
         `(MBINDING-SUB ,TEMP ,TEMP NIL ,@BODY))
299
 
        ((2)
300
 
         `(MBINDING-SUB ,TEMP ,(CADR VARIABLE-SPECIFICATION) NIL ,@BODY))
301
 
        ((3)
302
 
         `(MBINDING-SUB ,TEMP ,(CADR VARIABLE-SPECIFICATION)
303
 
                        ,(CADDR VARIABLE-SPECIFICATION)
304
 
                        ,@BODY))
305
 
        (T
306
 
          (MAXIMA-ERROR "Bad variable specification:" variable-specification)))))
 
289
(defmacro mbinding (variable-specification &rest body &aux (temp (gensym)))
 
290
  `(let ((,temp ,(car variable-specification)))
 
291
    ;; Don't optimize out this temporary, even if (CAR VARIABLE-SPECICIATION)
 
292
    ;; is an ATOM. We don't want to risk side-effects.
 
293
    ,(case (length variable-specification)
 
294
           ((1)
 
295
            `(mbinding-sub ,temp ,temp nil ,@body))
 
296
           ((2)
 
297
            `(mbinding-sub ,temp ,(cadr variable-specification) nil ,@body))
 
298
           ((3)
 
299
            `(mbinding-sub ,temp ,(cadr variable-specification)
 
300
              ,(caddr variable-specification)
 
301
              ,@body))
 
302
           (t
 
303
            (maxima-error "Bad variable specification:" variable-specification)))))
307
304
 
308
 
(DEFVAR MBINDING-USAGE
309
 
  #+(and PDP10 Maclisp)    'PROG1
310
 
  #+(and Multics Maclisp)  'UNWIND-PROTECT
311
 
  #+Franz                  'PROG1
312
 
  #+CL                  'UNWIND-PROTECT
313
 
  #+NIL                    'UNWIND-PROTECT
 
305
(defvar mbinding-usage
 
306
  #+(and pdp10 maclisp)    'prog1
 
307
  #+(and multics maclisp)  'unwind-protect
 
308
  #+franz                  'prog1
 
309
  #+cl                  'unwind-protect
 
310
  #+nil                    'unwind-protect
314
311
  )
315
312
  
316
 
(DEFMACRO MBINDING-SUB (VARIABLES VALUES FUNCTION-NAME &REST BODY
317
 
                                  &AUX (WIN (GENSYM)))
318
 
  (CASE MBINDING-USAGE
319
 
    ((PROG1)
320
 
     `(PROG1 (PROGN (MBIND ,VARIABLES ,VALUES ,FUNCTION-NAME) ,@BODY)
321
 
             (MUNBIND ,VARIABLES)))
322
 
    ((UNWIND-PROTECT)
323
 
     `(LET ((,WIN NIL))
324
 
        (UNWIND-PROTECT
325
 
         (PROGN (MBIND ,VARIABLES ,VALUES ,FUNCTION-NAME)
326
 
                (SETQ ,WIN T)
327
 
                ,@BODY)
328
 
         (IF ,WIN (MUNBIND ,VARIABLES)))))
329
 
    ((PROGV)
330
 
     `(LET ((,WIN (MBINDING-CHECK ,VARIABLES ,VALUES ,FUNCTION-NAME)))
331
 
        (PROGV ,VARIABLES
332
 
               ,WIN
333
 
               ,@BODY)))
334
 
    (T
335
 
     (MAXIMA-ERROR "Unknown setting of MBINDING-USAGE" MBINDING-USAGE))))
336
 
 
337
 
#+NIL
338
 
(DEFMACRO MDEFPROP (A B C) `(MPUTPROP ',A ',B ',C))
339
 
 
340
 
#-Franz ;; Franz uses a function definition in COMM.
341
 
        ;; For MLISTP its arg is known not to be an atom.
342
 
        ;; Otherwise, just use $LISTP.
343
 
        ;; MLISTP exists just to support a Franz hack, so you can just 
344
 
        ;;   ignore it. - JPG
345
 
(DEFMACRO MLISTP (X) `(EQ (CAAR ,X) 'MLIST))
 
313
(defmacro mbinding-sub (variables values function-name &rest body
 
314
                        &aux (win (gensym)))
 
315
  (case mbinding-usage
 
316
    ((prog1)
 
317
     `(prog1 (progn (mbind ,variables ,values ,function-name) ,@body)
 
318
       (munbind ,variables)))
 
319
    ((unwind-protect)
 
320
     `(let ((,win nil))
 
321
       (unwind-protect
 
322
            (progn (mbind ,variables ,values ,function-name)
 
323
                   (setq ,win t)
 
324
                   ,@body)
 
325
         (if ,win (munbind ,variables)))))
 
326
    ((progv)
 
327
     `(let ((,win (mbinding-check ,variables ,values ,function-name)))
 
328
       (progv ,variables
 
329
           ,win
 
330
         ,@body)))
 
331
    (t
 
332
     (maxima-error "Unknown setting of `mbinding-usage'" mbinding-usage))))
 
333
 
 
334
#+nil
 
335
(defmacro mdefprop (a b c) `(mputprop ',a ',b ',c))
 
336
 
 
337
#-franz ;; Franz uses a function definition in COMM.
 
338
;; For MLISTP its arg is known not to be an atom.
 
339
;; Otherwise, just use $LISTP.
 
340
;; MLISTP exists just to support a Franz hack, so you can just 
 
341
;;   ignore it. - JPG
 
342
(defmacro mlistp (x) `(eq (caar ,x) 'mlist))
346
343
 
347
344
;; How About MTYPEP like (MTYPEP EXP 'TAN) or (MTYPEP EXP '*) - Jim.
348
345
;; Better, (EQ (MTYPEP EXP) 'TAN).
349
346
 
350
 
(DEFMACRO MTANP (X) 
351
 
  `(LET ((THING ,X))
352
 
     (AND (NOT (ATOM THING)) (EQ (CAAR THING) '%TAN))))
 
347
(defmacro mtanp (x) 
 
348
  `(let ((thing ,x))
 
349
    (and (not (atom thing)) (eq (caar thing) '%tan))))
353
350
 
354
 
(DEFMACRO MATANP (X)
355
 
  `(LET ((THING ,X))
356
 
     (AND (NOT (ATOM THING)) (EQ (CAAR THING) '%ATAN))))
 
351
(defmacro matanp (x)
 
352
  `(let ((thing ,x))
 
353
    (and (not (atom thing)) (eq (caar thing) '%atan))))
357
354
 
358
355
;; Macros used in LIMIT, DEFINT, RESIDU.
359
356
;; If we get a lot of these, they can be split off into a separate macro
360
357
;; package.
361
358
 
362
 
(DEFMACRO REAL-INFINITYP (X) `(MEMQ ,X REAL-INFINITIES))
363
 
 
364
 
(DEFMACRO INFINITYP (X) `(MEMQ ,X INFINITIES))
365
 
 
366
 
(DEFMACRO REAL-EPSILONP (X) `(MEMQ ,X INFINITESIMALS))
367
 
 
368
 
(DEFMACRO FREE-EPSILONP (X)
369
 
  `(DO ((ONE-EPS INFINITESIMALS (CDR ONE-EPS)))
370
 
       ((NULL ONE-EPS) T)
371
 
     (IF (NOT (FREE (CAR ONE-EPS) ,X))  (RETURN ()))))
372
 
 
373
 
(DEFMACRO FREE-INFP (X)
374
 
  `(DO ((ONE-INF INFINITIES (CDR ONE-INF)))
375
 
       ((NULL ONE-INF) T)
376
 
     (IF (NOT (FREE (CAR ONE-INF) ,X))  (RETURN ()))))
377
 
 
378
 
(DEFMACRO INF-TYPEP (X)
379
 
  `(CAR (AMONGL INFINITIES ,X)))
380
 
 
381
 
(DEFMACRO HOT-COEF (P)
382
 
 `(PDIS (CADDR (CADR (RAT-NO-RATFAC ,P)))))
383
 
 
 
359
(defmacro real-infinityp (x) `(memq ,x real-infinities))
 
360
 
 
361
(defmacro infinityp (x) `(memq ,x infinities))
 
362
 
 
363
(defmacro real-epsilonp (x) `(memq ,x infinitesimals))
 
364
 
 
365
(defmacro free-epsilonp (x)
 
366
  `(do ((one-eps infinitesimals (cdr one-eps)))
 
367
    ((null one-eps) t)
 
368
    (if (not (free (car one-eps) ,x))  (return ()))))
 
369
 
 
370
(defmacro free-infp (x)
 
371
  `(do ((one-inf infinities (cdr one-inf)))
 
372
    ((null one-inf) t)
 
373
    (if (not (free (car one-inf) ,x))  (return ()))))
 
374
 
 
375
(defmacro inf-typep (x)
 
376
  `(car (amongl infinities ,x)))
 
377
 
 
378
(defmacro hot-coef (p)
 
379
  `(pdis (caddr (cadr (rat-no-ratfac ,p)))))
 
380
 
384
381
;; Special form for declaring Macsyma external variables.  It may be used for
385
382
;; User level variables, or those referenced by other Lisp programs.
386
383
 
402
399
;; so if *reset-var* is true defmvar will restore the original value on lispm--Wfs
403
400
;; definition is in commac.
404
401
 
405
 
#-(or Franz ITS lispm cl)
406
 
(DEFMACRO DEFMVAR (VARIABLE &OPTIONAL (INITIAL-VALUE NIL IV-P) DOCUMENTATION
407
 
                            &REST FLAGS &AUX DEFINER TYPE)
408
 
  DOCUMENTATION FLAGS ;; Ignored certain places.
409
 
  (SETQ DEFINER #+(or Multics ) 'DEFCONST
410
 
                #-(or Multics  ) 'DEFVAR)
411
 
  #-(or Lispm NIL)
412
 
  (SETQ TYPE (COND ((MEMQ 'fixnum FLAGS) 'fixnum)
413
 
                   ((MEMQ 'flonum FLAGS) 'flonum)
414
 
                   (T NIL)))
415
 
  #+NIL (macsyma-defmvar-declarations variable flags)
416
 
  `(PROGN 'COMPILE
417
 
          ,(IF IV-P
418
 
               `(,DEFINER ,VARIABLE ,INITIAL-VALUE
419
 
                    #+NIL ,@(AND DOCUMENTATION `(,DOCUMENTATION)))
420
 
               `(,DEFINER ,VARIABLE #+LISPM () ))
421
 
          #-NIL ,@(IF TYPE `((DECLARE (,TYPE ,VARIABLE))))))
 
402
#-(or franz its lispm cl)
 
403
(defmacro defmvar (variable &optional (initial-value nil iv-p) documentation
 
404
                   &rest flags &aux definer type)
 
405
  documentation flags ;; Ignored certain places.
 
406
  (setq definer #+(or multics ) 'defconst
 
407
        #-(or multics  ) 'defvar)
 
408
  #-(or lispm nil)
 
409
  (setq type (cond ((memq 'fixnum flags) 'fixnum)
 
410
                   ((memq 'flonum flags) 'flonum)
 
411
                   (t nil)))
 
412
  #+nil (macsyma-defmvar-declarations variable flags)
 
413
  `(progn 'compile
 
414
    ,(if iv-p
 
415
         `(,definer ,variable ,initial-value
 
416
           #+nil ,@(and documentation `(,documentation)))
 
417
         `(,definer ,variable #+lispm () ))
 
418
    #-nil ,@(if type `((declare (,type ,variable))))))
422
419
 
423
420
;;see commac
424
421
#-(or cl lispm)
425
 
(Defmacro DEFMFUN (function &body  REST &aux .n.)
426
 
  #+NIL (macsyma-defmfun-declarations function rest)
427
 
       `(DEFUN ,FUNCTION  ,REST))
 
422
(defmacro defmfun (function &body  rest &aux .n.)
 
423
  #+nil (macsyma-defmfun-declarations function rest)
 
424
  `(defun ,function  ,rest))
428
425
 
429
 
#+LISPM
430
 
(DEFPROP DEFMSPEC "Macsyma special form" SI:DEFINITION-TYPE-NAME)
 
426
;;#+LISPM
 
427
;;(DEFPROP DEFMSPEC "Macsyma special form" SI:DEFINITION-TYPE-NAME)
431
428
 
432
429
;; Special form for declaring Macsyma external procedures.  Version for ITS
433
430
;; is in LIBMAX;DEFINE.
436
433
 
437
434
 
438
435
#+cl
439
 
(DEFMACRO DEFMSPEC (FUNCTION . REST)
 
436
(defmacro defmspec (function . rest)
440
437
  `(progn
441
 
          (DEFUN-prop ( ,FUNCTION MFEXPR*) . ,REST)
442
 
          #+lispm (SI::RECORD-SOURCE-FILE-NAME ',FUNCTION 'DEFMSPEC)))
 
438
    (defun-prop ( ,function mfexpr*) . ,rest)
 
439
    #+lispm (si::record-source-file-name ',function 'defmspec)))
443
440
 
444
 
;#+LISPM
445
 
;(DEFMACRO DEFMSPEC (FUNCTION . REST)
446
 
;  `(LOCAL-DECLARE ((SYS:FUNCTION-PARENT ,FUNCTION DEFMSPEC))
447
 
;     (DEFUN (:PROPERTY ,FUNCTION MFEXPR*) . ,REST)
448
 
;     (SI:RECORD-SOURCE-FILE-NAME ',FUNCTION 'DEFMSPEC)
449
 
;     ))
 
441
;;#+LISPM
 
442
;;(DEFMACRO DEFMSPEC (FUNCTION . REST)
 
443
;;  `(LOCAL-DECLARE ((SYS:FUNCTION-PARENT ,FUNCTION DEFMSPEC))
 
444
;;     (DEFUN (:PROPERTY ,FUNCTION MFEXPR*) . ,REST)
 
445
;;     (SI:RECORD-SOURCE-FILE-NAME ',FUNCTION 'DEFMSPEC)
 
446
;;     ))
450
447
 
451
448
 
452
449
;;How bout the following for a replacement for the defmspec type.
458
455
;;a macro but they needed to be told anyway.--wfs
459
456
 
460
457
;;see commac
461
 
;#+lispm
462
 
;(defmacro defmspec (fn (aa) &rest rest &aux ans help )
463
 
;  (setq help (intern (format nil "~A-AUX" fn)))
464
 
;  (setq ans
465
 
;       (list    ;;copy-list aa
466
 
;    `(defmacro ,fn (&rest ,aa &aux e)(setq ,aa (copy-list ,aa))
467
 
;              (setq e (cons (list ',fn) ,aa))
468
 
;               `(meval* '(,', help  ',e)))
469
 
;    `(defun ,help (,aa) . ,rest)))
470
 
;  `(progn 'compile . , ans))
 
458
;;#+lispm
 
459
;;(defmacro defmspec (fn (aa) &rest rest &aux ans help )
 
460
;;  (setq help (intern (format nil "~A-AUX" fn)))
 
461
;;  (setq ans
 
462
;;      (list    ;;copy-list aa
 
463
;;    `(defmacro ,fn (&rest ,aa &aux e)(setq ,aa (copy-list ,aa))
 
464
;;             (setq e (cons (list ',fn) ,aa))
 
465
;;               `(meval* '(,', help  ',e)))
 
466
;;    `(defun ,help (,aa) . ,rest)))
 
467
;;  `(progn 'compile . , ans))
471
468
 
472
469
;;eg.
473
 
;(defmspecial $ssum (l) (setq l (cdr l))
474
 
;  (if (= (length l) 4)
475
 
;      (dosum (car l) (cadr l) (meval (caddr l)) (meval (cadddr l)) t)
476
 
;      (wna-err '$$sum)))
 
470
;;(defmspecial $ssum (l) (setq l (cdr l))
 
471
;;  (if (= (length l) 4)
 
472
;;      (dosum (car l) (cadr l) (meval (caddr l)) (meval (cadddr l)) t)
 
473
;;      (wna-err '$$sum)))
477
474
 
478
475
 
479
476
;;;     The following MAUTOLOAD macro makes setting up autoload props for files
498
495
;;;     Note that the first arg must be of the form (FN2 DEV DIR) if a file
499
496
;;; mask is being used; this macro could be much more elaborate.
500
497
 
501
 
#+ITS
502
 
(DEFMACRO MAUTOLOAD (FN2-DEV-DIR &REST MASTER-LIST)
503
 
  `(DOLIST (L ',MASTER-LIST)
504
 
     (DO ((FILE (IF (ATOM (CAR L))
505
 
                    (CONS (CAR L) ,FN2-DEV-DIR)
506
 
                    (CAR L)))
507
 
          (FUNLIST (CDR L) (CDR FUNLIST)))
508
 
         ((NULL FUNLIST))
509
 
       (PUTPROP (CAR FUNLIST) FILE 'AUTOLOAD))))
 
498
;;#+ITS
 
499
;;(DEFMACRO MAUTOLOAD (FN2-DEV-DIR &REST MASTER-LIST)
 
500
;;  `(DOLIST (L ',MASTER-LIST)
 
501
;;     (DO ((FILE (IF (ATOM (CAR L))
 
502
;;                  (CONS (CAR L) ,FN2-DEV-DIR)
 
503
;;                  (CAR L)))
 
504
;;        (FUNLIST (CDR L) (CDR FUNLIST)))
 
505
;;       ((NULL FUNLIST))
 
506
;;       (PUTPROP (CAR FUNLIST) FILE 'AUTOLOAD))))
510
507
 
511
 
#-Multics
512
 
(DEFMACRO SYS-DEFAULTF (X) `(DEFAULTF ,X))
 
508
#-multics
 
509
(defmacro sys-defaultf (x) `(defaultf ,x))
513
510
;;; For #+Multics a function definition for SYS-DEFAULTF can be found 
514
511
;;; in SUPRV.
515
512
 
516
513
(defmacro sys-user-id ()
517
 
  #+Franz '(getenv '|USER|)
 
514
  #+franz '(getenv '|USER|)
518
515
  #+lispm 'user-id
519
 
  #+Multics '(status uname)
520
 
  #-(or Franz Multics lispm) '(status userid))
 
516
  #+multics '(status uname)
 
517
  #-(or franz multics lispm) '(status userid))
521
518
 
522
519
(defmacro sys-free-memory ()
523
 
  #-(or Multics lispm) '(status memfree)
524
 
  #+(or Multics lispm) 10000.) ;This should look at the pdir size
525
 
                               ;and mung it to give a good approximation.
 
520
  #-(or multics lispm) '(status memfree)
 
521
  #+(or multics lispm) 10000.)      ;This should look at the pdir size
 
522
                                        ;and mung it to give a good approximation.
526
523
 
527
524
;; Setf hacking.
528
525
;;
532
529
;;                `(,sym ,tag ,value)
533
530
;;                '`((PUTPROP ,nsym ,nvalue ,ntag))))
534
531
 
535
 
#+PDP10
536
 
(defsetf MGET ((() sym tag) value) T 
537
 
  (eval-ordered* '(nsym ntag nvalue)
538
 
                 `(,sym ,tag ,value)
539
 
                 '`((MPUTPROP ,nsym ,nvalue ,ntag))))
540
 
 
541
 
#+PDP10
542
 
(defsetf $GET ((() sym tag) value) T 
543
 
  (eval-ordered* '(nsym ntag nvalue)
544
 
                 `(,sym ,tag ,value)
545
 
                 '`(($PUT ,nsym ,nvalue ,ntag))))
546
 
 
547
 
#+Franz
548
 
(defsetf mget (expr value)
549
 
   `(mputprop ,(cadr expr) ,value ,(caddr expr)))
550
 
 
551
 
#+Franz
552
 
(defsetf $get (expr value)
553
 
   `($put ,(cadr expr) ,value ,(caddr expr)))
554
 
 
555
 
#+NIL
556
 
(DEFPROP MGET SETF-MGET SI:SETF-SUBR)
557
 
#+NIL
558
 
(DEFPROP $GET SETF-$GET SI:SETF-SUBR)
559
 
 
560
 
;;DIFFERENT version of setf on Multics and LM ...Bummer... -JIM 3/4/81
561
 
#+MULTICS
562
 
(defsetf MGET (sym tag) value
563
 
  `(MPUTPROP ,sym ,value ,tag))
564
 
 
565
 
(DEFMFUN MGET (ATOM IND)
566
 
  (LET ((PROPS (AND (SYMBOLP ATOM) (GET ATOM 'MPROPS))))
567
 
    (AND PROPS (GETf (cdr PROPS) IND))))
 
532
;;#+PDP10
 
533
;;(defsetf MGET ((() sym tag) value) T 
 
534
;;  (eval-ordered* '(nsym ntag nvalue)
 
535
;;               `(,sym ,tag ,value)
 
536
;;               '`((MPUTPROP ,nsym ,nvalue ,ntag))))
 
537
 
 
538
;;#+PDP10
 
539
;;(defsetf $GET ((() sym tag) value) T 
 
540
;;  (eval-ordered* '(nsym ntag nvalue)
 
541
;;               `(,sym ,tag ,value)
 
542
;;               '`(($PUT ,nsym ,nvalue ,ntag))))
 
543
 
 
544
;;#+Franz
 
545
;;(defsetf mget (expr value)
 
546
;;   `(mputprop ,(cadr expr) ,value ,(caddr expr)))
 
547
 
 
548
;;#+Franz
 
549
;;(defsetf $get (expr value)
 
550
;;   `($put ,(cadr expr) ,value ,(caddr expr)))
 
551
 
 
552
;;#+NIL
 
553
;;(DEFPROP MGET SETF-MGET SI:SETF-SUBR)
 
554
;;#+NIL
 
555
;;(DEFPROP $GET SETF-$GET SI:SETF-SUBR)
 
556
 
 
557
;;;DIFFERENT version of setf on Multics and LM ...Bummer... -JIM 3/4/81
 
558
;;#+MULTICS
 
559
;;(defsetf MGET (sym tag) value
 
560
;;  `(MPUTPROP ,sym ,value ,tag))
 
561
 
 
562
(defmfun mget (atom ind)
 
563
  (let ((props (and (symbolp atom) (get atom 'mprops))))
 
564
    (and props (getf (cdr props) ind))))
568
565
 
569
566
#+(or cl ti)
570
 
(defsetf MGET (sym tag) (value)
571
 
  `(MPUTPROP ,sym ,value ,tag))
 
567
(defsetf mget (sym tag) (value)
 
568
  `(mputprop ,sym ,value ,tag))
572
569
 
573
570
(defmacro old-get (plist tag)
574
571
  `(getf (cdr ,plist) ,tag))
575
572
 
576
 
#+ MULTICS
577
 
(defsetf $GET (sym tag) value
578
 
  `($PUT ,sym ,value ,tag))
 
573
;;#+ MULTICS
 
574
;;(defsetf $GET (sym tag) value
 
575
;;  `($PUT ,sym ,value ,tag))
579
576
 
580
 
(DEFMFUN $GET (ATOM IND) (PROP1 '$GET ATOM NIL IND))
 
577
(defmfun $get (atom ind) (prop1 '$get atom nil ind))
581
578
 
582
579
#+(or cl ti)
583
 
(defsetf $GET (sym tag) (value)
584
 
  `($PUT ,sym ,value ,tag))
585
 
;
586
 
;#+(and LISPM (not (or cl ti)))
587
 
;(DEFUN (:PROPERTY MGET SI:SETF) (REF VAL)
588
 
;  `(MPUTPROP ,(SECOND REF) ,VAL ,(THIRD REF)))
589
 
;
590
 
;#+(and LISPM (not (or cl ti)))
591
 
;(DEFUN (:PROPERTY $GET SI:SETF) (REF VAL)
592
 
;  `($PUT ,(SECOND REF) ,VAL ,(THIRD REF)))
 
580
(defsetf $get (sym tag) (value)
 
581
  `($put ,sym ,value ,tag))
 
582
;;
 
583
;;#+(and LISPM (not (or cl ti)))
 
584
;;(DEFUN (:PROPERTY MGET SI:SETF) (REF VAL)
 
585
;;  `(MPUTPROP ,(SECOND REF) ,VAL ,(THIRD REF)))
 
586
;;
 
587
;;#+(and LISPM (not (or cl ti)))
 
588
;;(DEFUN (:PROPERTY $GET SI:SETF) (REF VAL)
 
589
;;  `($PUT ,(SECOND REF) ,VAL ,(THIRD REF)))
593
590
 
594
591
(defmacro initialize-random-seed ()
595
 
  #+(or PDP10 NIL) '(sstatus random 0)
596
 
  #+CL () ;;(si:random-initialize si:random-array) obsolete. what now?
 
592
  ;;  #+(or PDP10 NIL) '(sstatus random 0)
 
593
  #+cl () ;;(si:random-initialize si:random-array) obsolete. what now?
597
594
  )
598
595
 
599
596
;; These idiot macros are used in some places in macsyma.
602
599
;; NIL (common-lisp) has the nth accessors through to tenth, the rest
603
600
;; frobs through to rest5.  However i had thought that the latter were
604
601
;; obsolete, and had been going to flush them. --gsb
605
 
#-(or cl ti NIL)
606
 
(DEFMACRO EIGHTH  (FORM) `(CADDDR (CDDDDR ,FORM)))
607
 
#-(or cl ti NIL)
608
 
(DEFMACRO NINTH   (FORM) `(CAR (CDDDDR (CDDDDR ,FORM))))
609
 
#-(or cl ti NIL)
610
 
(DEFMACRO TENTH   (FORM) `(CADR (CDDDDR (CDDDDR ,FORM))))
611
 
#-NIL
612
 
(DEFMACRO REST5 (FORM) `(CDR (CDDDDR ,FORM)))
613
 
(DEFMACRO REST6 (FORM) `(CDDR (CDDDDR ,FORM)))
 
602
#-(or cl ti nil)
 
603
(defmacro eighth  (form) `(cadddr (cddddr ,form)))
 
604
#-(or cl ti nil)
 
605
(defmacro ninth   (form) `(car (cddddr (cddddr ,form))))
 
606
#-(or cl ti nil)
 
607
(defmacro tenth   (form) `(cadr (cddddr (cddddr ,form))))
 
608
#-nil
 
609
(defmacro rest5 (form) `(cdr (cddddr ,form)))
 
610
(defmacro rest6 (form) `(cddr (cddddr ,form)))
614
611
 
615
612
;;; We should probably move these into the compatibility package on
616
 
;;; mulitcs.
 
613
;;; multics.
617
614
 
618
 
#+Multics
619
615
(defmacro *break (breakp mess)
620
616
  `(apply 'break `(,,mess ,',breakp)))
621
617
 
622
618
;;; To satisfy GJC's speed mainia I resisted changing these in the
623
619
;;; code. -Jim.
624
620
 
625
 
#+Multics
626
 
(defmacro +tyi (&rest args)
627
 
  `(tyi ,@args))
628
 
 
629
 
#+Multics 
630
 
(defmacro +tyo (&rest args)
631
 
  `(tyo ,@args))
632
 
 
633
 
;;; Let the compiler know that x is a fixnum. I guess it will also
634
 
;;; then optimize the call to +.
635
 
#+Multics
636
 
(defmacro fixnum-identity (x)
637
 
  `(f+ ,x))
 
621
;;#+Multics
 
622
;;(defmacro +tyi (&rest args)
 
623
;;  `(tyi ,@args))
 
624
 
 
625
;;#+Multics 
 
626
;;(defmacro +tyo (&rest args)
 
627
;;  `(tyo ,@args))
 
628
 
 
629
;;;; Let the compiler know that x is a fixnum. I guess it will also
 
630
;;;; then optimize the call to +.
 
631
;;#+Multics
 
632
;;(defmacro fixnum-identity (x)
 
633
;;  `(f+ ,x))
638
634
 
639
635
;;this was not called.
640
 
;(defmacro get-symbol-array-pointer (x)
641
 
;  #+franz `(getd ,x)
642
 
;  #+nil `(si:get-symbol-array-pointer ,x)
643
 
;  #+cl `(symbol-array ,x)
644
 
;  #+maclisp `(get ,x 'array))
 
636
;;(defmacro get-symbol-array-pointer (x)
 
637
;;  #+franz `(getd ,x)
 
638
;;  #+nil `(si:get-symbol-array-pointer ,x)
 
639
;;  #+cl `(symbol-array ,x)
 
640
;;  #+maclisp `(get ,x 'array))
645
641
 
646
642
 
647
643
(defmacro  mdefprop (sym val indicator)
648
644
  `(mputprop ',sym ',val ',indicator))
649
645
 
650
646
 
651
 
(DEFMFUN MPUTPROP (ATOM VAL IND)
652
 
  (LET ((PROPS (GET ATOM 'MPROPS)))
653
 
    (IF (NULL PROPS) (PUTPROP ATOM (SETQ PROPS (NCONS NIL)) 'MPROPS))
654
 
    (PUTPROP PROPS VAL IND)))
 
647
(defmfun mputprop (atom val ind)
 
648
  (let ((props (get atom 'mprops)))
 
649
    (if (null props) (putprop atom (setq props (ncons nil)) 'mprops))
 
650
    (putprop props val ind)))