home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / sf / usicon.scm < prev    next >
Text File  |  1999-01-02  |  2KB  |  74 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: usicon.scm,v 4.4 1999/01/02 06:06:43 cph Exp $
  4.  
  5. Copyright (c) 1987-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. |#
  21.  
  22. ;;;; SCode Optimizer: Usual Integrations: Constants
  23. ;;; package: (scode-optimizer)
  24.  
  25. (declare (usual-integrations)
  26.      (integrate-external "object"))
  27.  
  28. (define usual-integrations/constant-names)
  29. (define usual-integrations/constant-values)
  30. (define usual-integrations/constant-alist)
  31.  
  32. (define (usual-integrations/delete-constant! name)
  33.   (set! global-constant-objects (delq! name global-constant-objects))
  34.   (usual-integrations/cache!))
  35.  
  36. (define (usual-integrations/cache!)
  37.   (set! usual-integrations/constant-names
  38.     (list-copy global-constant-objects))
  39.   (set! usual-integrations/constant-values
  40.     (map (lambda (name)
  41.            (let ((object
  42.               (lexical-reference system-global-environment name)))
  43.          (if (not (memq (microcode-type/code->name
  44.                  (object-type object))
  45.                 '(BIGNUM
  46.                   CHARACTER
  47.                   FIXNUM
  48.                   FLONUM
  49.                   INTERNED-SYMBOL
  50.                   NULL
  51.                   PAIR
  52.                   PRIMITIVE
  53.                   QUAD
  54.                   RATNUM
  55.                   RECNUM
  56.                   RETURN-CODE
  57.                   STRING
  58.                   TRIPLE
  59.                   TRUE
  60.                   UNINTERNED-SYMBOL
  61.                   VECTOR
  62.                   VECTOR-16B
  63.                   VECTOR-1B)))
  64.              (error "USUAL-INTEGRATIONS: not a constant" name))
  65.          (constant->integration-info object)))
  66.          usual-integrations/constant-names))
  67.   (set! usual-integrations/constant-alist
  68.     (map (lambda (name)
  69.            (cons name
  70.              (constant/make
  71.               false
  72.               (lexical-reference system-global-environment name))))
  73.          usual-integrations/constant-names))
  74.   'DONE)