Fix bug #4307: partswitch affects op and operatorp
[maxima.git] / src / evalw.lisp
blob72fa946f95379ce57ad28f9edeb9ebdacd69858a
1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; The data in this file contains enhancements. ;;;;;
4 ;;; ;;;;;
5 ;;; Copyright (c) 1984,1987 by William Schelter,University of Texas ;;;;;
6 ;;; All rights reserved ;;;;;
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9 ;;; (c) Copyright 1981 Massachusetts Institute of Technology ;;;
10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12 (in-package :maxima)
14 (macsyma-module evalw)
16 ;;; Assuming that this will only be a top-level form, it will
17 ;;; only be seen by MEVAL when a file is batched.
19 ;;; EVAL_WHEN(TRANSLATE,FOO(ME),BAZ())$
20 ;;; EVAL_WHEN([LOADFILE,BATCH],INITIALIZE())$
22 ;; Gosh. Seems it was really stupid to have EVAL_WHEN for BATCH and DEMO,
23 ;; people use it for the most random things. -gjc
25 (defmspec $eval_when (argl)
26 (setq argl (cdr argl))
27 (when (or (< (length argl) 2)
28 (not (or (atom (car argl))
29 ($listp (car argl)))))
30 (merror (intl:gettext "eval_when: incorrect arguments; found: ~M") (car argl)))
31 (if (member '$batch (if ($listp (car argl))
32 (cdar argl)
33 (list (car argl))))
34 `(($evaluated_when) ,@(mapcar #'meval (cdr argl)))
35 '$not_evaluated_when))