On 20 May 2010 21:50, Henrik Sperre Johansen <henrik.s.johansen@veloxit.no> wrote:
 On 20.05.2010 19:42, Schwab,Wilhelm K wrote:
Sig,
Since you are focusing on the name of the selector, can I conclude that you are using the selector name to make the call? Â I am not sure I like that (strongly suspect I do not). Â Dolphin and FFI use a pragma(-ish??) syntax with the return type, function name and argument types explicitly listed. Â I very much would like to see you handle the details of getting things on and off of the stack, but I would like to control the selector name and the types.
As an example, calling something
 waveletTransformForward:comma:comma:
is not nearly as helpful to me as
 waveletTransformForward:size:flag:
The selector can be even more informative than that, but hopefully it starts to make the case for the independent selector.
Bill
No, but he is automatically generating the interface from a spec file, thus some standard for how to convert it to a selector is needed.
If he's using the NB FFI convention we discussed some time ago, the only "magic" is that the arg names are used in the apiCall specification. Example copy-pasted from the announcement of that functionality:
primGetModuleFileName: hModule with: lpFileName with: nSize     <primitive: #primitiveNativeCall module: #NativeBoostPlugin>
    ^ NBFFICallout         apiCall: #(             DWORD GetModuleFileName (                 HMODULE hModule,                 LPTSTR lpFilename,                 DWORD nSize))         module: #Kernel32         options: #( - coerceNilToNull )
Right, you are free to change it to anything you like. But it would be unwise to poke manually with more than 2500 functions (i listed the numbers earlier), so there is an automated process which generating code for them. Here is how generated method looks like: glDrawArraysInstancedARB: mode first: first count: count primcount: primcount "This method was automatically generated from OpenGL specs" "See http://squeaksource.com/OpenGLSpecs for details" <primitive: #primitiveNativeCall module: #NativeBoostPlugin> ^ self glApiCall: #( void glDrawArraysInstancedARB ( GLenum mode , long first , GLsizei count , GLsizei primcount ) ) attributes: #( #alias 'DrawArraysInstanced' #category #'ARB_draw_instanced' #version #'2.0' ) As you may see, in addition to function prototype 'void glTbufferMask3DFX ( GLuint mask )' it contains an additional meta-information, which could be userful to diagnose problem, if call fails. And as an example, how you can change it, here it is: choosePixelFormat <primitive: #primitiveNativeCall module: #NativeBoostPlugin> ^ NBFFICallout stdcall: #( int ChoosePixelFormat ( HDC dc , GLPixelFormatDescriptor pixelFormat )) module: #gdi32 as you can see, this method doesn't taking any arguments, while function expects 2. Still its a working implementation. A dc and pixelFormat is an instance variables of method's receiver, and NBFFICallout knows how to deal with it.
Cheers, Henry
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.