Changeset 12863


Ignore:
Timestamp:
08/05/10 20:58:38 (11 years ago)
Author:
ehuelsmann
Message:

Implement CONSTANT-VALUE-ATTRIBUTE, CHECKED-EXCEPTIONS-ATTRIBUTE,
DEPRECATED-ATTRIBUTE and SYNTHETIC-ATTRIBUTE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

    r12862 r12863  
    985985
    986986
     987(defstruct (constant-value-attribute (:conc-name constant-value-)
     988                                     (:include attribute
     989                                               (name "ConstantValue")
     990                                               ;; finalizer
     991                                               ;; writer
     992                                               ))
     993  "An attribute of a field of primitive type.
     994
     995"
     996 
     997  )
     998
     999
     1000(defstruct (checked-exceptions-attribute
     1001             (:conc-name checked-)
     1002             (:include attribute
     1003                       (name "Exceptions")
     1004                       (finalizer #'finalize-checked-exceptions)
     1005                       (writer #'write-checked-exceptions)))
     1006  "An attribute of `code-attribute', "
     1007  table ;; a list of checked classes corresponding to Java's 'throws'
     1008)
     1009
     1010(defun finalize-checked-exceptions (checked-exceptions code class)
     1011  (declare (ignorable code class))
     1012
     1013  "Prepare `checked-exceptions' for serialization."
     1014  (setf (checked-table checked-exceptions)
     1015        (mapcar #'(lambda (exception)
     1016                    (pool-add-class (class-file-constants class)
     1017                                    exception))
     1018                (checked-table checked-exceptions))))
     1019
     1020(defun write-checked-exceptions (checked-exceptions stream)
     1021  "Write `checked-exceptions' to `stream' in class file representation."
     1022  (write-u2 (length (checked-table checked-exceptions)) stream)
     1023  (dolist (exception (reverse (checked-table checked-exceptions)))
     1024    (write-u2 exception stream)))
     1025
     1026;; Can't be used yet: serialization missing
     1027(defstruct (deprecated-attribute (:include attribute
     1028                                           (name "Deprecated")
     1029                                           (finalizer (constantly nil))
     1030                                           (writer (constantly nil))))
     1031  ;; finalizer and writer need to do nothing: Deprecated attributes are empty
     1032  "An attribute of a class file, field or method, indicating the element
     1033to which it has been attached has been superseded.")
     1034
    9871035(defvar *current-code-attribute* nil)
    9881036
     
    10411089
    10421090
     1091(defstruct (synthetic-attribute (:include attribute
     1092                                          (name "Synthetic")
     1093                                          (finalizer (constantly nil))
     1094                                          (writer (constantly nil))))
     1095  ;; finalizer and writer need to do nothing: Synthetic attributes are empty
     1096  "An attribute of a class file, field or method to mark that it wasn't
     1097included in the sources - but was generated artificially.")
     1098
    10431099
    10441100(defstruct (line-numbers-attribute
Note: See TracChangeset for help on using the changeset viewer.