Cface__CDerivedTypeNode.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 17 Sep 2015 07:36:40 +0100
changeset 49 307d55f736ec
parent 45 86de1611e013
permissions -rw-r--r--
LLVM bindings: allow to specify path to llvm-config ..by setting LLVM_CONFIG variable when generating definitions for LLVM bindings. Example: make LVM_CONFIG=~/Projects/LLVM/sources1/build/Debug+Asserts/bin/llvm-config

"{ Package: 'jv:cface' }"

"{ NameSpace: Cface }"

CTypeNode subclass:#CDerivedTypeNode
	instanceVariableNames:'smalltalkNamespace smalltalkPackage smalltalkCategory foreign'
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-C AST'
!


!CDerivedTypeNode methodsFor:'accessing'!

cByteSize
    "superclass Cface::CTypeNode says that I am responsible to implement this method"

    ^ self shouldImplement
!

ffiTypeSymbol
    "superclass Cface::CTypeNode says that I am responsible to implement this method"

    ^ self shouldImplement
!

foreign
    ^ foreign

    "Created: / 04-07-2008 / 11:46:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

foreign:something
    foreign := something.

    "Created: / 04-07-2008 / 11:46:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

smalltalkCategory
    ^ smalltalkCategory ifNil:
        [self smalltalkNamespace , ' - C Types']

    "Created: / 03-07-2008 / 21:10:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

smalltalkCategory:aString
    smalltalkCategory := aString.

    "Created: / 03-07-2008 / 21:10:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 10-07-2008 / 07:54:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

smalltalkClassName

    | nm |
    nm := self smalltalkName.
    ^nm notNil ifTrue:[nm asSymbol] ifFalse:[nil].

    "Created: / 10-07-2008 / 08:01:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 09-09-2008 / 20:15:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 18-07-2011 / 16:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

smalltalkClassName:className 
    self smalltalkName:className

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

smalltalkClassNameWithNamespace

    self smalltalkClassName isNil ifTrue:[^nil].

    ^ self smalltalkNamespace isEmptyOrNil 
        ifTrue:[ self smalltalkClassName asSymbol ]
        ifFalse:[ (self smalltalkNamespace , '::' , self smalltalkClassName) asSymbol ]

    "Created: / 03-07-2008 / 20:29:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 09-09-2008 / 20:16:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 18-07-2011 / 16:17:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

smalltalkNamespace
    ^ smalltalkNamespace

    "Created: / 17-02-2008 / 20:47:13 / janfrog"
!

smalltalkNamespace:something
    smalltalkNamespace := something.

    "Created: / 17-02-2008 / 20:47:13 / janfrog"
!

smalltalkPackage
    ^ smalltalkPackage

    "Created: / 03-07-2008 / 21:10:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

smalltalkPackage:something
    smalltalkPackage := something.

    "Created: / 03-07-2008 / 21:10:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CDerivedTypeNode methodsFor:'printing'!

printOn:stream indent:level 

    self printLineOn: stream indent: level.
    self smalltalkNamespace 
        ifNotNil:[
            stream
                nextPutAll:';; Namespace: ';
                nextPutAll:self smalltalkNamespace;
                cr;
                next:level put:Character tab
        ].
    self smalltalkClassName 
        ifNotNil:[
            stream
                nextPutAll:';; Class: ';
                nextPutAll:self smalltalkClassName;
                cr;
                next:level put:Character tab
        ].

    "Created: / 18-02-2008 / 14:33:01 / janfrog"
    "Modified: / 10-07-2008 / 20:05:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CDerivedTypeNode methodsFor:'queries'!

shouldBeIgnored

    ^super shouldBeIgnored 
        or:[self isForeign]

    "Created: / 22-02-2009 / 15:01:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CDerivedTypeNode methodsFor:'testing'!

isForeign

    ^foreign ? false

    "Created: / 04-07-2008 / 11:46:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CDerivedTypeNode 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 visitCDerivedTypeNode:self
! !

!CDerivedTypeNode class methodsFor:'documentation'!

version
    ^ '$Id$'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id$'
! !