<commit_before>;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.

;;; Copyright (C) 2000 <NAME> (<EMAIL>)

;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.

;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Lesser General Public License for more details.

;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

;;; File: reflect.lisp
;;; Description: Wrapper functions that provide the MOP functionality needed
;;; by LISA, hiding implementation-specific details.

;;; $Id: reflect.lisp,v 1.11 2002/08/06 22:40:56 youngde Exp $

(in-package "LISA.REFLECT")

;;; The code contained with the following MACROLET form courtesy of the PORT
;;; module, CLOCC project, http://clocc.sourceforge.net.

#+(or allegro clisp cmu cormanlisp lispworks lucid sbcl)
;; we use `macrolet' for speed - so please be careful about double evaluations
;; and mapping (you cannot map or funcall a macro, you know)
(eval-when (:compile-toplevel :load-toplevel :execute)
  (macrolet ((class-slots* (class)
               #+allegro `(clos:class-slots ,class)
               #+clisp `(clos::class-slots ,class)
               #+cmu `(pcl::class-slots ,class)
               #+cormanlisp `(cl:class-slots ,class)
               #+lispworks `(hcl::class-slots ,class)
               #+lucid `(clos:class-slots ,class)
               #+sbcl `(sb-pcl::class-slots ,class))
             (class-slots1 (obj)
               `(class-slots*
                 (typecase ,obj
                   (class ,obj)
                   (symbol (find-class ,obj))
                   (t (class-of ,obj)))))
             (slot-name (slot)
               #+(and allegro (not (version>= 6))) `(clos::slotd-name ,slot)
               #+(and allegro (version>= 6)) `(clos:slot-definition-name ,slot)
               #+clisp `(clos::slotdef-name ,slot)
               #+cmu `(slot-value ,slot 'pcl::name)
               #+cormanlisp `(getf ,slot :name)
               #+lispworks `(hcl::slot-definition-name ,slot)
               #+lucid `(clos:slot-definition-name ,slot)
               #+sbcl `(slot-value ,slot 'sb-pcl::name))
             (slot-initargs (slot)
               #+(and allegro (not (version>= 6))) `(clos::slotd-initargs ,slot)
               #+(and allegro (version>= 6))
               `(clos:slot-definition-initargs ,slot)
               #+clisp `(clos::slotdef-initargs ,slot)
               #+cmu `(slot-value ,slot 'pcl::initargs)
               #+cormanlisp `(getf ,slot :initargs)
               #+lispworks `(hcl::slot-definition-initargs ,slot)
               #+lucid `(clos:slot-definition-initargs ,slot)
               #+sbcl `(slot-value ,slot 'sb-pcl::initargs))
             (slot-one-initarg (slot) `(car (slot-initargs ,slot)))
             (slot-alloc (slot)
               #+(and allegro (not (version>= 6)))
               `(clos::slotd-allocation ,slot)
               #+(and allegro (version>= 6))
               `(clos:slot-definition-allocation ,slot)
               #+clisp `(clos::slotdef-allocation ,slot)
               #+cmu `(pcl::slot-definition-allocation ,slot)
               #+cormanlisp `(getf ,slot :allocation)
               #+lispworks `(hcl::slot-definition-allocation ,slot)
               #+lucid `(clos:slot-definition-allocation ,slot)
               #+sbcl `(sb-pcl::slot-definition-allocation ,slot)))

    (defun class-slot-list (class &optional (all t))
      "Return the list of slots of a CLASS.
CLASS can be a symbol, a class object (as returned by `class-of')
or an instance of a class.
If the second optional argument ALL is non-NIL (default),
all slots are returned, otherwise only the slots with
:allocation type :instance are returned."
      (unless (class-finalized-p class)<commit_msg>Updated for clisp 2.38<commit_after>;;; This file is part of LISA, the Lisp-based Intelligent Software
;;; Agents platform.

;;; Copyright (C) 2000 <NAME> (<EMAIL>)

;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 2.1
;;; of the License, or (at your option) any later version.

;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Lesser General Public License for more details.

;;; You should have received a copy of the GNU Lesser General Public License
;;; along with this library; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

;;; File: reflect.lisp
;;; Description: Wrapper functions that provide the MOP functionality needed
;;; by LISA, hiding implementation-specific details.

;;; $Id: reflect.lisp,v 1.12 2006/02/21 14:41:57 youngde Exp $

(in-package "LISA.REFLECT")

;;; The code contained with the following MACROLET form courtesy of the PORT
;;; module, CLOCC project, http://clocc.sourceforge.net.

#+(or allegro clisp cmu cormanlisp lispworks lucid sbcl)
;; we use `macrolet' for speed - so please be careful about double evaluations
;; and mapping (you cannot map or funcall a macro, you know)
(eval-when (:compile-toplevel :load-toplevel :execute)
  (macrolet ((class-slots* (class)
               #+allegro `(clos:class-slots ,class)
               #+clisp `(clos::class-slots ,class)
               #+cmu `(pcl::class-slots ,class)
               #+cormanlisp `(cl:class-slots ,class)
               #+lispworks `(hcl::class-slots ,class)
               #+lucid `(clos:class-slots ,class)
               #+sbcl `(sb-pcl::class-slots ,class))
             (class-slots1 (obj)
               `(class-slots*
                 (typecase ,obj
                   (class ,obj)
                   (symbol (find-class ,obj))
                   (t (class-of ,obj)))))
             (slot-name (slot)
               #+(and allegro (not (version>= 6))) `(clos::slotd-name ,slot)
               #+(and allegro (version>= 6)) `(clos:slot-definition-name ,slot)
               #+clisp `(clos:slot-definition-name ,slot)
               #+cmu `(slot-value ,slot 'pcl::name)
               #+cormanlisp `(getf ,slot :name)
               #+lispworks `(hcl::slot-definition-name ,slot)
               #+lucid `(clos:slot-definition-name ,slot)
               #+sbcl `(slot-value ,slot 'sb-pcl::name))
             (slot-initargs (slot)
               #+(and allegro (not (version>= 6))) `(clos::slotd-initargs ,slot)
               #+(and allegro (version>= 6))
               `(clos:slot-definition-initargs ,slot)
               #+clisp `(clos:slot-definition-initargs ,slot)
               #+cmu `(slot-value ,slot 'pcl::initargs)
               #+cormanlisp `(getf ,slot :initargs)
               #+lispworks `(hcl::slot-definition-initargs ,slot)
               #+lucid `(clos:slot-definition-initargs ,slot)
               #+sbcl `(slot-value ,slot 'sb-pcl::initargs))
             (slot-one-initarg (slot) `(car (slot-initargs ,slot)))
             (slot-alloc (slot)
               #+(and allegro (not (version>= 6)))
               `(clos::slotd-allocation ,slot)
               #+(and allegro (version>= 6))
               `(clos:slot-definition-allocation ,slot)
               #+clisp `(clos:slot-definition-allocation ,slot)
               #+cmu `(pcl::slot-definition-allocation ,slot)
               #+cormanlisp `(getf ,slot :allocation)
               #+lispworks `(hcl::slot-definition-allocation ,slot)
               #+lucid `(clos:slot-definition-allocation ,slot)
               #+sbcl `(sb-pcl::slot-definition-allocation ,slot)))

    (defun class-slot-list (class &optional (all t))
      "Return the list of slots of a CLASS.
CLASS can be a symbol, a class object (as returned by `class-of')
or an instance of a class.
If the second optional argument ALL is non-NIL (default),
all slots are returned, otherwise only the slots with
:allocation type :instance are returned."
      (unless (class-finalized-p class)
{'fraction_non_alphanumeric': 0.13284518828451883, 'fraction_numerical': 0.010576476057647605, 'mean_word_length': 2.500813669650122, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1518662', 'n_tokens_mistral': 2702, 'n_tokens_neox': 2580, 'n_words': 836}