Cface__CStructuredNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 12 Aug 2015 07:32:13 +0100
changeset 43 9327987437ae
parent 32 d7464405cbda
permissions -rw-r--r--
Added mappings for LLVM C and LLVM C Extensions These are used to generate C callouts for jv:llvm_s project.

"{ Package: 'jv:cface' }"

"{ NameSpace: Cface }"

CDerivedTypeNode subclass:#CStructuredNode
	instanceVariableNames:'cBitSize fields ffiPointerTypeSymbol'
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-C AST'
!


!CStructuredNode methodsFor:'accessing'!

cBitSize
    ^ cBitSize

    "Created: / 10-09-2012 / 10:02:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

cBitSize:anInteger
    cBitSize := anInteger

    "Created: / 10-09-2012 / 10:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

cByteSize
    ^ cBitSize // 8

    "Created: / 09-09-2008 / 16:49:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 10-09-2012 / 10:02:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

cByteSize:anInteger
    cBitSize := anInteger * 8

    "Created: / 09-09-2008 / 16:49:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 10-09-2012 / 10:02:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

ffiPointerTypeSymbol

    ffiPointerTypeSymbol notNil ifTrue:[
        ^ffiPointerTypeSymbol
    ].

    ^smalltalkName notNil ifTrue:[
        self smalltalkClassNameWithNamespace
    ] ifFalse:[
        #pointer
    ]

    "Created: / 18-07-2011 / 16:44:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

ffiPointerTypeSymbol:aSymbol
    ffiPointerTypeSymbol := aSymbol.
!

ffiTypeSymbol

    ^ self shouldNotImplement

    "Modified: / 18-07-2011 / 16:42:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

fields
    ^ fields

    "Created: / 10-07-2008 / 08:43:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

fields:aCollection
    fields := aCollection select:[:each|each notNil].
    fields do:[:f|f owner: self].

    "Created: / 10-07-2008 / 08:43:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 05-09-2012 / 11:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

stxStructFieldGetterSelector
    ^ #at:

    "Created: / 09-09-2008 / 21:32:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CStructuredNode methodsFor:'testing'!

isCStructuredNode
    ^ true
! !

!CStructuredNode 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 visitCStructuredNode:self
! !

!CStructuredNode class methodsFor:'documentation'!

version
    ^'$Id$'
!

version_SVN
    ^ '$Id$'
! !