author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 03 Jul 2008 22:00:07 +0000 | |
changeset 2 | cfd2c393abfe |
parent 1 | b6c0180314d1 |
child 4 | fc74bd43a3eb |
permissions | -rw-r--r-- |
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; |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
69 |
smalltalkPackage: (mappings smalltalkPackage); |
1 | 70 |
smalltalkClass: (mappings smalltalkClassForEnum: cEnum)]. |
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
71 |
|
1 | 72 |
super visitCEnumNode: cEnum |
73 |
||
74 |
"Created: / 17-02-2008 / 20:58:53 / janfrog" |
|
75 |
"Modified: / 17-02-2008 / 22:24:58 / janfrog" |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
76 |
"Modified: / 03-07-2008 / 21:16:08 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1 | 77 |
! |
78 |
||
79 |
visitCEnumValueNode: cEnum |
|
80 |
||
81 |
cEnum |
|
82 |
smalltalkNamespace: mappings smalltalkNamespace; |
|
83 |
smalltalkClass: (mappings smalltalkClassForEnumValue: cEnum). |
|
84 |
super visitCEnumValueNode: cEnum |
|
85 |
||
86 |
"Created: / 17-02-2008 / 21:02:21 / janfrog" |
|
87 |
! |
|
88 |
||
89 |
visitCFunctionNode: cFunction |
|
90 |
||
91 |
cFunction |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
92 |
kind: (mappings kindForFunction:cFunction); |
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
93 |
|
1 | 94 |
smalltalkNamespace: mappings smalltalkNamespace; |
95 |
smalltalkClass: (mappings smalltalkClassForFunction: cFunction); |
|
96 |
smalltalkSelector: (mappings smalltalkSelectorForFunction: cFunction). |
|
97 |
super visitCFunctionNode: cFunction |
|
98 |
||
99 |
"Created: / 17-02-2008 / 22:10:44 / janfrog" |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
100 |
"Modified: / 03-07-2008 / 22:10:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1 | 101 |
! |
102 |
||
103 |
visitCStructFieldNode: cEnum |
|
104 |
||
105 |
cEnum |
|
106 |
smalltalkName: (mappings smalltalkNameForStructField: cEnum). |
|
107 |
super visitCStructFieldNode: cEnum |
|
108 |
||
109 |
"Created: / 17-02-2008 / 21:22:53 / janfrog" |
|
110 |
! |
|
111 |
||
112 |
visitCStructNode: cStruct |
|
113 |
||
114 |
cStruct isAnonymous ifFalse: |
|
115 |
[cStruct |
|
116 |
smalltalkNamespace: mappings smalltalkNamespace; |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
117 |
smalltalkPackage: (mappings smalltalkPackage); |
1 | 118 |
smalltalkClass: (mappings smalltalkClassForStruct: cStruct)]. |
119 |
super visitCStructNode: cStruct |
|
120 |
||
121 |
"Created: / 17-02-2008 / 21:12:55 / janfrog" |
|
122 |
"Modified: / 17-02-2008 / 22:24:51 / janfrog" |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
123 |
"Modified: / 03-07-2008 / 21:43:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1 | 124 |
! |
125 |
||
126 |
visitCUnionNode: cUnion |
|
127 |
||
128 |
cUnion isAnonymous ifFalse: |
|
129 |
[cUnion |
|
130 |
smalltalkNamespace: mappings smalltalkNamespace; |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
131 |
smalltalkPackage: (mappings smalltalkPackage); |
1 | 132 |
smalltalkClass: (mappings smalltalkClassForStruct: cUnion)]. |
133 |
super visitCUnionNode: cUnion |
|
134 |
||
135 |
"Created: / 17-02-2008 / 22:25:27 / janfrog" |
|
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
136 |
"Modified: / 03-07-2008 / 21:16:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1 | 137 |
! ! |
138 |
||
139 |
!TypeMapper class methodsFor:'documentation'! |
|
140 |
||
141 |
version |
|
142 |
^ '$Header: /opt/data/cvs/cvut-fel/cface/Cface__TypeMapper.st,v 1.1 2008/02/26 15:58:36 vranyj1 Exp $' |
|
143 |
! ! |