1
|
1 |
"{ Package: 'cvut:fel/cface' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Cface }"
|
|
4 |
|
|
5 |
CNodeVisitor subclass:#TypeMapper
|
|
6 |
instanceVariableNames:'mappings'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Cface-Visitors'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!TypeMapper class methodsFor:'processing'!
|
|
14 |
|
|
15 |
process: cNode
|
|
16 |
|
|
17 |
self error:'Use #process:using: instead'
|
|
18 |
|
|
19 |
"Created: / 17-02-2008 / 20:56:59 / janfrog"
|
|
20 |
!
|
|
21 |
|
|
22 |
process: cNode using: mappings
|
|
23 |
|
|
24 |
self new mappings: mappings process: cNode
|
|
25 |
|
|
26 |
"Created: / 17-02-2008 / 20:57:22 / janfrog"
|
|
27 |
"Modified: / 18-02-2008 / 15:32:31 / janfrog"
|
|
28 |
! !
|
|
29 |
|
|
30 |
!TypeMapper methodsFor:'accessing'!
|
|
31 |
|
|
32 |
mappings
|
|
33 |
^ mappings
|
|
34 |
|
|
35 |
"Created: / 17-02-2008 / 20:58:30 / janfrog"
|
|
36 |
!
|
|
37 |
|
|
38 |
mappings:something
|
|
39 |
mappings := something.
|
|
40 |
|
|
41 |
"Created: / 17-02-2008 / 20:58:30 / janfrog"
|
|
42 |
! !
|
|
43 |
|
|
44 |
!TypeMapper methodsFor:'processing'!
|
|
45 |
|
|
46 |
process: definitions
|
|
47 |
|
|
48 |
mappings ifNil:[^self error:'No mappings provided!!'].
|
|
49 |
super process: definitions
|
|
50 |
|
|
51 |
"Created: / 18-02-2008 / 15:33:19 / janfrog"
|
|
52 |
!
|
|
53 |
|
|
54 |
process: definitions using: givenMappings
|
|
55 |
|
|
56 |
self mappings: givenMappings.
|
|
57 |
self process: definitions
|
|
58 |
|
|
59 |
"Created: / 18-02-2008 / 15:34:07 / janfrog"
|
|
60 |
! !
|
|
61 |
|
|
62 |
!TypeMapper methodsFor:'visiting'!
|
|
63 |
|
|
64 |
visitCEnumNode: cEnum
|
|
65 |
|
|
66 |
cEnum isAnonymous ifFalse:
|
|
67 |
[cEnum
|
|
68 |
smalltalkNamespace: mappings smalltalkNamespace;
|
|
69 |
smalltalkClass: (mappings smalltalkClassForEnum: cEnum)].
|
|
70 |
super visitCEnumNode: cEnum
|
|
71 |
|
|
72 |
"Created: / 17-02-2008 / 20:58:53 / janfrog"
|
|
73 |
"Modified: / 17-02-2008 / 22:24:58 / janfrog"
|
|
74 |
!
|
|
75 |
|
|
76 |
visitCEnumValueNode: cEnum
|
|
77 |
|
|
78 |
cEnum
|
|
79 |
smalltalkNamespace: mappings smalltalkNamespace;
|
|
80 |
smalltalkClass: (mappings smalltalkClassForEnumValue: cEnum).
|
|
81 |
super visitCEnumValueNode: cEnum
|
|
82 |
|
|
83 |
"Created: / 17-02-2008 / 21:02:21 / janfrog"
|
|
84 |
!
|
|
85 |
|
|
86 |
visitCFunctionNode: cFunction
|
|
87 |
|
|
88 |
cFunction
|
|
89 |
smalltalkNamespace: mappings smalltalkNamespace;
|
|
90 |
smalltalkClass: (mappings smalltalkClassForFunction: cFunction);
|
|
91 |
smalltalkSelector: (mappings smalltalkSelectorForFunction: cFunction).
|
|
92 |
super visitCFunctionNode: cFunction
|
|
93 |
|
|
94 |
"Created: / 17-02-2008 / 22:10:44 / janfrog"
|
|
95 |
!
|
|
96 |
|
|
97 |
visitCStructFieldNode: cEnum
|
|
98 |
|
|
99 |
cEnum
|
|
100 |
smalltalkName: (mappings smalltalkNameForStructField: cEnum).
|
|
101 |
super visitCStructFieldNode: cEnum
|
|
102 |
|
|
103 |
"Created: / 17-02-2008 / 21:22:53 / janfrog"
|
|
104 |
!
|
|
105 |
|
|
106 |
visitCStructNode: cStruct
|
|
107 |
|
|
108 |
cStruct isAnonymous ifFalse:
|
|
109 |
[cStruct
|
|
110 |
smalltalkNamespace: mappings smalltalkNamespace;
|
|
111 |
smalltalkClass: (mappings smalltalkClassForStruct: cStruct)].
|
|
112 |
super visitCStructNode: cStruct
|
|
113 |
|
|
114 |
"Created: / 17-02-2008 / 21:12:55 / janfrog"
|
|
115 |
"Modified: / 17-02-2008 / 22:24:51 / janfrog"
|
|
116 |
!
|
|
117 |
|
|
118 |
visitCUnionNode: cUnion
|
|
119 |
|
|
120 |
cUnion isAnonymous ifFalse:
|
|
121 |
[cUnion
|
|
122 |
smalltalkNamespace: mappings smalltalkNamespace;
|
|
123 |
smalltalkClass: (mappings smalltalkClassForStruct: cUnion)].
|
|
124 |
super visitCUnionNode: cUnion
|
|
125 |
|
|
126 |
"Created: / 17-02-2008 / 22:25:27 / janfrog"
|
|
127 |
! !
|
|
128 |
|
|
129 |
!TypeMapper class methodsFor:'documentation'!
|
|
130 |
|
|
131 |
version
|
|
132 |
^ '$Header: /opt/data/cvs/cvut-fel/cface/Cface__TypeMapper.st,v 1.1 2008/02/26 15:58:36 vranyj1 Exp $'
|
|
133 |
! !
|