Cface__CairoMapping.st
changeset 34 834ca32d06b2
parent 32 d7464405cbda
--- a/Cface__CairoMapping.st	Fri Dec 26 23:53:37 2014 +0100
+++ b/Cface__CairoMapping.st	Sun Dec 28 22:29:51 2014 +0100
@@ -42,40 +42,6 @@
     "Created: / 10-07-2008 / 08:05:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
-smalltalkClassNameForFunction:cFunction 
-    (cFunction cName = 'cairo_create') ifTrue:[
-        ^ 'GraphicsContext'
-    ].
-    ((cFunction cName matches:'*create*') 
-        and:[
-            cFunction return isCPointerNode 
-                and:[ cFunction return type isCStructNode ]
-        ]) 
-            ifTrue:[ ^ cFunction return type smalltalkClassName ].
-    ^ super smalltalkClassNameForFunction:cFunction
-
-    "Created: / 04-07-2008 / 09:43:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
-    "Modified: / 10-07-2008 / 08:01:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-smalltalkNameForEnumValue:cEnumFieldType 
-    |cairoName|
-
-    cairoName := cEnumFieldType cName.
-    (cairoName startsWith:'CAIRO_') ifTrue:[
-        cairoName := cairoName copyFrom:7
-    ].
-    ^ cairoName asSymbol
-
-    "
-        Cface::CairoMapping new
-            smalltalkNameForEnumValue:(Cface::CEnumValueNode new cName:'CAIRO_FONT_TYPE_TOY')
-
-    "
-
-    "Created: / 04-07-2008 / 11:32:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
 smalltalkNamespace
 
     ^#Cairo
@@ -92,23 +58,29 @@
 
 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.
+    ^String streamContents:
+        [:s|
+        s nextPutAll:cFunction cName.
+        cFunction arguments notEmptyOrNil ifTrue:
+            [s nextPut:$:].
+        cFunction arguments size > 1 ifTrue:
+            [(cFunction arguments copyFrom:2) do:
+                [:argument|
+                s 
+                    nextPutAll: '_:']]]
 
     "Created: / 17-02-2008 / 22:16:03 / janfrog"
     "Modified: / 18-02-2008 / 14:58:43 / janfrog"
     "Modified: / 04-07-2008 / 15:33:31 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 28-12-2014 / 10:25:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CairoMapping methodsFor:'mapping - class names'!
+
+smalltalkClassNameForFunction:cFunction 
+    ^ 'CPrimitives'
+
+    "Created: / 28-12-2014 / 20:41:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CairoMapping class methodsFor:'documentation'!
@@ -120,3 +92,4 @@
 version_SVN
     ^ '$Id$'
 ! !
+