Maixma functions sstatus and status



This is the documentation of status in Chapter 34. Runtime enviroment:

--------------------------------------------------------------------------------
-- Function: status (feature)
-- Function: status (feature, <putative_feature>)
-- Function: status (status)
     Returns information about the presence or absence of certain
     system-dependent features.

        * `status (feature)' returns a list of system features.  These
          include Lisp version, operating system type, etc.  The list
          may vary from one Lisp type to another.

        * `status (feature, <putative_feature>)' returns `true' if
          <putative_feature> is on the list of items returned by
          `status (feature)' and `false' otherwise.  `status' quotes
          the argument <putative_feature>.  The quote-quote operator
          `''' defeats quotation.  A feature whose name contains a
          special character, such as a hyphen, must be given as a
          string argument. For example, `status (feature, "ansi-cl")'.

        * `status (status)' returns a two-element list `[feature,
          status]'.  `feature' and `status' are the two arguments
          accepted by the `status' function; it is unclear if this list
          has additional significance.

     The variable `features' contains a list of features which apply to
     mathematical expressions. See `features' and `featurep' for more
     information.
--------------------------------------------------------------------------------

The last option status(status) is strange. I think, we simply should cut
out the following line of code in the function $status:

      ($status '((mlist simp) $feature $status))

Perhaps this line of code was a placeholder for code which never has
been implemented.

This is the documentation of sstatus in Chapter 4. Command Line:

--------------------------------------------------------------------------------
-- Function: sstatus (<feature>, <package>)
     Sets the status of <feature> in <package>.  After `sstatus
     (<feature>, <package>)' is executed, `status (<feature>,
     <package>)' returns `true'.  This can be useful for package
     writers, to keep track of what features they have loaded in.
--------------------------------------------------------------------------------

First, I think we should move this description to the chapter 34.
Runtime Enviroment too. Second, I think this description does not match
the implementation. Perhaps this is better:

--------------------------------------------------------------------------------
-- Function: sstatus (<option>, <item>)
     If <option> is the symbol `feature', <item> is put on the list 
     of system features. After `sstatus (feature, <item>)' is executed, 
     `status (feature, <item>)' returns `true'.
     If <option> is the symbol `nofeature', <item> is deleted from the 
     list of system features. This can be useful for package writers, 
     to keep track of what features they have loaded in.
--------------------------------------------------------------------------------

Furthermore, I have reworked the code of both functions a bit.

In $status I have removed the calls to assert and error. For these cases
I have used a call to merror to avoid a Lisp error. The line which
causes the return of a list is cut out.

(defmspec $status (form)
  (setq form (cdr form))
  (let* ((keyword (car form))
         (feature (cadr form)))
    (when (not (symbolp keyword))
      (merror (intl:gettext "status: First argument must be a
symbol.")))
    (when (not (or (stringp feature) (symbolp feature)))
      (merror
        (intl:gettext "status: Second argument must be symbol or a
string.")))
    (case keyword
      ($feature (cond ((null feature) (dollarify *features*))
                      ((member (intern (if (stringp feature)
                                           (maybe-invert-string-case
feature)
                                           (symbol-name (fullstrip1
feature)))
                                       'keyword)
                               *features* :test #'equal) t)))
      (t (merror (intl:gettext "status: Unknown argument: ~M~%")
keyword)))))

To reflect better the functionality of the function $sstatus I have
renamed the arguments.

(defquote $sstatus (keyword item)
  (cond ((equal keyword '$feature)
         (pushnew ($mkey item) *features*) t)
        ((equal keyword '$nofeature)
         (setq *features* (delete ($mkey item) *features*)) t)
        (t
         (merror (intl:gettext "sstatus: Unknown argument: ~M~%")
keyword))))

Remark:

Both functions are used only at a few places in some packages, e.g ode2.
Furthermore, I think it is not a good idea to put and remove Maxima
packages on the Lisp list *features*.

Other packages uses the functionality of declare and featurep to
register a package or simply put a keyword on the property list of the
symbol which represents the name of the package with put and get.
Perhaps we should improve status and sstatus in a similar way and avoid
the usage of the Lisp variable *features*. 

Dieter Kaiser