~ubuntu-branches/ubuntu/intrepid/mit-scheme/intrepid-updates

« back to all changes in this revision

Viewing changes to src/sf/chtype.scm

  • Committer: Bazaar Package Importer
  • Author(s): Chris Hanson
  • Date: 2002-03-14 17:04:07 UTC
  • Revision ID: james.westby@ubuntu.com-20020314170407-m5lg1d6bdsl9lv0s
Tags: upstream-7.7.0
ImportĀ upstreamĀ versionĀ 7.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#| -*-Scheme-*-
 
2
 
 
3
$Id: chtype.scm,v 4.4 2001/12/20 16:28:23 cph Exp $
 
4
 
 
5
Copyright (c) 1988, 1993, 1999, 2001 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., 59 Temple Place - Suite 330, Boston, MA
 
20
02111-1307, USA.
 
21
|#
 
22
 
 
23
;;;; SCode Optimizer: Intern object types
 
24
 
 
25
(declare (usual-integrations)
 
26
         (integrate-external "object"))
 
27
 
 
28
(define (change-type/block block)
 
29
  (change-type/object enumeration/random block)
 
30
  (block/for-each-bound-variable block
 
31
    (lambda (variable)
 
32
      (change-type/object enumeration/random variable)))
 
33
  (for-each change-type/block (block/children block)))
 
34
 
 
35
(define (change-type/expressions expressions)
 
36
  (for-each change-type/expression expressions))
 
37
 
 
38
(declare (integrate-operator change-type/expression))
 
39
 
 
40
(define (change-type/expression expression)
 
41
  (change-type/object enumeration/expression expression)
 
42
  ((expression/method dispatch-vector expression) expression))
 
43
 
 
44
(define dispatch-vector
 
45
  (expression/make-dispatch-vector))
 
46
 
 
47
(define define-method/change-type
 
48
  (expression/make-method-definer dispatch-vector))
 
49
 
 
50
(declare (integrate-operator change-type/object))
 
51
 
 
52
(define (change-type/object enumeration object)
 
53
  (set-object/enumerand!
 
54
   object
 
55
   (enumeration/name->enumerand enumeration
 
56
                                (enumerand/name (object/enumerand object)))))
 
57
 
 
58
(define-method/change-type 'ACCESS
 
59
  (lambda (expression)
 
60
    (change-type/expression (access/environment expression))))
 
61
 
 
62
(define-method/change-type 'ASSIGNMENT
 
63
  (lambda (expression)
 
64
    (change-type/expression (assignment/value expression))))
 
65
 
 
66
(define-method/change-type 'COMBINATION
 
67
  (lambda (expression)
 
68
    (change-type/expression (combination/operator expression))
 
69
    (change-type/expressions (combination/operands expression))))
 
70
 
 
71
(define-method/change-type 'CONDITIONAL
 
72
  (lambda (expression)
 
73
    (change-type/expression (conditional/predicate expression))
 
74
    (change-type/expression (conditional/consequent expression))
 
75
    (change-type/expression (conditional/alternative expression))))
 
76
 
 
77
(define-method/change-type 'CONSTANT
 
78
  (lambda (expression)
 
79
    expression ; ignored
 
80
    'DONE))
 
81
 
 
82
(define-method/change-type 'DECLARATION
 
83
  (lambda (expression)
 
84
    (change-type/expression (declaration/expression expression))))
 
85
 
 
86
(define-method/change-type 'DELAY
 
87
  (lambda (expression)
 
88
    (change-type/expression (delay/expression expression))))
 
89
 
 
90
(define-method/change-type 'DISJUNCTION
 
91
  (lambda (expression)
 
92
    (change-type/expression (disjunction/predicate expression))
 
93
    (change-type/expression (disjunction/alternative expression))))
 
94
 
 
95
(define-method/change-type 'PROCEDURE
 
96
  (lambda (expression)
 
97
    (change-type/expression (procedure/body expression))))
 
98
 
 
99
(define-method/change-type 'OPEN-BLOCK
 
100
  (lambda (expression)
 
101
    (change-type/expressions (open-block/values expression))
 
102
    (change-type/open-block-actions (open-block/actions expression))))
 
103
 
 
104
(define (change-type/open-block-actions actions)
 
105
  (cond ((null? actions) 'DONE)
 
106
        ((eq? (car actions) open-block/value-marker)
 
107
         (change-type/open-block-actions (cdr actions)))
 
108
        (else (change-type/expression (car actions))
 
109
              (change-type/open-block-actions (cdr actions)))))
 
110
 
 
111
(define-method/change-type 'QUOTATION
 
112
  (lambda (expression)
 
113
    (change-type/quotation expression)))
 
114
 
 
115
(define (change-type/quotation quotation)
 
116
  (change-type/expression (quotation/expression quotation)))
 
117
 
 
118
(define-method/change-type 'REFERENCE
 
119
  (lambda (expression)
 
120
    expression ; ignored
 
121
    'DONE))
 
122
 
 
123
(define-method/change-type 'SEQUENCE
 
124
  (lambda (expression)
 
125
    (change-type/expressions (sequence/actions expression))))
 
126
 
 
127
(define-method/change-type 'THE-ENVIRONMENT
 
128
  (lambda (expression)
 
129
    expression ; ignored
 
130
    'DONE))
 
 
b'\\ No newline at end of file'