Cface__SVNMapping.st
changeset 6 ae25dce94003
child 10 8087158409e4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Cface__SVNMapping.st	Thu Jul 10 20:56:08 2008 +0000
@@ -0,0 +1,76 @@
+"{ Package: 'cvut:fel/cface' }"
+
+"{ NameSpace: Cface }"
+
+TypeMapping subclass:#SVNMapping
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Cface-Mappings'
+!
+
+!SVNMapping methodsFor:'accessing'!
+
+smalltalkClassNameForDerivedType:cType 
+    |svnName|
+
+    svnName := cType cName.
+    svnName = 'svn_client_ctx' ifTrue:[
+        ^ #Context
+    ].
+    (svnName startsWith:'svn_') ifTrue:[
+        svnName := svnName copyFrom:5
+    ].
+    (svnName endsWith:'_t') ifTrue:[
+        svnName := svnName copyTo:(svnName size - 2)
+    ].
+    ^ (self smalltalkize:svnName) 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>"
+!
+
+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>"
+! !
+