Mercurial > hg > Papers > 2012 > aplas
comparison paper/rectype.ind @ 17:02bd9a41010f
modify How to implement rectype syntax
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 15 Jun 2012 02:50:28 +0900 |
parents | b5bef0479ef5 |
children | 33b7a54edaa9 |
comparison
equal
deleted
inserted
replaced
16:b5bef0479ef5 | 17:02bd9a41010f |
---|---|
219 *p represent pointer of csA at \ref{code:rectype} . | 219 *p represent pointer of csA at \ref{code:rectype} . |
220 p's argument type is same csA that function pointer. | 220 p's argument type is same csA that function pointer. |
221 | 221 |
222 | 222 |
223 --How to implement \rectype | 223 --How to implement \rectype |
224 \rectype syntx is implemented overwriting AST. | 224 \rectype syntx is implemented overriding AST. |
225 First, \rectype syntax make Tree same \code(\ref{fig:tree1}). | 225 First, \rectype syntax make Tree same \code(\ref{fig:tree1}). |
226 Second, Tree was created to be rectype flag. | 226 Second, Tree was created to be rectype flag. |
227 Thrid, To overwrite AST(\ref{fig:tree2}). | 227 Thrid, To override AST(\ref{fig:tree2}). |
228 | 228 |
229 \begin{figure}[htpb] | 229 \begin{figure}[htpb] |
230 \begin{minipage}{0.5\hsize} | 230 \begin{minipage}{0.5\hsize} |
231 \begin{center} | 231 \begin{center} |
232 \scalebox{0.35}{\includegraphics{figure/tree1.pdf}} | 232 \scalebox{0.35}{\includegraphics{figure/tree1.pdf}} |
241 \caption{AST of \rectype} | 241 \caption{AST of \rectype} |
242 \label{fig:tree2} | 242 \label{fig:tree2} |
243 \end{minipage} | 243 \end{minipage} |
244 \end{figure} | 244 \end{figure} |
245 | 245 |
246 | 246 Above AST(\ref{fig:tree2}) is made by syntax of \verb+__code csA(__rectype *p)+ . |
247 | 247 TREE_LIST have infomation of argument. |
248 | 248 First TREE_LIST represent that argument is function pointer(\verb+__code (*p)()+) . |
249 | 249 Second TREE_LIST represent that csA is Fixed-length argument. |
250 It is the same as the following. | 250 First TREE_LIST is connected with POINTER_TYPE. |
251 | 251 POINTER_TYPE have pointer of function(FUNCTION_TYPE). |
252 void csA( void (*p)(void*)) { | 252 We have to override it in the pointer of csA. |
253 p(csB); | 253 |
254 } | |
255 | 254 |
256 --Method other than \rectype | 255 --Method other than \rectype |
257 | 256 |
258 struct interface { | 257 struct interface { |
259 __code (*next)(struct interface); | 258 __code (*next)(struct interface); |