Changeset 12770


Ignore:
Timestamp:
06/27/10 20:28:51 (13 years ago)
Author:
ehuelsmann
Message:

Field/method finalization and writing.

File:
1 edited

Legend:

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

    r12769 r12770  
    373373  (%make-field :access-flags flags
    374374               :name name
    375                :descriptor (map-primitive-type type)))
     375               :descriptor type))
    376376
    377377(defun add-field-attribute (field attribute)
     
    380380
    381381(defun finalize-field (field class)
    382   (declare (ignore class field))
    383   (error "Not implemented"))
     382  (let ((pool (class-file-constants class)))
     383    (setf (field-access-flags field)
     384          (map-flags (field-access-flags field))
     385          (field-descriptor field)
     386          (pool-add-utf8 pool (internal-field-type (field-descriptor field)))
     387          (field-name field)
     388          (pool-add-utf8 pool (field-name field))))
     389  (finalize-attributes (field-attributes field) nil class))
    384390
    385391(defun !write-field (field stream)
    386   (declare (ignore field stream))
    387   (error "Not implemented"))
     392  (write-u2 (field-access-flags field) stream)
     393  (write-u2 (field-name field) stream)
     394  (write-u2 (field-descriptor field) stream)
     395  (write-attributes (field-attributes field) stream))
    388396
    389397
     
    430438
    431439(defun finalize-method (method class)
    432   (setf (method-access-flags method)
    433         (map-flags (method-access-flags method))
    434         (method-descriptor method)
    435         (pool-add-utf8 (apply #'descriptor (method-descriptor method)))
    436         (method-name method)
    437         (pool-add-utf8 (map-method-name (method-name method))))
    438   (finalize-attributes attributes nil class))
     440  (let ((pool (class-file-constants class)))
     441    (setf (method-access-flags method)
     442          (map-flags (method-access-flags method))
     443          (method-descriptor method)
     444          (pool-add-utf8 pool (apply #'descriptor (method-descriptor method)))
     445          (method-name method)
     446          (pool-add-utf8 pool (map-method-name (method-name method)))))
     447  (finalize-attributes (method-attributes method) nil class))
    439448
    440449
    441450(defun !write-method (method stream)
    442   (declare (ignore method stream))
    443   (error "Not implemented"))
     451  (write-u2 (method-access-flags method) stream)
     452  (write-u2 (method-name method) stream)
     453  (write-u2 (method-descriptor method) stream)
     454  (write-attributes (method-attributes method) stream))
    444455
    445456(defstruct attribute
Note: See TracChangeset for help on using the changeset viewer.