author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 04 Jul 2008 12:05:15 +0000 | |
changeset 4 | fc74bd43a3eb |
parent 3 | 110a9cbf8594 |
child 5 | c110eef5b9ef |
permissions | -rw-r--r-- |
1 | 1 |
"{ Package: 'cvut:fel/cface' }" |
2 |
||
3 |
"{ NameSpace: Cface }" |
|
4 |
||
5 |
CTypeNode subclass:#CPointerNode |
|
6 |
instanceVariableNames:'type' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Cface-C AST' |
|
10 |
! |
|
11 |
||
12 |
!CPointerNode class methodsFor:'documentation'! |
|
13 |
||
14 |
history |
|
15 |
||
16 |
"Created: / 25-10-2007 / 16:58:14 / haja" |
|
17 |
"Created: #id / 25-10-2007 / 16:58:17 / haja" |
|
18 |
"Created: #id: / 25-10-2007 / 16:58:44 / haja" |
|
19 |
"Created: #acceptVisitor: / 02-11-2007 / 10:44:49 / haja" |
|
20 |
"Created: #acceptVisitorName: / 05-11-2007 / 17:30:59 / haja" |
|
21 |
"Created: #acceptNameVisitor: / 05-11-2007 / 17:32:41 / haja" |
|
22 |
"Deleted: #acceptVisitorName: / 05-11-2007 / 17:32:44 / haja" |
|
23 |
"Deleted: #acceptNameVisitor: / 12-11-2007 / 09:47:00 / haja" |
|
24 |
"Created: #buildTypeCheckFor:on: / 19-12-2007 / 15:06:43 / haja" |
|
25 |
"Created: #buildObjectCreationOn: / 19-12-2007 / 16:21:13 / haja" |
|
26 |
"Created: #buildValueExtractionFor:on: / 19-12-2007 / 17:08:44 / haja" |
|
27 |
"Created: #buildObjectCreationFor:on: / 19-12-2007 / 17:44:34 / haja" |
|
28 |
"Deleted: #buildObjectCreationOn: / 19-12-2007 / 17:44:36 / haja" |
|
29 |
"Created: #buildCTypeOn: / 19-12-2007 / 18:18:04 / haja" |
|
30 |
"Created: #buildTypeDEscriptionOn: / 20-12-2007 / 12:06:45 / haja" |
|
31 |
"Created: #buildTypeDescriptionOn: / 20-12-2007 / 12:06:49 / haja" |
|
32 |
"Deleted: #buildTypeDEscriptionOn: / 20-12-2007 / 12:06:51 / haja" |
|
33 |
! ! |
|
34 |
||
35 |
!CPointerNode class methodsFor:'instance creation'! |
|
36 |
||
37 |
id:anId |
|
38 |
||
39 |
| defPointerNode | |
|
40 |
||
41 |
defPointerNode := self new. |
|
42 |
defPointerNode id:anId. |
|
43 |
||
44 |
^defPointerNode |
|
45 |
||
46 |
"Created: / 25-10-2007 / 16:58:44 / haja" |
|
47 |
! ! |
|
48 |
||
49 |
!CPointerNode methodsFor:'accessing'! |
|
50 |
||
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
51 |
ffiTypeSymbol |
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
52 |
"Superclass Cface::CTypeNode says that I am responsible to implement this method" |
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
53 |
|
3
110a9cbf8594
More improvements, now it generates usable Cairo bindings!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
54 |
(type isCCharNode) |
110a9cbf8594
More improvements, now it generates usable Cairo bindings!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
55 |
ifTrue:[^#charPointer]. |
4
fc74bd43a3eb
Minor parser fixes to parse Cairo Xlib stuff
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
56 |
((type isCStructNode) |
fc74bd43a3eb
Minor parser fixes to parse Cairo Xlib stuff
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
57 |
and:[type isAnonymous not |
fc74bd43a3eb
Minor parser fixes to parse Cairo Xlib stuff
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
58 |
and:[type isForeign not]]) |
fc74bd43a3eb
Minor parser fixes to parse Cairo Xlib stuff
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
59 |
ifTrue:[^type smalltalkClassNameWithNamespace]. |
3
110a9cbf8594
More improvements, now it generates usable Cairo bindings!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
60 |
|
110a9cbf8594
More improvements, now it generates usable Cairo bindings!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
61 |
^#pointer |
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
62 |
|
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
63 |
"Created: / 03-07-2008 / 22:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
4
fc74bd43a3eb
Minor parser fixes to parse Cairo Xlib stuff
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
64 |
"Modified: / 04-07-2008 / 11:43:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
2
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
65 |
! |
cfd2c393abfe
Smalltalk/X generator improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
66 |
|
1 | 67 |
type |
68 |
^ type |
|
69 |
||
70 |
"Created: / 10-02-2008 / 19:21:38 / janfrog" |
|
71 |
! |
|
72 |
||
73 |
type:something |
|
74 |
type := something. |
|
75 |
||
76 |
"Created: / 10-02-2008 / 19:21:38 / janfrog" |
|
77 |
! ! |
|
78 |
||
79 |
!CPointerNode methodsFor:'builder'! |
|
80 |
||
81 |
buildCTypeOn:aBuilder |
|
82 |
||
83 |
aBuilder pointerTo:[ |
|
84 |
id buildCTypeOn:aBuilder. |
|
85 |
]. |
|
86 |
||
87 |
"Modified: / 19-12-2007 / 18:19:01 / haja" |
|
88 |
! |
|
89 |
||
90 |
buildObjectCreationFor:aVariable on:aBuilder |
|
91 |
||
92 |
(id references:IdNode) ifTrue:[ |
|
93 |
(id names last = 'char') ifTrue:[ |
|
94 |
^aBuilder buildStringCreationFor:aVariable. |
|
95 |
]. |
|
96 |
]. |
|
97 |
||
98 |
(id references:CConstNode) ifTrue:[ |
|
99 |
(id id references:IdNode) ifTrue:[ |
|
100 |
(id id names last = 'char') ifTrue:[ |
|
101 |
^aBuilder buildStringCreationFor:aVariable. |
|
102 |
]. |
|
103 |
]. |
|
104 |
]. |
|
105 |
||
106 |
^aBuilder buildPointerCreationFor:aVariable. |
|
107 |
||
108 |
"Created: / 19-12-2007 / 17:44:34 / haja" |
|
109 |
"Modified: / 10-02-2008 / 10:48:44 / janfrog" |
|
110 |
! |
|
111 |
||
112 |
buildTypeCheckFor:aVariable on:aBuilder |
|
113 |
||
114 |
(id references:IdNode) ifTrue:[ |
|
115 |
(id names last = 'char') ifTrue:[ |
|
116 |
^aBuilder buildStringCheckFor:aVariable. |
|
117 |
]. |
|
118 |
]. |
|
119 |
||
120 |
(id references:CConstNode) ifTrue:[ |
|
121 |
(id id references:IdNode) ifTrue:[ |
|
122 |
(id id names last = 'char') ifTrue:[ |
|
123 |
^aBuilder buildStringCheckFor:aVariable. |
|
124 |
]. |
|
125 |
]. |
|
126 |
]. |
|
127 |
||
128 |
^aBuilder buildPointerCheckFor:aVariable. |
|
129 |
||
130 |
"Created: / 19-12-2007 / 15:06:43 / haja" |
|
131 |
"Modified: / 10-02-2008 / 10:50:26 / janfrog" |
|
132 |
! |
|
133 |
||
134 |
buildTypeDescriptionOn:aBuilder |
|
135 |
||
136 |
aBuilder buildPointerTo:[ |
|
137 |
id buildTypeDescriptionOn:aBuilder. |
|
138 |
]. |
|
139 |
||
140 |
"Created: / 20-12-2007 / 12:06:49 / haja" |
|
141 |
! |
|
142 |
||
143 |
buildValueExtractionFor:aVariable on:aBuilder |
|
144 |
||
145 |
(id references:IdNode) ifTrue:[ |
|
146 |
(id names last = 'char') ifTrue:[ |
|
147 |
^aBuilder buildStringValueExtractionFor:aVariable. |
|
148 |
]. |
|
149 |
]. |
|
150 |
||
151 |
(id references:CConstNode) ifTrue:[ |
|
152 |
(id id references:IdNode) ifTrue:[ |
|
153 |
(id id names last = 'char') ifTrue:[ |
|
154 |
^aBuilder buildStringValueExtractionFor:aVariable. |
|
155 |
]. |
|
156 |
]. |
|
157 |
]. |
|
158 |
||
159 |
^aBuilder buildPointerValueExtractionFor:aVariable. |
|
160 |
||
161 |
"Created: / 19-12-2007 / 17:08:44 / haja" |
|
162 |
"Modified: / 10-02-2008 / 10:50:31 / janfrog" |
|
163 |
! ! |
|
164 |
||
165 |
!CPointerNode methodsFor:'printing'! |
|
166 |
||
167 |
printOn: stream indent: indent |
|
168 |
||
169 |
stream |
|
170 |
nextPutAll:'(pointer-to '; |
|
171 |
cr; |
|
172 |
next: indent + 1 put: Character tab. |
|
173 |
||
174 |
type printOn: stream indent: indent + 1. |
|
175 |
stream nextPut:$) |
|
176 |
||
177 |
"Created: / 04-03-2008 / 10:57:12 / janfrog" |
|
178 |
"Modified: / 27-05-2008 / 12:15:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
179 |
! ! |
|
180 |
||
181 |
!CPointerNode methodsFor:'testing'! |
|
182 |
||
183 |
isCPointerNode |
|
184 |
^ true |
|
185 |
||
186 |
"Created: / 17-02-2008 / 21:52:45 / janfrog" |
|
187 |
! ! |
|
188 |
||
189 |
!CPointerNode methodsFor:'visiting'! |
|
190 |
||
191 |
acceptVisitor:aVisitor |
|
192 |
"Double dispatch back to the visitor, passing my type encoded in |
|
193 |
the selector (visitor pattern)" |
|
194 |
"stub code automatically generated - please change if required" |
|
195 |
||
196 |
^ aVisitor visitCPointerNode:self |
|
197 |
||
198 |
"Created: / 02-11-2007 / 10:44:49 / haja" |
|
199 |
"Modified: / 10-02-2008 / 10:45:24 / janfrog" |
|
200 |
! ! |
|
201 |
||
202 |
!CPointerNode class methodsFor:'documentation'! |
|
203 |
||
204 |
version |
|
205 |
^ '$Header: /opt/data/cvs/cvut-fel/cface/Cface__CPointerNode.st,v 1.1 2008/02/26 15:58:16 vranyj1 Exp $' |
|
206 |
! ! |