<commit_before>(cl:in-package #:common-lisp-user)

;;;; When phase 3 starts, we have a bunch of bridge generic functions
;;;; in the association list *BRIDGE-GENERIC-FUNCTIONS* and a bunch of
;;;; bridge classes in the association list *BRIDGE-CLASSES*.  The
;;;; bridge generic functions are only the accessor functions for
;;;; which accessor methods were automatically created when the bridge
;;;; classes were created.  The bridge classes correspond to the class
;;;; hierarchy specified in the AMOP.
;;;;
;;;; The purpose of phase 3 is repeat the action of phase 2, except
;;;; that target generic functions and target classes will be created.
;;;; For that to work, the bridge classes, which are host instances
;;;; but not host classes, must be able to play the role of classes,
;;;; i.e., it must be possible to instantiate them by calling some
;;;; version of MAKE-INSTANCE.
;;;;
;;;; We accomplish the task in three stages.  First, we create more
;;;; bridge generic functions, namely MAKE-INSTANCE and those generic
;;;; functions that are needed by MAKE-INSTANCE such as
;;;; ALLOCATE-INSTANCE, INITIALIZE-INSTANCE, etc.  Next, we INSTALL
;;;; the bridge generic functions that are needed as host functions so
;;;; that they can be called normally.  Finally, we use what was
;;;; installed to create the standard accessor generic functions as
;;;; target generic functions and to create the standard classes as
;;;; target classes.

(asdf:defsystem :sicl-clos-phase3
  :depends-on (:sicl-clos-phase1 :sicl-clos-phase2)
  ;; We use :SERIAL T so as to reduce the clutter with respect to the
  ;; dependencies, and to make the order completely predictable.
  :serial t
  :components
  (;; When this phase starts, we have a bunch of bridge classes in
   ;; *BRIDGE-CLASSES*.  It is convenient to finalize them all so that
   ;; we are done with some of the accessor functions. 
   (:file "finalize-classes")
   ;; Define a heap instance as a STRUCT with two slots, the class and
   ;; the contents vector.  During this phase, the class slot will
   ;; contain a bridge class.
   (:file "heap-instance")
   ;; Define a version of CLASS-OF that, if given a heap instance as
   ;; defined previously, returns the contents of the class slot.  If
   ;; given something else, it returns the bridge class named T.
   (:file "class-of")
   ;; Define an ordinary function that implements the default action
   ;; for ALLOCATE-INSTANCE when given a standard class or a
   ;; funcallable standard class.  The default action is to allocate a
   ;; heap instance in the form of a STRUCT and a contents vector that
   ;; contains 2 more cells than there are slots in the class so as to
   ;; make room for the class number and the list of effective slots
   ;; of the class of the instance. 
   (:file "allocate-instance-support")
   ;; Define an ordinary function called ALLOCATE-INSTANCE that only
   ;; works correctly when given a standard class or a funcallable
   ;; standard class.
   (:file "allocate-instance-defuns")
   ;; Define ALLOCATE-BUILT-IN-INSTANCE as an ordinary function.  It
   ;; allocates a heap instance in the form of a STRUCT and a contents
   ;; vector that contains 1 more cell than there are slots in the
   ;; class so as to make room for the class number.
   (:file "allocate-built-in-instance")
   ;; Define the two ordinary functions STANDARD-INSTANCE-ACCESS and
   ;; (SETF STANDARD-INSTANCE-ACCESS) according to the specification.
   ;; They take an instance and a location in the form of an integer,
   ;; and return (or set) the contents of the cell in the contents
   ;; vector with the given location.
   (:file "standard-instance-access")
   ;; Define ordinary functions that implement default behavior of
   ;; SLOT-VALUE-USING-CLASS and others in the same family.
   (:file "slot-value-etc-support")
   ;; Define SLOT-VALUE-USING-CLASS and others in the same family as
   ;; ordinary functions.  They work if the class of the object is
   ;; either STANDARD-CLASS or FUNCALLABLE-STANDARD-CLASS.
   (:file "slot-value-etc-defuns")
   ;; During phase 2, SLOT-VALUE and (SETF SLOT-VALUE) were defined to
   ;; always call ERROR, but they were defined so as to avoid compiler
   ;; warnings when accessor methods referred to them.  Now, we
   ;; undefine them, in order to avoid a compiler warning in the next
   ;; step.
   (:file "fmakunbound-slot-value")
   ;; Define specified functions in the SLOT-VALUE family. 
   (:file "slot-value-etc-specified-defuns")
   ;; Define ordinary functions implementing standard actions for
   ;; INITIALIZE-INSTANCE, REINITIALIZE-INSTANCE, and
   ;; SHARED-INITIALIZE.
   (:file "initialize-support")
   ;; Define generic functions INITIALIZE-INSTANCE,
   ;; REINITIALIZE-INSTANCE, and SHARED-INITIALIZE.  They will be
   ;; created as bridge generic functions and added to the list in
   ;; *BRIDGE-GENERIC-FUNCTIONS*, because DEFGENERIC still works that
   ;; way.
   (:file "initialize-defgenerics")
   ;; Define default primary methods on the generic functions
   ;; INITIALIZE-INSTANCE, REINITIALIZE-INSTANCE, and
   ;; SHARED-INITIALIZE.  These methods are specialized to
   ;; STANDARD-OBJECT.
   (:file "initialize-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE and
   ;; REINITIALIZE-INSTANCE specialized to STANDARD-GENERIC-FUNCTION
   ;; that call the default action already defined during phase 2.
   (:file "generic-function-initialization-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE specialized to
   ;; STANDARD-CLASS, FUNCALLABLE-STANDARD-CLASS, and BUILT-IN-CLASS
   ;; that call the default action already defined during phase 2.
   (:file "class-initialization-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE specialized to
   ;; METHOD and STANDARD-ACCESSOR-METHOD that call the default action
   ;; already defined during phase 2.
   (:file "method-initialization-defmethods")
   ;; Define functions, generic functions and methods for<commit_msg>Replaced initialize component by new split-up files in phase 3.<commit_after>(cl:in-package #:common-lisp-user)

;;;; When phase 3 starts, we have a bunch of bridge generic functions
;;;; in the association list *BRIDGE-GENERIC-FUNCTIONS* and a bunch of
;;;; bridge classes in the association list *BRIDGE-CLASSES*.  The
;;;; bridge generic functions are only the accessor functions for
;;;; which accessor methods were automatically created when the bridge
;;;; classes were created.  The bridge classes correspond to the class
;;;; hierarchy specified in the AMOP.
;;;;
;;;; The purpose of phase 3 is repeat the action of phase 2, except
;;;; that target generic functions and target classes will be created.
;;;; For that to work, the bridge classes, which are host instances
;;;; but not host classes, must be able to play the role of classes,
;;;; i.e., it must be possible to instantiate them by calling some
;;;; version of MAKE-INSTANCE.
;;;;
;;;; We accomplish the task in three stages.  First, we create more
;;;; bridge generic functions, namely MAKE-INSTANCE and those generic
;;;; functions that are needed by MAKE-INSTANCE such as
;;;; ALLOCATE-INSTANCE, INITIALIZE-INSTANCE, etc.  Next, we INSTALL
;;;; the bridge generic functions that are needed as host functions so
;;;; that they can be called normally.  Finally, we use what was
;;;; installed to create the standard accessor generic functions as
;;;; target generic functions and to create the standard classes as
;;;; target classes.

(asdf:defsystem :sicl-clos-phase3
  :depends-on (:sicl-clos-phase1 :sicl-clos-phase2)
  ;; We use :SERIAL T so as to reduce the clutter with respect to the
  ;; dependencies, and to make the order completely predictable.
  :serial t
  :components
  (;; When this phase starts, we have a bunch of bridge classes in
   ;; *BRIDGE-CLASSES*.  It is convenient to finalize them all so that
   ;; we are done with some of the accessor functions. 
   (:file "finalize-classes")
   ;; Define a heap instance as a STRUCT with two slots, the class and
   ;; the contents vector.  During this phase, the class slot will
   ;; contain a bridge class.
   (:file "heap-instance")
   ;; Define a version of CLASS-OF that, if given a heap instance as
   ;; defined previously, returns the contents of the class slot.  If
   ;; given something else, it returns the bridge class named T.
   (:file "class-of")
   ;; Define an ordinary function that implements the default action
   ;; for ALLOCATE-INSTANCE when given a standard class or a
   ;; funcallable standard class.  The default action is to allocate a
   ;; heap instance in the form of a STRUCT and a contents vector that
   ;; contains 2 more cells than there are slots in the class so as to
   ;; make room for the class number and the list of effective slots
   ;; of the class of the instance. 
   (:file "allocate-instance-support")
   ;; Define an ordinary function called ALLOCATE-INSTANCE that only
   ;; works correctly when given a standard class or a funcallable
   ;; standard class.
   (:file "allocate-instance-defuns")
   ;; Define ALLOCATE-BUILT-IN-INSTANCE as an ordinary function.  It
   ;; allocates a heap instance in the form of a STRUCT and a contents
   ;; vector that contains 1 more cell than there are slots in the
   ;; class so as to make room for the class number.
   (:file "allocate-built-in-instance")
   ;; Define the two ordinary functions STANDARD-INSTANCE-ACCESS and
   ;; (SETF STANDARD-INSTANCE-ACCESS) according to the specification.
   ;; They take an instance and a location in the form of an integer,
   ;; and return (or set) the contents of the cell in the contents
   ;; vector with the given location.
   (:file "standard-instance-access")
   ;; Define ordinary functions that implement default behavior of
   ;; SLOT-VALUE-USING-CLASS and others in the same family.
   (:file "slot-value-etc-support")
   ;; Define SLOT-VALUE-USING-CLASS and others in the same family as
   ;; ordinary functions.  They work if the class of the object is
   ;; either STANDARD-CLASS or FUNCALLABLE-STANDARD-CLASS.
   (:file "slot-value-etc-defuns")
   ;; During phase 2, SLOT-VALUE and (SETF SLOT-VALUE) were defined to
   ;; always call ERROR, but they were defined so as to avoid compiler
   ;; warnings when accessor methods referred to them.  Now, we
   ;; undefine them, in order to avoid a compiler warning in the next
   ;; step.
   (:file "fmakunbound-slot-value")
   ;; Define specified functions in the SLOT-VALUE family. 
   (:file "slot-value-etc-specified-defuns")
   ;; Define ordinary functions implementing standard actions for
   ;; INITIALIZE-INSTANCE, REINITIALIZE-INSTANCE, and
   ;; SHARED-INITIALIZE.
   (:file "initialize-support")
   ;; Define generic functions INITIALIZE-INSTANCE,
   ;; REINITIALIZE-INSTANCE, and SHARED-INITIALIZE.  They will be
   ;; created as bridge generic functions and added to the list in
   ;; *BRIDGE-GENERIC-FUNCTIONS*, because DEFGENERIC still works that
   ;; way.
   (:file "initialize-instance-defgenerics")
   (:file "reinitialize-instance-defgenerics")
   (:file "shared-initialize-defgenerics")
   ;; Define default primary methods on the generic functions
   ;; INITIALIZE-INSTANCE, REINITIALIZE-INSTANCE, and
   ;; SHARED-INITIALIZE.  These methods are specialized to
   ;; STANDARD-OBJECT.
   (:file "initialize-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE and
   ;; REINITIALIZE-INSTANCE specialized to STANDARD-GENERIC-FUNCTION
   ;; that call the default action already defined during phase 2.
   (:file "generic-function-initialization-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE specialized to
   ;; STANDARD-CLASS, FUNCALLABLE-STANDARD-CLASS, and BUILT-IN-CLASS
   ;; that call the default action already defined during phase 2.
   (:file "class-initialization-defmethods")
   ;; Define :AFTER methods on INITIALIZE-INSTANCE specialized to
   ;; METHOD and STANDARD-ACCESSOR-METHOD that call the default action
   ;; already defined during phase 2.
   (:file "method-initialization-defmethods")
   ;; Define functions, generic functions and methods for
{'fraction_non_alphanumeric': 0.08680240705630203, 'fraction_numerical': 0.0020608358750309123, 'mean_word_length': 3.8586303564277133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5989362', 'n_tokens_mistral': 3472, 'n_tokens_neox': 3209, 'n_words': 1508}