Parser.st
changeset 2860 95de50137dbe
parent 2859 6c2fd91f06c6
child 2861 86e0d53257d0
--- a/Parser.st	Wed Apr 04 15:44:35 2012 +0200
+++ b/Parser.st	Mon Apr 09 21:20:29 2012 +0200
@@ -8372,6 +8372,24 @@
     "Modified: / 01-07-2010 / 12:05:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+parseGSTExternalFunctionDeclaration: argArray
+    "Handles GNU Smalltalk-style exteranl function declarations.
+     Example:
+         <cCall: 'cairo_close_path' returning: #void args: #(#cObject )>
+    "
+    | function |
+    function := ExternalLibraryFunction 
+            name:argArray first
+            module:nil 
+            returnType:argArray second
+            argumentTypes:argArray third asArray.
+    function beCallTypeC.
+    function owningClass:classToCompileFor.
+    self generateCallToExternalFunction:function lineNr:lineNr.
+
+    "Created: / 09-04-2012 / 19:52:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 parseOtherPrimitives
     |key value values|
 
@@ -8408,12 +8426,18 @@
     ].
     annotations := annotations 
                 copyWith:(Array with:key asSymbol with:(values asArray)).
+
+    "JV@2012-04-09: Check for GNU Smalltalk-style external function declaration"
+    key = #'cCall:returning:args:' ifTrue:[
+        self parseGSTExternalFunctionDeclaration: values.
+    ].
+
     self checkForClosingAngle.
     ^ nil.
 
     "Created: / 04-11-2009 / 08:51:48 / Jan Travnicek <travnja3@fel.cvut.cz>"
     "Modified: / 19-11-2009 / 11:48:24 / Jan Travnicek <travnja3@fel.cvut.cz>"
-    "Modified: / 01-07-2010 / 12:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 09-04-2012 / 20:18:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parsePrimitive
@@ -10744,11 +10768,11 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.713 2012-04-04 13:44:35 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.714 2012-04-09 19:20:29 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.713 2012-04-04 13:44:35 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.714 2012-04-09 19:20:29 vrany Exp $'
 !
 
 version_SVN