xquery/trunk/XQuery__ExternalFunction.st
changeset 241 e28ef0f20186
parent 235 e2a2fac1f45f
--- a/xquery/trunk/XQuery__ExternalFunction.st	Wed Apr 07 12:03:37 2010 +0000
+++ b/xquery/trunk/XQuery__ExternalFunction.st	Wed Apr 07 12:37:26 2010 +0000
@@ -10,6 +10,40 @@
 !
 
 
+!ExternalFunction class methodsFor:'utilities'!
+
+smalltalkize: localName
+
+    "transforms distinct-values into disticntValues"
+    | input output minusFound|
+    input := localName readStream.
+    output := (String new: localName size) writeStream.
+    minusFound := false.
+    [ input atEnd ] whileFalse: [
+        | c |
+        c := input next.
+        c = $- 
+            ifTrue:
+                [minusFound := true]
+            ifFalse:
+                [minusFound 
+                    ifTrue:
+                        [output nextPut:c asUppercase.
+                        minusFound := false]
+                    ifFalse:
+                        [output nextPut:c]]].
+
+    ^output contents
+
+    "
+        self smalltalkize: 'doc' 
+
+        self smalltalkize: 'distinct-values'  
+    "
+
+    "Created: / 28-08-2007 / 23:35:25 / janfrog"
+! !
+
 !ExternalFunction methodsFor:'accessing'!
 
 functionLibrary
@@ -18,28 +52,22 @@
     "Created: / 28-08-2007 / 23:07:47 / janfrog"
 !
 
-javaScriptLocalName: numArgs
+smalltalkizedLocalName
 
-    | jsName |
-    jsName := localName copyReplaceAll: $- with: $_.
-    numArgs > 0 ifTrue:[jsName := jsName , ':'].
-    numArgs > 1 ifTrue:[numArgs - 1 timesRepeat:[jsName := jsName , '_:' ]].
-    ^jsName
+    ^self class smalltalkize: localName
 
-    "Created: / 17-01-2009 / 14:19:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Created: / 28-08-2007 / 23:35:44 / janfrog"
 ! !
 
 !ExternalFunction methodsFor:'function API'!
 
-evaluateInContext:context withParameters:parameters forInterpreter:interpreter 
-    ^ functionLibrary 
-        performPrimitive: localName
-        inContext:context
-        withArguments:parameters
-        forInterpreter:interpreter
+evaluateInContext:context withParameters: parameters forInterpreter: interpreter
+
+    ^functionLibrary
+        evaluate: self inContext:context withParameters: parameters forInterpreter: interpreter
 
     "Created: / 28-08-2007 / 23:10:46 / janfrog"
-    "Modified: / 20-01-2009 / 09:35:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 01-12-2008 / 10:17:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 localName
@@ -72,6 +100,6 @@
 
 !ExternalFunction class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__LibraryFunction.st,v 1.2 2007-09-21 11:21:48 vranyj1 Exp $'
+version_SVN
+    ^ '$Id$'
 ! !