Cface__CUnionNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 10 Jul 2008 07:31:14 +0000
changeset 5 c110eef5b9ef
parent 4 fc74bd43a3eb
child 9 03c7a764d2be
permissions -rw-r--r--
- externalization of libraryName (now supports unix & win32 simultaneously) - basi support for accessing structure fields

"{ Package: 'cvut:fel/cface' }"

"{ NameSpace: Cface }"

CStructuredNode subclass:#CUnionNode
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-C AST'
!

!CUnionNode class methodsFor:'documentation'!

history

    "Created: / 25-10-2007 / 17:13:30 / haja"
    "Created: #name / 25-10-2007 / 17:13:34 / haja"
    "Created: #name: / 25-10-2007 / 17:13:34 / haja"
    "Created: #fields / 25-10-2007 / 17:13:34 / haja"
    "Created: #fields: / 25-10-2007 / 17:13:34 / haja"
    "Created: #local:name:fields: / 25-10-2007 / 17:58:55 / haja"
    "Created: #name:fields: / 29-10-2007 / 20:52:08 / haja"
    "Deleted: #local:name:fields: / 29-10-2007 / 20:52:11 / haja"
    "Created: #acceptVisitor: / 02-11-2007 / 10:46:48 / haja"
    "Deleted: #local / 05-11-2007 / 01:32:46 / haja"
    "Deleted: #local: / 05-11-2007 / 01:32:46 / haja"
    "Created: #local / 15-11-2007 / 14:50:56 / haja"
    "Created: #local: / 15-11-2007 / 14:50:56 / haja"
    "Created: #name:fields:local: / 15-11-2007 / 14:51:43 / haja"
    "Deleted: #name:fields: / 15-11-2007 / 14:51:44 / haja"
    "Created: #foreign / 19-11-2007 / 09:41:55 / haja"
    "Created: #foreign: / 19-11-2007 / 09:41:55 / haja"
    "Created: #name:fields:local:foreign: / 19-11-2007 / 09:42:04 / haja"
    "Deleted: #name:fields:local: / 19-11-2007 / 09:42:06 / haja"
    "Created: #typedef / 05-12-2007 / 21:02:04 / haja"
    "Created: #typedef: / 05-12-2007 / 21:02:04 / haja"
    "Created: #name:fields:local:foreign:typedef: / 05-12-2007 / 21:02:13 / haja"
    "Deleted: #name:fields:local:foreign: / 05-12-2007 / 21:02:15 / haja"
    "Created: #buildTypeDescriptionOn: / 20-12-2007 / 12:29:48 / haja"
! !

!CUnionNode class methodsFor:'instance creation'!

name:aStructName fields:aFieldCollection local:isLocal foreign:isForeign typedef:isTypedef

    | defStructNode |

    defStructNode := self new.
    defStructNode name:aStructName; fields:aFieldCollection; local:isLocal; foreign:isForeign; typedef:isTypedef.

    ^defStructNode

    "Created: / 05-12-2007 / 21:02:13 / haja"
! !

!CUnionNode methodsFor:'accessing'!

cByteSize

    ^fields 
        inject:0 
        into:[:size :field|size + field type cByteSize]

    "Created: / 09-07-2008 / 19:40:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

ffiTypeSymbol
    "Superclass Cface::CTypeNode says that I am responsible to implement this method"
    
    ^ #struct

    "Created: / 03-07-2008 / 22:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CUnionNode methodsFor:'testing'!

isCUnionNode
    ^ true

    "Created: / 17-02-2008 / 21:52:13 / janfrog"
! !

!CUnionNode methodsFor:'visiting'!

acceptVisitor:aVisitor 
    "Double dispatch back to the visitor, passing my type encoded in
     the selector (visitor pattern)"
    "stub code automatically generated - please change if required"
    
    ^ aVisitor visitCUnionNode:self

    "Created: / 02-11-2007 / 10:46:48 / haja"
    "Modified: / 10-02-2008 / 10:46:54 / janfrog"
! !

!CUnionNode class methodsFor:'documentation'!

version
    ^ '$Header: /opt/data/cvs/cvut-fel/cface/Cface__CUnionNode.st,v 1.1 2008/02/26 15:57:54 vranyj1 Exp $'
! !