Cface__CStructNode.st
changeset 5 c110eef5b9ef
parent 4 fc74bd43a3eb
child 9 03c7a764d2be
equal deleted inserted replaced
4:fc74bd43a3eb 5:c110eef5b9ef
     1 "{ Package: 'cvut:fel/cface' }"
     1 "{ Package: 'cvut:fel/cface' }"
     2 
     2 
     3 "{ NameSpace: Cface }"
     3 "{ NameSpace: Cface }"
     4 
     4 
     5 CDerivedTypeNode subclass:#CStructNode
     5 CStructuredNode subclass:#CStructNode
     6 	instanceVariableNames:'fields local typedef'
     6 	instanceVariableNames:''
     7 	classVariableNames:''
     7 	classVariableNames:''
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'Cface-C AST'
     9 	category:'Cface-C AST'
    10 !
    10 !
    11 
    11 
    44     "Created: #buildTypeDescriptionOn: / 20-12-2007 / 12:14:53 / haja"
    44     "Created: #buildTypeDescriptionOn: / 20-12-2007 / 12:14:53 / haja"
    45 ! !
    45 ! !
    46 
    46 
    47 !CStructNode methodsFor:'accessing'!
    47 !CStructNode methodsFor:'accessing'!
    48 
    48 
       
    49 cByteSize
       
    50 
       
    51     ^fields 
       
    52         inject:0 
       
    53         into:[:size :field|size + field type cByteSize]
       
    54 
       
    55     "Created: / 09-07-2008 / 19:40:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
    56 !
       
    57 
    49 ffiTypeSymbol
    58 ffiTypeSymbol
    50     "Superclass Cface::CTypeNode says that I am responsible to implement this method"
    59     "Superclass Cface::CTypeNode says that I am responsible to implement this method"
    51     
    60     
    52     ^ #struct
    61     ^ #struct
    53 
    62 
    54     "Created: / 03-07-2008 / 22:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
    63     "Created: / 03-07-2008 / 22:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
    55 !
       
    56 
       
    57 fields
       
    58     ^ fields
       
    59 
       
    60     "Created: / 25-10-2007 / 17:13:34 / haja"
       
    61 !
       
    62 
       
    63 fields:something
       
    64     fields := something.
       
    65 
       
    66     "Created: / 25-10-2007 / 17:13:34 / haja"
       
    67 !
       
    68 
       
    69 local
       
    70     ^ local
       
    71 
       
    72     "Created: / 15-11-2007 / 14:50:46 / haja"
       
    73 !
       
    74 
       
    75 local:something
       
    76     local := something.
       
    77 
       
    78     "Created: / 15-11-2007 / 14:50:46 / haja"
       
    79 !
       
    80 
       
    81 typedef
       
    82     ^ typedef
       
    83 
       
    84     "Created: / 05-12-2007 / 21:01:16 / haja"
       
    85 !
       
    86 
       
    87 typedef:something
       
    88     typedef := something.
       
    89 
       
    90     "Created: / 05-12-2007 / 21:01:16 / haja"
       
    91 ! !
       
    92 
       
    93 !CStructNode methodsFor:'builder'!
       
    94 
       
    95 buildTypeDescriptionOn:aBuilder
       
    96 
       
    97    aBuilder buildStructNode:name with:fields.
       
    98 
       
    99     "Created: / 20-12-2007 / 12:14:53 / haja"
       
   100 ! !
    64 ! !
   101 
    65 
   102 !CStructNode methodsFor:'testing'!
    66 !CStructNode methodsFor:'testing'!
   103 
    67 
   104 isCStructNode
    68 isCStructNode