Ricardo Moran uploaded a new version of Compiler to project Etoys: http://source.squeak.org/etoys/Compiler-Richo.4.mcz
==================== Summary ====================
Name: Compiler-Richo.4 Author: Richo Time: 31 December 2010, 12:07:30 am UUID: ad749a67-8101-7245-b150-7fb8b9b43218 Ancestors: Compiler-kfr.3
* Fixed parsing of external function declarations in order to make FFI work correctly.
=============== Diff against Compiler-kfr.3 ===============
Item was changed: ----- Method: Parser>>externalFunctionDeclaration (in category 'primitives') ----- externalFunctionDeclaration "Parse the function declaration for a call to an external library." | descriptorClass callType retType externalName args argType module fn | descriptorClass _ Smalltalk at: #ExternalFunction ifAbsent:[nil]. descriptorClass == nil ifTrue:[^0]. callType _ descriptorClass callingConventionFor: here. callType == nil ifTrue:[^0]. "Parse return type" self advance. retType _ self externalType: descriptorClass. retType == nil ifTrue:[^self expected:'return type']. "Parse function name or index" externalName _ here. (self match: #string) ifTrue:[externalName _ externalName asSymbol] ifFalse:[(self match:#number) ifFalse:[^self expected:'function name or index']]. (self matchToken:'(' asSymbol) ifFalse:[^self expected:'argument list']. args _ WriteStream on: Array new. [here == #')'] whileFalse:[ argType _ self externalType: descriptorClass. argType == nil ifTrue:[^self expected:'argument']. argType isVoid & argType isPointerType not ifFalse:[args nextPut: argType]. ]. (self matchToken:')' asSymbol) ifFalse:[^self expected:')']. (self matchToken: 'module:') ifTrue:[ module _ here. (self match: #string) ifFalse:[^self expected: 'String']. module _ module asSymbol]. Smalltalk at: #ExternalLibraryFunction ifPresent:[:xfn| fn _ xfn name: externalName module: module callType: callType returnType: retType argumentTypes: args contents. self allocateLiteral: fn. ]. + self addPragma: (Pragma keyword: #primitive: arguments: #(120)). + ^ true! - ^120!
etoys-dev@lists.squeakfoundation.org