home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / clisp / src / archive / clisp.faslsp.lha / vcode.lsp < prev   
Lisp/Scheme  |  1996-04-15  |  1KB  |  38 lines

  1. (defun const-string-list (const-list)
  2.   (mapcar #'(lambda (x) (sys::write-to-short-string x 35)) const-list))
  3.  
  4. (defun vcode (closure)
  5.   (multiple-value-bind (req-cnt 
  6.                         opt-cnt
  7.                         rest-p
  8.                         key-p
  9.                         keyword-list
  10.                         allow-other-keys-p
  11.                         byte-list
  12.                         const-list)
  13.       (sys::signature closure)
  14.     (let ((instructions (sys::disassemble-LAP byte-list const-list)))
  15.       (loop for instr in instructions 
  16.             collect
  17.             (let ((instr-list (cdr instr)))
  18.               (multiple-value-bind (type value index)
  19.                   (sys::comment-values instr-list nil)
  20.                 (if value
  21.                     (let ((new-instr-list (copy-list instr-list)))
  22.                       (setf (nth index new-instr-list) value)
  23.                       new-instr-list)
  24.                     instr-list)))))))
  25.  
  26. (defun vcode-numeric (closure)
  27.   (let ((instr-list (vcode closure)))
  28.     (coerce 
  29.      (loop for instr in instr-list
  30.            collect 
  31.            (if (consp instr)
  32.                (cons (gethash (car instr) sys::instruction-codes)
  33.                      (cdr instr))
  34.                instr))
  35.      'vector)))
  36.  
  37. (defun test (cnt)
  38.   (loop for i from 0 below cnt collect i))