Cface__SVNMapping.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 06 Jul 2015 22:28:52 +0100
changeset 40 7d1e77b6115e
parent 32 d7464405cbda
child 43 9327987437ae
permissions -rw-r--r--
Renamed CUserDefinedTypeNode to CUnresolvedTypeNode. This is a preparation for new resolving code.

"{ Package: 'jv:cface' }"

"{ NameSpace: Cface }"

TypeMapping subclass:#SVNMapping
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-Mappings'
!


!SVNMapping methodsFor:'accessing'!

smalltalkClassNameForDerivedType:cType 
    |cName|

    cName := cType cName.
    cName = 'svn_client_ctx_t' ifTrue:[
        ^ #ClientContext
    ].
    cName = 'apr_array_header_t' ifTrue:[
        ^ #Array
    ].
    (cName startsWith:'svn_') ifTrue:[
        cName := cName copyFrom:5
    ].
    (cName startsWith:'apr') ifTrue:[
        cName := cName copyFrom:5
    ].
    (cName endsWith:'_t') ifTrue:[
        cName := cName copyTo:(cName size - 2)
    ].
    ^ (self smalltalkize:cName) capitalized asSymbol

    "
        Cface::CairoMappings new
            classForType:(Cface::EnumNode new name:'_cairo_subpixel_order_t')

        Cface::CairoMappings new
            classForType:(Cface::EnumNode new name:'_cairo_status_t')"
    "Answers class which should contain function call"

    "Modified: / 17-02-2008 / 22:18:24 / janfrog"
    "Created: / 10-07-2008 / 20:26:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 06-01-2009 / 12:26:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

smalltalkNamespaceForDerivedType: type

    (type cName startsWith: 'svn') ifTrue:[^#SVN].
    (type cName startsWith: 'apr') ifTrue:[^#APR].
    ^super smalltalkNamespaceForDerivedType: type

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

smalltalkPackage

    ^#'stx:goodies/libsvn'

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

smalltalkSelectorForFunction: cFunction

    | selector |
    selector := cFunction cName.
    cFunction isFirstArgumentCPointerToCStructure ifTrue:
        [|firstArgTypeCname|
        firstArgTypeCname := cFunction arguments first type type cName.
        (firstArgTypeCname first = $_) ifTrue:
            [ firstArgTypeCname := firstArgTypeCname copyFrom:2].
        (selector startsWith:firstArgTypeCname) ifTrue:
            [selector := selector copyFrom: firstArgTypeCname size + 2]].

    (selector startsWith:'cairo_')
        ifTrue:[selector := (cFunction cName at: 7) asString , (selector copyFrom: 8)].
    ^self smalltalkizeSelector: selector forFunction: cFunction.

    "Modified: / 18-02-2008 / 14:58:43 / janfrog"
    "Created: / 10-07-2008 / 20:26:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!SVNMapping class methodsFor:'documentation'!

version
    ^'$Id$'
!

version_SVN
    ^ '$Id$'
! !