FFI number of arguments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

FFI number of arguments

Schwab,Wilhelm K
Hello all,

I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:

   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543

Have any of you done this with >15 (or whatever the cutoff is) arguments?

Bill


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Igor Stasenko
On 6 October 2010 04:52, Schwab,Wilhelm K <[hidden email]> wrote:
> Hello all,
>
> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>
>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>
> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>

what i can say.. put a feature request for NativeBoost to fetch
arguments from array.. :)

i imagine something like that:

callFooX: x y: y rest: array

    <primitive: #primitiveNativeCall module: #NativeBoostPlugin >

    ^ NBFFICallout cdecl: #(
         int foo (int x, int y , char array (1) , void* array(2) )
    )
   module: 'bar.dll'

so, array(i)
tells code generator that argument should be fetched from array
argument at index 1.
There could be variants like:

int foo (int x, int y , char array 1 , void* array 2 )

> Bill
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Levente Uzonyi-2
In reply to this post by Schwab,Wilhelm K
On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:

> Hello all,
>
> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>
>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>
> Have any of you done this with >15 (or whatever the cutoff is) arguments?

You can create your own function object and invoke it with an array.
Here's an fprintf example on windows:

fprintf := ExternalLibraryFunction
  name: 'fprintf'
  module: 'msvcrt.dll'
  callType: ExternalFunction callTypeCDecl
  returnType: ExternalType signedLong
  argumentTypes: {
  (ExternalType structTypeNamed: #FILE) asPointerType.
  ExternalType string.
  ExternalType signedLong }.
file := Stdio default fopenWith: 'test.txt' with: 'w'.
fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
Stdio default fcloseWith: file.


Levente

P.S.: Note that you need the FILE and Stdio classes to run this example.

>
> Bill
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
Sent: Tuesday, October 05, 2010 10:26 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:

> Hello all,
>
> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>
>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>
> Have any of you done this with >15 (or whatever the cutoff is) arguments?

You can create your own function object and invoke it with an array.
Here's an fprintf example on windows:

fprintf := ExternalLibraryFunction
        name: 'fprintf'
        module: 'msvcrt.dll'
        callType: ExternalFunction callTypeCDecl
        returnType: ExternalType signedLong
        argumentTypes: {
                (ExternalType structTypeNamed: #FILE) asPointerType.
                ExternalType string.
                ExternalType signedLong }.
file := Stdio default fopenWith: 'test.txt' with: 'w'.
fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
Stdio default fcloseWith: file.


Levente

P.S.: Note that you need the FILE and Stdio classes to run this example.

>
> Bill
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Levente Uzonyi-2
On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:

> yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?

It works up to 128 arguments. But why don't you try it yourself?


Levente

>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> Sent: Tuesday, October 05, 2010 10:26 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>
>> Hello all,
>>
>> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>>
>>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>>
>> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>
> You can create your own function object and invoke it with an array.
> Here's an fprintf example on windows:
>
> fprintf := ExternalLibraryFunction
>        name: 'fprintf'
>        module: 'msvcrt.dll'
>        callType: ExternalFunction callTypeCDecl
>        returnType: ExternalType signedLong
>        argumentTypes: {
>                (ExternalType structTypeNamed: #FILE) asPointerType.
>                ExternalType string.
>                ExternalType signedLong }.
> file := Stdio default fopenWith: 'test.txt' with: 'w'.
> fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> Stdio default fcloseWith: file.
>
>
> Levente
>
> P.S.: Note that you need the FILE and Stdio classes to run this example.
>
>>
>> Bill
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Nicolas Cellier
In Smallapack, I implemented a hack to handle methods with 15+
arguments, including regular Smalltalk + FFI (you can figure that
Smalltalk methods wrapping a FFI call sometimes need 15+ parameters
too)..
It is rooted at http://bugs.squeak.org/view.php?id=2918
A more recent version can be found at
http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz
It might be non trivial to merge with Pharo, but you can give it a try.

Nicolas

2010/10/6 Levente Uzonyi <[hidden email]>:

> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>
>> yes, that's what the link describes.  The open question is whether anyone
>> has successfully done that with 15+ arguments?
>
> It works up to 128 arguments. But why don't you try it yourself?
>
>
> Levente
>
>>
>>
>>
>> ________________________________________
>> From: [hidden email]
>> [[hidden email]] On Behalf Of Levente Uzonyi
>> [[hidden email]]
>> Sent: Tuesday, October 05, 2010 10:26 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>>
>>> Hello all,
>>>
>>> I have been bumping into some functions with large numbers of arguments.
>>>  One in particular would be best handled in the image if at all possible.
>>>  The following might be the answer:
>>>
>>>
>>>  http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>>>
>>> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>>
>> You can create your own function object and invoke it with an array.
>> Here's an fprintf example on windows:
>>
>> fprintf := ExternalLibraryFunction
>>       name: 'fprintf'
>>       module: 'msvcrt.dll'
>>       callType: ExternalFunction callTypeCDecl
>>       returnType: ExternalType signedLong
>>       argumentTypes: {
>>               (ExternalType structTypeNamed: #FILE) asPointerType.
>>               ExternalType string.
>>               ExternalType signedLong }.
>> file := Stdio default fopenWith: 'test.txt' with: 'w'.
>> fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>> Stdio default fcloseWith: file.
>>
>>
>> Levente
>>
>> P.S.: Note that you need the FILE and Stdio classes to run this example.
>>
>>>
>>> Bill
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
In reply to this post by Levente Uzonyi-2
Levente,

What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?




________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
Sent: Tuesday, October 05, 2010 11:09 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:

> yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?

It works up to 128 arguments. But why don't you try it yourself?


Levente

>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> Sent: Tuesday, October 05, 2010 10:26 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>
>> Hello all,
>>
>> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>>
>>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>>
>> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>
> You can create your own function object and invoke it with an array.
> Here's an fprintf example on windows:
>
> fprintf := ExternalLibraryFunction
>        name: 'fprintf'
>        module: 'msvcrt.dll'
>        callType: ExternalFunction callTypeCDecl
>        returnType: ExternalType signedLong
>        argumentTypes: {
>                (ExternalType structTypeNamed: #FILE) asPointerType.
>                ExternalType string.
>                ExternalType signedLong }.
> file := Stdio default fopenWith: 'test.txt' with: 'w'.
> fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> Stdio default fcloseWith: file.
>
>
> Levente
>
> P.S.: Note that you need the FILE and Stdio classes to run this example.
>
>>
>> Bill
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Miguel Cobá
El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> Levente,
>
> What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>

But Bill, almost all your questions are long and without apparent focus
on the real point. Some other times are like this, things that you could
easily test by yourself maybe in less time that takes you to write so
many words, send the email and wait for a response from someone willing
to decipher what the real problem is. Other times you point at problems
that you find in your environment without giving better hints than "in a
hopefully updated image", "in a, I think, not modified image", "in my
machine", that doesn't help in helping you.
Then you point some problems that it appears that are very evident to
you and whose solution is also very obvious to you but you don't provide
a fix for them neither, like the always topic of yours about sockets.

Then when someone points and the  obvious things you should do (your
homework, in verifying yourself what you are asking to the list) or to
precise the information needed to better answer you, you respond upset
as if anyone should be obliged to answer you or even read your mails.

So, please, read

http://www.catb.org/esr/faqs/smart-questions.html

do your homework and then ask the list.




>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> Sent: Tuesday, October 05, 2010 11:09 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>
> > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>
> It works up to 128 arguments. But why don't you try it yourself?
>
>
> Levente
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > Sent: Tuesday, October 05, 2010 10:26 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> >> Hello all,
> >>
> >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> >>
> >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> >>
> >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> >
> > You can create your own function object and invoke it with an array.
> > Here's an fprintf example on windows:
> >
> > fprintf := ExternalLibraryFunction
> >        name: 'fprintf'
> >        module: 'msvcrt.dll'
> >        callType: ExternalFunction callTypeCDecl
> >        returnType: ExternalType signedLong
> >        argumentTypes: {
> >                (ExternalType structTypeNamed: #FILE) asPointerType.
> >                ExternalType string.
> >                ExternalType signedLong }.
> > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > Stdio default fcloseWith: file.
> >
> >
> > Levente
> >
> > P.S.: Note that you need the FILE and Stdio classes to run this example.
> >
> >>
> >> Bill
> >>
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
Miguel,

I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.

As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.

Bill



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
Sent: Wednesday, October 06, 2010 12:13 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> Levente,
>
> What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>

But Bill, almost all your questions are long and without apparent focus
on the real point. Some other times are like this, things that you could
easily test by yourself maybe in less time that takes you to write so
many words, send the email and wait for a response from someone willing
to decipher what the real problem is. Other times you point at problems
that you find in your environment without giving better hints than "in a
hopefully updated image", "in a, I think, not modified image", "in my
machine", that doesn't help in helping you.
Then you point some problems that it appears that are very evident to
you and whose solution is also very obvious to you but you don't provide
a fix for them neither, like the always topic of yours about sockets.

Then when someone points and the  obvious things you should do (your
homework, in verifying yourself what you are asking to the list) or to
precise the information needed to better answer you, you respond upset
as if anyone should be obliged to answer you or even read your mails.

So, please, read

http://www.catb.org/esr/faqs/smart-questions.html

do your homework and then ask the list.




>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> Sent: Tuesday, October 05, 2010 11:09 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>
> > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>
> It works up to 128 arguments. But why don't you try it yourself?
>
>
> Levente
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > Sent: Tuesday, October 05, 2010 10:26 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> >> Hello all,
> >>
> >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> >>
> >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> >>
> >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> >
> > You can create your own function object and invoke it with an array.
> > Here's an fprintf example on windows:
> >
> > fprintf := ExternalLibraryFunction
> >        name: 'fprintf'
> >        module: 'msvcrt.dll'
> >        callType: ExternalFunction callTypeCDecl
> >        returnType: ExternalType signedLong
> >        argumentTypes: {
> >                (ExternalType structTypeNamed: #FILE) asPointerType.
> >                ExternalType string.
> >                ExternalType signedLong }.
> > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > Stdio default fcloseWith: file.
> >
> >
> > Levente
> >
> > P.S.: Note that you need the FILE and Stdio classes to run this example.
> >
> >>
> >> Bill
> >>
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Miguel Cobá
El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> Miguel,
>
> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>
> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>

But in the end if you really need to use that call, either it works or
don't, you'll need to write it, even if someone says that it doesn't
work. Why, because you need it, and if you don't need it then your
question is rhetoric, because you don't even mind the answer.
You can't ask for advise for every and each step you take, most times
you should walk away, _fix_ what you find wrong and then report back the
fix. That would really make the archives more rich because you are
contributing back real knowledge and maybe code and not just polluting
the archives with threads that ask things but solve nothing for anyone
but you.

Cheers


> Bill
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 12:13 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> > Levente,
> >
> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >
>
> But Bill, almost all your questions are long and without apparent focus
> on the real point. Some other times are like this, things that you could
> easily test by yourself maybe in less time that takes you to write so
> many words, send the email and wait for a response from someone willing
> to decipher what the real problem is. Other times you point at problems
> that you find in your environment without giving better hints than "in a
> hopefully updated image", "in a, I think, not modified image", "in my
> machine", that doesn't help in helping you.
> Then you point some problems that it appears that are very evident to
> you and whose solution is also very obvious to you but you don't provide
> a fix for them neither, like the always topic of yours about sockets.
>
> Then when someone points and the  obvious things you should do (your
> homework, in verifying yourself what you are asking to the list) or to
> precise the information needed to better answer you, you respond upset
> as if anyone should be obliged to answer you or even read your mails.
>
> So, please, read
>
> http://www.catb.org/esr/faqs/smart-questions.html
>
> do your homework and then ask the list.
>
>
>
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > Sent: Tuesday, October 05, 2010 11:09 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >
> > It works up to 128 arguments. But why don't you try it yourself?
> >
> >
> > Levente
> >
> > >
> > >
> > >
> > > ________________________________________
> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > > Sent: Tuesday, October 05, 2010 10:26 PM
> > > To: [hidden email]
> > > Subject: Re: [Pharo-project] FFI number of arguments
> > >
> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> > >
> > >> Hello all,
> > >>
> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> > >>
> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> > >>
> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> > >
> > > You can create your own function object and invoke it with an array.
> > > Here's an fprintf example on windows:
> > >
> > > fprintf := ExternalLibraryFunction
> > >        name: 'fprintf'
> > >        module: 'msvcrt.dll'
> > >        callType: ExternalFunction callTypeCDecl
> > >        returnType: ExternalType signedLong
> > >        argumentTypes: {
> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> > >                ExternalType string.
> > >                ExternalType signedLong }.
> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > > Stdio default fcloseWith: file.
> > >
> > >
> > > Levente
> > >
> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> > >
> > >>
> > >> Bill
> > >>
> > >>
> > >> _______________________________________________
> > >> Pharo-project mailing list
> > >> [hidden email]
> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >>
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
Miguel,

I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.  

And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.

Bill



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
Sent: Wednesday, October 06, 2010 12:52 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> Miguel,
>
> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>
> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>

But in the end if you really need to use that call, either it works or
don't, you'll need to write it, even if someone says that it doesn't
work. Why, because you need it, and if you don't need it then your
question is rhetoric, because you don't even mind the answer.
You can't ask for advise for every and each step you take, most times
you should walk away, _fix_ what you find wrong and then report back the
fix. That would really make the archives more rich because you are
contributing back real knowledge and maybe code and not just polluting
the archives with threads that ask things but solve nothing for anyone
but you.

Cheers


> Bill
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 12:13 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> > Levente,
> >
> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >
>
> But Bill, almost all your questions are long and without apparent focus
> on the real point. Some other times are like this, things that you could
> easily test by yourself maybe in less time that takes you to write so
> many words, send the email and wait for a response from someone willing
> to decipher what the real problem is. Other times you point at problems
> that you find in your environment without giving better hints than "in a
> hopefully updated image", "in a, I think, not modified image", "in my
> machine", that doesn't help in helping you.
> Then you point some problems that it appears that are very evident to
> you and whose solution is also very obvious to you but you don't provide
> a fix for them neither, like the always topic of yours about sockets.
>
> Then when someone points and the  obvious things you should do (your
> homework, in verifying yourself what you are asking to the list) or to
> precise the information needed to better answer you, you respond upset
> as if anyone should be obliged to answer you or even read your mails.
>
> So, please, read
>
> http://www.catb.org/esr/faqs/smart-questions.html
>
> do your homework and then ask the list.
>
>
>
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > Sent: Tuesday, October 05, 2010 11:09 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >
> > It works up to 128 arguments. But why don't you try it yourself?
> >
> >
> > Levente
> >
> > >
> > >
> > >
> > > ________________________________________
> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > > Sent: Tuesday, October 05, 2010 10:26 PM
> > > To: [hidden email]
> > > Subject: Re: [Pharo-project] FFI number of arguments
> > >
> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> > >
> > >> Hello all,
> > >>
> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> > >>
> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> > >>
> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> > >
> > > You can create your own function object and invoke it with an array.
> > > Here's an fprintf example on windows:
> > >
> > > fprintf := ExternalLibraryFunction
> > >        name: 'fprintf'
> > >        module: 'msvcrt.dll'
> > >        callType: ExternalFunction callTypeCDecl
> > >        returnType: ExternalType signedLong
> > >        argumentTypes: {
> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> > >                ExternalType string.
> > >                ExternalType signedLong }.
> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > > Stdio default fcloseWith: file.
> > >
> > >
> > > Levente
> > >
> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> > >
> > >>
> > >> Bill
> > >>
> > >>
> > >> _______________________________________________
> > >> Pharo-project mailing list
> > >> [hidden email]
> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >>
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Nicolas Cellier
Hi Bill,
I somehow share some of Miguel impressions.
Some (most) of your messages are too verbose for me, and - no offense
- I often discard them, though I may have a solution to propose.
It's hard to understand if our answer was helpful or not, if some
details should be changed etc...
In one word I've got the feeling to give, but not to share.
Maybe my english level is just too low, but you know, these lists are
rather international.
Sorry for the rant, but please, help us to help you.

Back to the technical problem, did the updated version at
http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
did my words "not trivial" stopped you?

Nicolas

2010/10/6 Schwab,Wilhelm K <[hidden email]>:

> Miguel,
>
> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
>
> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
>
> Bill
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 12:52 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
>> Miguel,
>>
>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>>
>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>>
>
> But in the end if you really need to use that call, either it works or
> don't, you'll need to write it, even if someone says that it doesn't
> work. Why, because you need it, and if you don't need it then your
> question is rhetoric, because you don't even mind the answer.
> You can't ask for advise for every and each step you take, most times
> you should walk away, _fix_ what you find wrong and then report back the
> fix. That would really make the archives more rich because you are
> contributing back real knowledge and maybe code and not just polluting
> the archives with threads that ask things but solve nothing for anyone
> but you.
>
> Cheers
>
>
>> Bill
>>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> Sent: Wednesday, October 06, 2010 12:13 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
>> > Levente,
>> >
>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>> >
>>
>> But Bill, almost all your questions are long and without apparent focus
>> on the real point. Some other times are like this, things that you could
>> easily test by yourself maybe in less time that takes you to write so
>> many words, send the email and wait for a response from someone willing
>> to decipher what the real problem is. Other times you point at problems
>> that you find in your environment without giving better hints than "in a
>> hopefully updated image", "in a, I think, not modified image", "in my
>> machine", that doesn't help in helping you.
>> Then you point some problems that it appears that are very evident to
>> you and whose solution is also very obvious to you but you don't provide
>> a fix for them neither, like the always topic of yours about sockets.
>>
>> Then when someone points and the  obvious things you should do (your
>> homework, in verifying yourself what you are asking to the list) or to
>> precise the information needed to better answer you, you respond upset
>> as if anyone should be obliged to answer you or even read your mails.
>>
>> So, please, read
>>
>> http://www.catb.org/esr/faqs/smart-questions.html
>>
>> do your homework and then ask the list.
>>
>>
>>
>>
>> >
>> >
>> >
>> > ________________________________________
>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> > Sent: Tuesday, October 05, 2010 11:09 PM
>> > To: [hidden email]
>> > Subject: Re: [Pharo-project] FFI number of arguments
>> >
>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> >
>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>> >
>> > It works up to 128 arguments. But why don't you try it yourself?
>> >
>> >
>> > Levente
>> >
>> > >
>> > >
>> > >
>> > > ________________________________________
>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> > > Sent: Tuesday, October 05, 2010 10:26 PM
>> > > To: [hidden email]
>> > > Subject: Re: [Pharo-project] FFI number of arguments
>> > >
>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> > >
>> > >> Hello all,
>> > >>
>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>> > >>
>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>> > >>
>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>> > >
>> > > You can create your own function object and invoke it with an array.
>> > > Here's an fprintf example on windows:
>> > >
>> > > fprintf := ExternalLibraryFunction
>> > >        name: 'fprintf'
>> > >        module: 'msvcrt.dll'
>> > >        callType: ExternalFunction callTypeCDecl
>> > >        returnType: ExternalType signedLong
>> > >        argumentTypes: {
>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
>> > >                ExternalType string.
>> > >                ExternalType signedLong }.
>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>> > > Stdio default fcloseWith: file.
>> > >
>> > >
>> > > Levente
>> > >
>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
>> > >
>> > >>
>> > >> Bill
>> > >>
>> > >>
>> > >> _______________________________________________
>> > >> Pharo-project mailing list
>> > >> [hidden email]
>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >>
>> > >
>> > > _______________________________________________
>> > > Pharo-project mailing list
>> > > [hidden email]
>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >
>> > > _______________________________________________
>> > > Pharo-project mailing list
>> > > [hidden email]
>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> --
>> Miguel Cobá
>> http://miguel.leugim.com.mx
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Eliot Miranda-2
In reply to this post by Schwab,Wilhelm K
Bill,

On Wed, Oct 6, 2010 at 10:24 AM, Schwab,Wilhelm K <[hidden email]> wrote:
Miguel,

I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.

And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.

You can.  You're just too lazy to try.  You need to read (at least) http://en.wikipedia.org/wiki/Reciprocal_altruism.  I share Miguel's and Nicolas' impressions of you.  I see you taking much more than you give and it's straining my patience.

Eliot


Bill



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
Sent: Wednesday, October 06, 2010 12:52 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> Miguel,
>
> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>
> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>

But in the end if you really need to use that call, either it works or
don't, you'll need to write it, even if someone says that it doesn't
work. Why, because you need it, and if you don't need it then your
question is rhetoric, because you don't even mind the answer.
You can't ask for advise for every and each step you take, most times
you should walk away, _fix_ what you find wrong and then report back the
fix. That would really make the archives more rich because you are
contributing back real knowledge and maybe code and not just polluting
the archives with threads that ask things but solve nothing for anyone
but you.

Cheers


> Bill
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 12:13 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> > Levente,
> >
> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >
>
> But Bill, almost all your questions are long and without apparent focus
> on the real point. Some other times are like this, things that you could
> easily test by yourself maybe in less time that takes you to write so
> many words, send the email and wait for a response from someone willing
> to decipher what the real problem is. Other times you point at problems
> that you find in your environment without giving better hints than "in a
> hopefully updated image", "in a, I think, not modified image", "in my
> machine", that doesn't help in helping you.
> Then you point some problems that it appears that are very evident to
> you and whose solution is also very obvious to you but you don't provide
> a fix for them neither, like the always topic of yours about sockets.
>
> Then when someone points and the  obvious things you should do (your
> homework, in verifying yourself what you are asking to the list) or to
> precise the information needed to better answer you, you respond upset
> as if anyone should be obliged to answer you or even read your mails.
>
> So, please, read
>
> http://www.catb.org/esr/faqs/smart-questions.html
>
> do your homework and then ask the list.
>
>
>
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > Sent: Tuesday, October 05, 2010 11:09 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >
> > It works up to 128 arguments. But why don't you try it yourself?
> >
> >
> > Levente
> >
> > >
> > >
> > >
> > > ________________________________________
> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> > > Sent: Tuesday, October 05, 2010 10:26 PM
> > > To: [hidden email]
> > > Subject: Re: [Pharo-project] FFI number of arguments
> > >
> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> > >
> > >> Hello all,
> > >>
> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> > >>
> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> > >>
> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> > >
> > > You can create your own function object and invoke it with an array.
> > > Here's an fprintf example on windows:
> > >
> > > fprintf := ExternalLibraryFunction
> > >        name: 'fprintf'
> > >        module: 'msvcrt.dll'
> > >        callType: ExternalFunction callTypeCDecl
> > >        returnType: ExternalType signedLong
> > >        argumentTypes: {
> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> > >                ExternalType string.
> > >                ExternalType signedLong }.
> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > > Stdio default fcloseWith: file.
> > >
> > >
> > > Levente
> > >
> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> > >
> > >>
> > >> Bill
> > >>
> > >>
> > >> _______________________________________________
> > >> Pharo-project mailing list
> > >> [hidden email]
> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >>
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
In reply to this post by Nicolas Cellier
Nicolas,

The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).

If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:

(1) call the function as designed (hence my question)
(2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
(3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.

Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.

Bill


http://plplot.sourceforge.net/examples.php?demo=26



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
Sent: Wednesday, October 06, 2010 2:31 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

Hi Bill,
I somehow share some of Miguel impressions.
Some (most) of your messages are too verbose for me, and - no offense
- I often discard them, though I may have a solution to propose.
It's hard to understand if our answer was helpful or not, if some
details should be changed etc...
In one word I've got the feeling to give, but not to share.
Maybe my english level is just too low, but you know, these lists are
rather international.
Sorry for the rant, but please, help us to help you.

Back to the technical problem, did the updated version at
http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
did my words "not trivial" stopped you?

Nicolas

2010/10/6 Schwab,Wilhelm K <[hidden email]>:

> Miguel,
>
> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
>
> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
>
> Bill
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 12:52 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
>> Miguel,
>>
>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>>
>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>>
>
> But in the end if you really need to use that call, either it works or
> don't, you'll need to write it, even if someone says that it doesn't
> work. Why, because you need it, and if you don't need it then your
> question is rhetoric, because you don't even mind the answer.
> You can't ask for advise for every and each step you take, most times
> you should walk away, _fix_ what you find wrong and then report back the
> fix. That would really make the archives more rich because you are
> contributing back real knowledge and maybe code and not just polluting
> the archives with threads that ask things but solve nothing for anyone
> but you.
>
> Cheers
>
>
>> Bill
>>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> Sent: Wednesday, October 06, 2010 12:13 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
>> > Levente,
>> >
>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>> >
>>
>> But Bill, almost all your questions are long and without apparent focus
>> on the real point. Some other times are like this, things that you could
>> easily test by yourself maybe in less time that takes you to write so
>> many words, send the email and wait for a response from someone willing
>> to decipher what the real problem is. Other times you point at problems
>> that you find in your environment without giving better hints than "in a
>> hopefully updated image", "in a, I think, not modified image", "in my
>> machine", that doesn't help in helping you.
>> Then you point some problems that it appears that are very evident to
>> you and whose solution is also very obvious to you but you don't provide
>> a fix for them neither, like the always topic of yours about sockets.
>>
>> Then when someone points and the  obvious things you should do (your
>> homework, in verifying yourself what you are asking to the list) or to
>> precise the information needed to better answer you, you respond upset
>> as if anyone should be obliged to answer you or even read your mails.
>>
>> So, please, read
>>
>> http://www.catb.org/esr/faqs/smart-questions.html
>>
>> do your homework and then ask the list.
>>
>>
>>
>>
>> >
>> >
>> >
>> > ________________________________________
>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> > Sent: Tuesday, October 05, 2010 11:09 PM
>> > To: [hidden email]
>> > Subject: Re: [Pharo-project] FFI number of arguments
>> >
>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> >
>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>> >
>> > It works up to 128 arguments. But why don't you try it yourself?
>> >
>> >
>> > Levente
>> >
>> > >
>> > >
>> > >
>> > > ________________________________________
>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> > > Sent: Tuesday, October 05, 2010 10:26 PM
>> > > To: [hidden email]
>> > > Subject: Re: [Pharo-project] FFI number of arguments
>> > >
>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> > >
>> > >> Hello all,
>> > >>
>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>> > >>
>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>> > >>
>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>> > >
>> > > You can create your own function object and invoke it with an array.
>> > > Here's an fprintf example on windows:
>> > >
>> > > fprintf := ExternalLibraryFunction
>> > >        name: 'fprintf'
>> > >        module: 'msvcrt.dll'
>> > >        callType: ExternalFunction callTypeCDecl
>> > >        returnType: ExternalType signedLong
>> > >        argumentTypes: {
>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
>> > >                ExternalType string.
>> > >                ExternalType signedLong }.
>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>> > > Stdio default fcloseWith: file.
>> > >
>> > >
>> > > Levente
>> > >
>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
>> > >
>> > >>
>> > >> Bill
>> > >>
>> > >>
>> > >> _______________________________________________
>> > >> Pharo-project mailing list
>> > >> [hidden email]
>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >>
>> > >
>> > > _______________________________________________
>> > > Pharo-project mailing list
>> > > [hidden email]
>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >
>> > > _______________________________________________
>> > > Pharo-project mailing list
>> > > [hidden email]
>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> > >
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> --
>> Miguel Cobá
>> http://miguel.leugim.com.mx
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
In reply to this post by Eliot Miranda-2
Stick around.  Have you noticed that some of what I am "taking" is going into an interface to GSL?  When I am finally able to "take" something that provides callbacks, you will be in for a shock.




________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Eliot Miranda [[hidden email]]
Sent: Wednesday, October 06, 2010 2:38 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

Bill,

On Wed, Oct 6, 2010 at 10:24 AM, Schwab,Wilhelm K <[hidden email]<mailto:[hidden email]>> wrote:
Miguel,

I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.

And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.

You can.  You're just too lazy to try.  You need to read (at least) http://en.wikipedia.org/wiki/Reciprocal_altruism.  I share Miguel's and Nicolas' impressions of you.  I see you taking much more than you give and it's straining my patience.

Eliot


Bill



________________________________________
From: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Miguel Cobá [[hidden email]<mailto:[hidden email]>]
Sent: Wednesday, October 06, 2010 12:52 PM
To: [hidden email]<mailto:[hidden email]>
Subject: Re: [Pharo-project] FFI number of arguments

El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> Miguel,
>
> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>
> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>

But in the end if you really need to use that call, either it works or
don't, you'll need to write it, even if someone says that it doesn't
work. Why, because you need it, and if you don't need it then your
question is rhetoric, because you don't even mind the answer.
You can't ask for advise for every and each step you take, most times
you should walk away, _fix_ what you find wrong and then report back the
fix. That would really make the archives more rich because you are
contributing back real knowledge and maybe code and not just polluting
the archives with threads that ask things but solve nothing for anyone
but you.

Cheers


> Bill
>
>
>
> ________________________________________
> From: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Miguel Cobá [[hidden email]<mailto:[hidden email]>]
> Sent: Wednesday, October 06, 2010 12:13 PM
> To: [hidden email]<mailto:[hidden email]>
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> > Levente,
> >
> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >
>
> But Bill, almost all your questions are long and without apparent focus
> on the real point. Some other times are like this, things that you could
> easily test by yourself maybe in less time that takes you to write so
> many words, send the email and wait for a response from someone willing
> to decipher what the real problem is. Other times you point at problems
> that you find in your environment without giving better hints than "in a
> hopefully updated image", "in a, I think, not modified image", "in my
> machine", that doesn't help in helping you.
> Then you point some problems that it appears that are very evident to
> you and whose solution is also very obvious to you but you don't provide
> a fix for them neither, like the always topic of yours about sockets.
>
> Then when someone points and the  obvious things you should do (your
> homework, in verifying yourself what you are asking to the list) or to
> precise the information needed to better answer you, you respond upset
> as if anyone should be obliged to answer you or even read your mails.
>
> So, please, read
>
> http://www.catb.org/esr/faqs/smart-questions.html
>
> do your homework and then ask the list.
>
>
>
>
> >
> >
> >
> > ________________________________________
> > From: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Levente Uzonyi [[hidden email]<mailto:[hidden email]>]
> > Sent: Tuesday, October 05, 2010 11:09 PM
> > To: [hidden email]<mailto:[hidden email]>
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >
> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >
> > It works up to 128 arguments. But why don't you try it yourself?
> >
> >
> > Levente
> >
> > >
> > >
> > >
> > > ________________________________________
> > > From: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Levente Uzonyi [[hidden email]<mailto:[hidden email]>]
> > > Sent: Tuesday, October 05, 2010 10:26 PM
> > > To: [hidden email]<mailto:[hidden email]>
> > > Subject: Re: [Pharo-project] FFI number of arguments
> > >
> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> > >
> > >> Hello all,
> > >>
> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> > >>
> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> > >>
> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> > >
> > > You can create your own function object and invoke it with an array.
> > > Here's an fprintf example on windows:
> > >
> > > fprintf := ExternalLibraryFunction
> > >        name: 'fprintf'
> > >        module: 'msvcrt.dll'
> > >        callType: ExternalFunction callTypeCDecl
> > >        returnType: ExternalType signedLong
> > >        argumentTypes: {
> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> > >                ExternalType string.
> > >                ExternalType signedLong }.
> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> > > Stdio default fcloseWith: file.
> > >
> > >
> > > Levente
> > >
> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> > >
> > >>
> > >> Bill
> > >>
> > >>
> > >> _______________________________________________
> > >> Pharo-project mailing list
> > >> [hidden email]<mailto:[hidden email]>
> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >>
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]<mailto:[hidden email]>
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > [hidden email]<mailto:[hidden email]>
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]<mailto:[hidden email]>
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]<mailto:[hidden email]>
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]<mailto:[hidden email]>
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]<mailto:[hidden email]>
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]<mailto:[hidden email]>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]<mailto:[hidden email]>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Nicolas Cellier
In reply to this post by Schwab,Wilhelm K
2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> Nicolas,
>
> The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).
>

Well, it might have worked at first try, or not... At least that would
be a valuable information.
You could even have enrolled me in helping a port to Pharo, my time is
scarse, but it's free.
If you have a simple solution, that's OK, but I just wonder why you
asked this list.
If you don't take our answers into account, then we're in a dead-end.
No feedback, no win-win cycle.
If it's just to diiscuss technical merit of whatever solution, without
a line of code to share, then it's gonna get too abstract to interest
many of us.
Beware to not dry the sources.

Cheers

Nicolas

> If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:
>
> (1) call the function as designed (hence my question)
> (2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
> (3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.
>
> Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.
>
> Bill
>
>
> http://plplot.sourceforge.net/examples.php?demo=26
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> Sent: Wednesday, October 06, 2010 2:31 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> Hi Bill,
> I somehow share some of Miguel impressions.
> Some (most) of your messages are too verbose for me, and - no offense
> - I often discard them, though I may have a solution to propose.
> It's hard to understand if our answer was helpful or not, if some
> details should be changed etc...
> In one word I've got the feeling to give, but not to share.
> Maybe my english level is just too low, but you know, these lists are
> rather international.
> Sorry for the rant, but please, help us to help you.
>
> Back to the technical problem, did the updated version at
> http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
> did my words "not trivial" stopped you?
>
> Nicolas
>
> 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
>> Miguel,
>>
>> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
>>
>> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
>>
>> Bill
>>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> Sent: Wednesday, October 06, 2010 12:52 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
>>> Miguel,
>>>
>>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>>>
>>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>>>
>>
>> But in the end if you really need to use that call, either it works or
>> don't, you'll need to write it, even if someone says that it doesn't
>> work. Why, because you need it, and if you don't need it then your
>> question is rhetoric, because you don't even mind the answer.
>> You can't ask for advise for every and each step you take, most times
>> you should walk away, _fix_ what you find wrong and then report back the
>> fix. That would really make the archives more rich because you are
>> contributing back real knowledge and maybe code and not just polluting
>> the archives with threads that ask things but solve nothing for anyone
>> but you.
>>
>> Cheers
>>
>>
>>> Bill
>>>
>>>
>>>
>>> ________________________________________
>>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>>> Sent: Wednesday, October 06, 2010 12:13 PM
>>> To: [hidden email]
>>> Subject: Re: [Pharo-project] FFI number of arguments
>>>
>>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
>>> > Levente,
>>> >
>>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>>> >
>>>
>>> But Bill, almost all your questions are long and without apparent focus
>>> on the real point. Some other times are like this, things that you could
>>> easily test by yourself maybe in less time that takes you to write so
>>> many words, send the email and wait for a response from someone willing
>>> to decipher what the real problem is. Other times you point at problems
>>> that you find in your environment without giving better hints than "in a
>>> hopefully updated image", "in a, I think, not modified image", "in my
>>> machine", that doesn't help in helping you.
>>> Then you point some problems that it appears that are very evident to
>>> you and whose solution is also very obvious to you but you don't provide
>>> a fix for them neither, like the always topic of yours about sockets.
>>>
>>> Then when someone points and the  obvious things you should do (your
>>> homework, in verifying yourself what you are asking to the list) or to
>>> precise the information needed to better answer you, you respond upset
>>> as if anyone should be obliged to answer you or even read your mails.
>>>
>>> So, please, read
>>>
>>> http://www.catb.org/esr/faqs/smart-questions.html
>>>
>>> do your homework and then ask the list.
>>>
>>>
>>>
>>>
>>> >
>>> >
>>> >
>>> > ________________________________________
>>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>>> > Sent: Tuesday, October 05, 2010 11:09 PM
>>> > To: [hidden email]
>>> > Subject: Re: [Pharo-project] FFI number of arguments
>>> >
>>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>>> >
>>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>>> >
>>> > It works up to 128 arguments. But why don't you try it yourself?
>>> >
>>> >
>>> > Levente
>>> >
>>> > >
>>> > >
>>> > >
>>> > > ________________________________________
>>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>>> > > Sent: Tuesday, October 05, 2010 10:26 PM
>>> > > To: [hidden email]
>>> > > Subject: Re: [Pharo-project] FFI number of arguments
>>> > >
>>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>>> > >
>>> > >> Hello all,
>>> > >>
>>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>>> > >>
>>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>>> > >>
>>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>>> > >
>>> > > You can create your own function object and invoke it with an array.
>>> > > Here's an fprintf example on windows:
>>> > >
>>> > > fprintf := ExternalLibraryFunction
>>> > >        name: 'fprintf'
>>> > >        module: 'msvcrt.dll'
>>> > >        callType: ExternalFunction callTypeCDecl
>>> > >        returnType: ExternalType signedLong
>>> > >        argumentTypes: {
>>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
>>> > >                ExternalType string.
>>> > >                ExternalType signedLong }.
>>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
>>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>>> > > Stdio default fcloseWith: file.
>>> > >
>>> > >
>>> > > Levente
>>> > >
>>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
>>> > >
>>> > >>
>>> > >> Bill
>>> > >>
>>> > >>
>>> > >> _______________________________________________
>>> > >> Pharo-project mailing list
>>> > >> [hidden email]
>>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >>
>>> > >
>>> > > _______________________________________________
>>> > > Pharo-project mailing list
>>> > > [hidden email]
>>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >
>>> > > _______________________________________________
>>> > > Pharo-project mailing list
>>> > > [hidden email]
>>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >
>>> >
>>> > _______________________________________________
>>> > Pharo-project mailing list
>>> > [hidden email]
>>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >
>>> > _______________________________________________
>>> > Pharo-project mailing list
>>> > [hidden email]
>>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> --
>>> Miguel Cobá
>>> http://miguel.leugim.com.mx
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> --
>> Miguel Cobá
>> http://miguel.leugim.com.mx
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
It might still work at first try, though your initial presentation of it left me expecting something else.  Don't give up as quickly as you seem to think I do.  I will admit that the legend support in PLplot is not all that great to start, and it might not be worthy of heroic measures.  It is not even clear that it is finalized, though they seem resistant to changing what they have.  A clean way to go from a fraction of 0@0 extent:1@1 (aka a viewport) to a legend might be even more valuable.  I have already used viewports to good effect, so adding a legend based on them might be reasonable and not all that different from what I will be doing with R not too long from now.  Controlling text size can be problematic, which with a couple of other quirks is why I initially had high hopes for pllegend().

What PLplot does very nicely is plot "large" numbers of points from arrays of doubles.  For now, we are lacking in the infrastructure required to take advantage of that.  My solution so far is not ideal.



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
Sent: Wednesday, October 06, 2010 3:30 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> Nicolas,
>
> The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).
>

Well, it might have worked at first try, or not... At least that would
be a valuable information.
You could even have enrolled me in helping a port to Pharo, my time is
scarse, but it's free.
If you have a simple solution, that's OK, but I just wonder why you
asked this list.
If you don't take our answers into account, then we're in a dead-end.
No feedback, no win-win cycle.
If it's just to diiscuss technical merit of whatever solution, without
a line of code to share, then it's gonna get too abstract to interest
many of us.
Beware to not dry the sources.

Cheers

Nicolas

> If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:
>
> (1) call the function as designed (hence my question)
> (2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
> (3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.
>
> Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.
>
> Bill
>
>
> http://plplot.sourceforge.net/examples.php?demo=26
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> Sent: Wednesday, October 06, 2010 2:31 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> Hi Bill,
> I somehow share some of Miguel impressions.
> Some (most) of your messages are too verbose for me, and - no offense
> - I often discard them, though I may have a solution to propose.
> It's hard to understand if our answer was helpful or not, if some
> details should be changed etc...
> In one word I've got the feeling to give, but not to share.
> Maybe my english level is just too low, but you know, these lists are
> rather international.
> Sorry for the rant, but please, help us to help you.
>
> Back to the technical problem, did the updated version at
> http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
> did my words "not trivial" stopped you?
>
> Nicolas
>
> 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
>> Miguel,
>>
>> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
>>
>> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
>>
>> Bill
>>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> Sent: Wednesday, October 06, 2010 12:52 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
>>> Miguel,
>>>
>>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>>>
>>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>>>
>>
>> But in the end if you really need to use that call, either it works or
>> don't, you'll need to write it, even if someone says that it doesn't
>> work. Why, because you need it, and if you don't need it then your
>> question is rhetoric, because you don't even mind the answer.
>> You can't ask for advise for every and each step you take, most times
>> you should walk away, _fix_ what you find wrong and then report back the
>> fix. That would really make the archives more rich because you are
>> contributing back real knowledge and maybe code and not just polluting
>> the archives with threads that ask things but solve nothing for anyone
>> but you.
>>
>> Cheers
>>
>>
>>> Bill
>>>
>>>
>>>
>>> ________________________________________
>>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>>> Sent: Wednesday, October 06, 2010 12:13 PM
>>> To: [hidden email]
>>> Subject: Re: [Pharo-project] FFI number of arguments
>>>
>>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
>>> > Levente,
>>> >
>>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>>> >
>>>
>>> But Bill, almost all your questions are long and without apparent focus
>>> on the real point. Some other times are like this, things that you could
>>> easily test by yourself maybe in less time that takes you to write so
>>> many words, send the email and wait for a response from someone willing
>>> to decipher what the real problem is. Other times you point at problems
>>> that you find in your environment without giving better hints than "in a
>>> hopefully updated image", "in a, I think, not modified image", "in my
>>> machine", that doesn't help in helping you.
>>> Then you point some problems that it appears that are very evident to
>>> you and whose solution is also very obvious to you but you don't provide
>>> a fix for them neither, like the always topic of yours about sockets.
>>>
>>> Then when someone points and the  obvious things you should do (your
>>> homework, in verifying yourself what you are asking to the list) or to
>>> precise the information needed to better answer you, you respond upset
>>> as if anyone should be obliged to answer you or even read your mails.
>>>
>>> So, please, read
>>>
>>> http://www.catb.org/esr/faqs/smart-questions.html
>>>
>>> do your homework and then ask the list.
>>>
>>>
>>>
>>>
>>> >
>>> >
>>> >
>>> > ________________________________________
>>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>>> > Sent: Tuesday, October 05, 2010 11:09 PM
>>> > To: [hidden email]
>>> > Subject: Re: [Pharo-project] FFI number of arguments
>>> >
>>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>>> >
>>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>>> >
>>> > It works up to 128 arguments. But why don't you try it yourself?
>>> >
>>> >
>>> > Levente
>>> >
>>> > >
>>> > >
>>> > >
>>> > > ________________________________________
>>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>>> > > Sent: Tuesday, October 05, 2010 10:26 PM
>>> > > To: [hidden email]
>>> > > Subject: Re: [Pharo-project] FFI number of arguments
>>> > >
>>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>>> > >
>>> > >> Hello all,
>>> > >>
>>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>>> > >>
>>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>>> > >>
>>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>>> > >
>>> > > You can create your own function object and invoke it with an array.
>>> > > Here's an fprintf example on windows:
>>> > >
>>> > > fprintf := ExternalLibraryFunction
>>> > >        name: 'fprintf'
>>> > >        module: 'msvcrt.dll'
>>> > >        callType: ExternalFunction callTypeCDecl
>>> > >        returnType: ExternalType signedLong
>>> > >        argumentTypes: {
>>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
>>> > >                ExternalType string.
>>> > >                ExternalType signedLong }.
>>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
>>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>>> > > Stdio default fcloseWith: file.
>>> > >
>>> > >
>>> > > Levente
>>> > >
>>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
>>> > >
>>> > >>
>>> > >> Bill
>>> > >>
>>> > >>
>>> > >> _______________________________________________
>>> > >> Pharo-project mailing list
>>> > >> [hidden email]
>>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >>
>>> > >
>>> > > _______________________________________________
>>> > > Pharo-project mailing list
>>> > > [hidden email]
>>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >
>>> > > _______________________________________________
>>> > > Pharo-project mailing list
>>> > > [hidden email]
>>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> > >
>>> >
>>> > _______________________________________________
>>> > Pharo-project mailing list
>>> > [hidden email]
>>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >
>>> > _______________________________________________
>>> > Pharo-project mailing list
>>> > [hidden email]
>>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> --
>>> Miguel Cobá
>>> http://miguel.leugim.com.mx
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> --
>> Miguel Cobá
>> http://miguel.leugim.com.mx
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Miguel Cobá
El mié, 06-10-2010 a las 16:08 -0400, Schwab,Wilhelm K escribió:
> It might still work at first try, though your initial presentation of it left me expecting something else.  Don't give up as quickly as you seem to think I do.  I will admit that the legend support in PLplot is not all that great to start, and it might not be worthy of heroic measures.  It is not even clear that it is finalized, though they seem resistant to changing what they have.  A clean way to go from a fraction of 0@0 extent:1@1 (aka a viewport) to a legend might be even more valuable.  I have already used viewports to good effect, so adding a legend based on them might be reasonable and not all that different from what I will be doing with R not too long from now.  Controlling text size can be problematic, which with a couple of other quirks is why I initially had high hopes for pllegend().
>
> What PLplot does very nicely is plot "large" numbers of points from arrays of doubles.  For now, we are lacking in the infrastructure required to take advantage of that.  My solution so far is not ideal.
>

Sorry but when reading those types of emails sometimes I ask myself if I
am not victim of a prank and lose to the Turing machine test and the
mails were really generated automatically from a computer or some kind
of Eliza software.

What are you talking about Bill? And what has that to do with the words
and the very reasonable points that Nicolas expresed in the mail you are
responding to?


>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> Sent: Wednesday, October 06, 2010 3:30 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> > Nicolas,
> >
> > The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).
> >
>
> Well, it might have worked at first try, or not... At least that would
> be a valuable information.
> You could even have enrolled me in helping a port to Pharo, my time is
> scarse, but it's free.
> If you have a simple solution, that's OK, but I just wonder why you
> asked this list.
> If you don't take our answers into account, then we're in a dead-end.
> No feedback, no win-win cycle.
> If it's just to diiscuss technical merit of whatever solution, without
> a line of code to share, then it's gonna get too abstract to interest
> many of us.
> Beware to not dry the sources.
>
> Cheers
>
> Nicolas
>
> > If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:
> >
> > (1) call the function as designed (hence my question)
> > (2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
> > (3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.
> >
> > Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.
> >
> > Bill
> >
> >
> > http://plplot.sourceforge.net/examples.php?demo=26
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> > Sent: Wednesday, October 06, 2010 2:31 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > Hi Bill,
> > I somehow share some of Miguel impressions.
> > Some (most) of your messages are too verbose for me, and - no offense
> > - I often discard them, though I may have a solution to propose.
> > It's hard to understand if our answer was helpful or not, if some
> > details should be changed etc...
> > In one word I've got the feeling to give, but not to share.
> > Maybe my english level is just too low, but you know, these lists are
> > rather international.
> > Sorry for the rant, but please, help us to help you.
> >
> > Back to the technical problem, did the updated version at
> > http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
> > did my words "not trivial" stopped you?
> >
> > Nicolas
> >
> > 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> >> Miguel,
> >>
> >> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
> >>
> >> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
> >>
> >> Bill
> >>
> >>
> >>
> >> ________________________________________
> >> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> >> Sent: Wednesday, October 06, 2010 12:52 PM
> >> To: [hidden email]
> >> Subject: Re: [Pharo-project] FFI number of arguments
> >>
> >> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> >>> Miguel,
> >>>
> >>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
> >>>
> >>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
> >>>
> >>
> >> But in the end if you really need to use that call, either it works or
> >> don't, you'll need to write it, even if someone says that it doesn't
> >> work. Why, because you need it, and if you don't need it then your
> >> question is rhetoric, because you don't even mind the answer.
> >> You can't ask for advise for every and each step you take, most times
> >> you should walk away, _fix_ what you find wrong and then report back the
> >> fix. That would really make the archives more rich because you are
> >> contributing back real knowledge and maybe code and not just polluting
> >> the archives with threads that ask things but solve nothing for anyone
> >> but you.
> >>
> >> Cheers
> >>
> >>
> >>> Bill
> >>>
> >>>
> >>>
> >>> ________________________________________
> >>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> >>> Sent: Wednesday, October 06, 2010 12:13 PM
> >>> To: [hidden email]
> >>> Subject: Re: [Pharo-project] FFI number of arguments
> >>>
> >>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> >>> > Levente,
> >>> >
> >>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >>> >
> >>>
> >>> But Bill, almost all your questions are long and without apparent focus
> >>> on the real point. Some other times are like this, things that you could
> >>> easily test by yourself maybe in less time that takes you to write so
> >>> many words, send the email and wait for a response from someone willing
> >>> to decipher what the real problem is. Other times you point at problems
> >>> that you find in your environment without giving better hints than "in a
> >>> hopefully updated image", "in a, I think, not modified image", "in my
> >>> machine", that doesn't help in helping you.
> >>> Then you point some problems that it appears that are very evident to
> >>> you and whose solution is also very obvious to you but you don't provide
> >>> a fix for them neither, like the always topic of yours about sockets.
> >>>
> >>> Then when someone points and the  obvious things you should do (your
> >>> homework, in verifying yourself what you are asking to the list) or to
> >>> precise the information needed to better answer you, you respond upset
> >>> as if anyone should be obliged to answer you or even read your mails.
> >>>
> >>> So, please, read
> >>>
> >>> http://www.catb.org/esr/faqs/smart-questions.html
> >>>
> >>> do your homework and then ask the list.
> >>>
> >>>
> >>>
> >>>
> >>> >
> >>> >
> >>> >
> >>> > ________________________________________
> >>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> >>> > Sent: Tuesday, October 05, 2010 11:09 PM
> >>> > To: [hidden email]
> >>> > Subject: Re: [Pharo-project] FFI number of arguments
> >>> >
> >>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >>> >
> >>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >>> >
> >>> > It works up to 128 arguments. But why don't you try it yourself?
> >>> >
> >>> >
> >>> > Levente
> >>> >
> >>> > >
> >>> > >
> >>> > >
> >>> > > ________________________________________
> >>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> >>> > > Sent: Tuesday, October 05, 2010 10:26 PM
> >>> > > To: [hidden email]
> >>> > > Subject: Re: [Pharo-project] FFI number of arguments
> >>> > >
> >>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >>> > >
> >>> > >> Hello all,
> >>> > >>
> >>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> >>> > >>
> >>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> >>> > >>
> >>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> >>> > >
> >>> > > You can create your own function object and invoke it with an array.
> >>> > > Here's an fprintf example on windows:
> >>> > >
> >>> > > fprintf := ExternalLibraryFunction
> >>> > >        name: 'fprintf'
> >>> > >        module: 'msvcrt.dll'
> >>> > >        callType: ExternalFunction callTypeCDecl
> >>> > >        returnType: ExternalType signedLong
> >>> > >        argumentTypes: {
> >>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> >>> > >                ExternalType string.
> >>> > >                ExternalType signedLong }.
> >>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> >>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> >>> > > Stdio default fcloseWith: file.
> >>> > >
> >>> > >
> >>> > > Levente
> >>> > >
> >>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> >>> > >
> >>> > >>
> >>> > >> Bill
> >>> > >>
> >>> > >>
> >>> > >> _______________________________________________
> >>> > >> Pharo-project mailing list
> >>> > >> [hidden email]
> >>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >>
> >>> > >
> >>> > > _______________________________________________
> >>> > > Pharo-project mailing list
> >>> > > [hidden email]
> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >
> >>> > > _______________________________________________
> >>> > > Pharo-project mailing list
> >>> > > [hidden email]
> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >
> >>> >
> >>> > _______________________________________________
> >>> > Pharo-project mailing list
> >>> > [hidden email]
> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> >
> >>> > _______________________________________________
> >>> > Pharo-project mailing list
> >>> > [hidden email]
> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>>
> >>> --
> >>> Miguel Cobá
> >>> http://miguel.leugim.com.mx
> >>>
> >>>
> >>> _______________________________________________
> >>> Pharo-project mailing list
> >>> [hidden email]
> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>>
> >>> _______________________________________________
> >>> Pharo-project mailing list
> >>> [hidden email]
> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >> --
> >> Miguel Cobá
> >> http://miguel.leugim.com.mx
> >>
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Schwab,Wilhelm K
What I am saying to him is that the decision of whether or not to wrap pllegend() is complicated, so whether or not I adopt his proposed solution will probably be more about the relevance of pllegend() to those funding my efforts than the technical merits of what he suggests.



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
Sent: Wednesday, October 06, 2010 4:21 PM
To: [hidden email]
Subject: Re: [Pharo-project] FFI number of arguments

El mié, 06-10-2010 a las 16:08 -0400, Schwab,Wilhelm K escribió:
> It might still work at first try, though your initial presentation of it left me expecting something else.  Don't give up as quickly as you seem to think I do.  I will admit that the legend support in PLplot is not all that great to start, and it might not be worthy of heroic measures.  It is not even clear that it is finalized, though they seem resistant to changing what they have.  A clean way to go from a fraction of 0@0 extent:1@1 (aka a viewport) to a legend might be even more valuable.  I have already used viewports to good effect, so adding a legend based on them might be reasonable and not all that different from what I will be doing with R not too long from now.  Controlling text size can be problematic, which with a couple of other quirks is why I initially had high hopes for pllegend().
>
> What PLplot does very nicely is plot "large" numbers of points from arrays of doubles.  For now, we are lacking in the infrastructure required to take advantage of that.  My solution so far is not ideal.
>

Sorry but when reading those types of emails sometimes I ask myself if I
am not victim of a prank and lose to the Turing machine test and the
mails were really generated automatically from a computer or some kind
of Eliza software.

What are you talking about Bill? And what has that to do with the words
and the very reasonable points that Nicolas expresed in the mail you are
responding to?


>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> Sent: Wednesday, October 06, 2010 3:30 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> > Nicolas,
> >
> > The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).
> >
>
> Well, it might have worked at first try, or not... At least that would
> be a valuable information.
> You could even have enrolled me in helping a port to Pharo, my time is
> scarse, but it's free.
> If you have a simple solution, that's OK, but I just wonder why you
> asked this list.
> If you don't take our answers into account, then we're in a dead-end.
> No feedback, no win-win cycle.
> If it's just to diiscuss technical merit of whatever solution, without
> a line of code to share, then it's gonna get too abstract to interest
> many of us.
> Beware to not dry the sources.
>
> Cheers
>
> Nicolas
>
> > If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:
> >
> > (1) call the function as designed (hence my question)
> > (2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
> > (3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.
> >
> > Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.
> >
> > Bill
> >
> >
> > http://plplot.sourceforge.net/examples.php?demo=26
> >
> >
> >
> > ________________________________________
> > From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
> > Sent: Wednesday, October 06, 2010 2:31 PM
> > To: [hidden email]
> > Subject: Re: [Pharo-project] FFI number of arguments
> >
> > Hi Bill,
> > I somehow share some of Miguel impressions.
> > Some (most) of your messages are too verbose for me, and - no offense
> > - I often discard them, though I may have a solution to propose.
> > It's hard to understand if our answer was helpful or not, if some
> > details should be changed etc...
> > In one word I've got the feeling to give, but not to share.
> > Maybe my english level is just too low, but you know, these lists are
> > rather international.
> > Sorry for the rant, but please, help us to help you.
> >
> > Back to the technical problem, did the updated version at
> > http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
> > did my words "not trivial" stopped you?
> >
> > Nicolas
> >
> > 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
> >> Miguel,
> >>
> >> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
> >>
> >> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
> >>
> >> Bill
> >>
> >>
> >>
> >> ________________________________________
> >> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> >> Sent: Wednesday, October 06, 2010 12:52 PM
> >> To: [hidden email]
> >> Subject: Re: [Pharo-project] FFI number of arguments
> >>
> >> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
> >>> Miguel,
> >>>
> >>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
> >>>
> >>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
> >>>
> >>
> >> But in the end if you really need to use that call, either it works or
> >> don't, you'll need to write it, even if someone says that it doesn't
> >> work. Why, because you need it, and if you don't need it then your
> >> question is rhetoric, because you don't even mind the answer.
> >> You can't ask for advise for every and each step you take, most times
> >> you should walk away, _fix_ what you find wrong and then report back the
> >> fix. That would really make the archives more rich because you are
> >> contributing back real knowledge and maybe code and not just polluting
> >> the archives with threads that ask things but solve nothing for anyone
> >> but you.
> >>
> >> Cheers
> >>
> >>
> >>> Bill
> >>>
> >>>
> >>>
> >>> ________________________________________
> >>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> >>> Sent: Wednesday, October 06, 2010 12:13 PM
> >>> To: [hidden email]
> >>> Subject: Re: [Pharo-project] FFI number of arguments
> >>>
> >>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
> >>> > Levente,
> >>> >
> >>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
> >>> >
> >>>
> >>> But Bill, almost all your questions are long and without apparent focus
> >>> on the real point. Some other times are like this, things that you could
> >>> easily test by yourself maybe in less time that takes you to write so
> >>> many words, send the email and wait for a response from someone willing
> >>> to decipher what the real problem is. Other times you point at problems
> >>> that you find in your environment without giving better hints than "in a
> >>> hopefully updated image", "in a, I think, not modified image", "in my
> >>> machine", that doesn't help in helping you.
> >>> Then you point some problems that it appears that are very evident to
> >>> you and whose solution is also very obvious to you but you don't provide
> >>> a fix for them neither, like the always topic of yours about sockets.
> >>>
> >>> Then when someone points and the  obvious things you should do (your
> >>> homework, in verifying yourself what you are asking to the list) or to
> >>> precise the information needed to better answer you, you respond upset
> >>> as if anyone should be obliged to answer you or even read your mails.
> >>>
> >>> So, please, read
> >>>
> >>> http://www.catb.org/esr/faqs/smart-questions.html
> >>>
> >>> do your homework and then ask the list.
> >>>
> >>>
> >>>
> >>>
> >>> >
> >>> >
> >>> >
> >>> > ________________________________________
> >>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> >>> > Sent: Tuesday, October 05, 2010 11:09 PM
> >>> > To: [hidden email]
> >>> > Subject: Re: [Pharo-project] FFI number of arguments
> >>> >
> >>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >>> >
> >>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
> >>> >
> >>> > It works up to 128 arguments. But why don't you try it yourself?
> >>> >
> >>> >
> >>> > Levente
> >>> >
> >>> > >
> >>> > >
> >>> > >
> >>> > > ________________________________________
> >>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
> >>> > > Sent: Tuesday, October 05, 2010 10:26 PM
> >>> > > To: [hidden email]
> >>> > > Subject: Re: [Pharo-project] FFI number of arguments
> >>> > >
> >>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
> >>> > >
> >>> > >> Hello all,
> >>> > >>
> >>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
> >>> > >>
> >>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
> >>> > >>
> >>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
> >>> > >
> >>> > > You can create your own function object and invoke it with an array.
> >>> > > Here's an fprintf example on windows:
> >>> > >
> >>> > > fprintf := ExternalLibraryFunction
> >>> > >        name: 'fprintf'
> >>> > >        module: 'msvcrt.dll'
> >>> > >        callType: ExternalFunction callTypeCDecl
> >>> > >        returnType: ExternalType signedLong
> >>> > >        argumentTypes: {
> >>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
> >>> > >                ExternalType string.
> >>> > >                ExternalType signedLong }.
> >>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
> >>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
> >>> > > Stdio default fcloseWith: file.
> >>> > >
> >>> > >
> >>> > > Levente
> >>> > >
> >>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
> >>> > >
> >>> > >>
> >>> > >> Bill
> >>> > >>
> >>> > >>
> >>> > >> _______________________________________________
> >>> > >> Pharo-project mailing list
> >>> > >> [hidden email]
> >>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >>
> >>> > >
> >>> > > _______________________________________________
> >>> > > Pharo-project mailing list
> >>> > > [hidden email]
> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >
> >>> > > _______________________________________________
> >>> > > Pharo-project mailing list
> >>> > > [hidden email]
> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> > >
> >>> >
> >>> > _______________________________________________
> >>> > Pharo-project mailing list
> >>> > [hidden email]
> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>> >
> >>> > _______________________________________________
> >>> > Pharo-project mailing list
> >>> > [hidden email]
> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>>
> >>> --
> >>> Miguel Cobá
> >>> http://miguel.leugim.com.mx
> >>>
> >>>
> >>> _______________________________________________
> >>> Pharo-project mailing list
> >>> [hidden email]
> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>>
> >>> _______________________________________________
> >>> Pharo-project mailing list
> >>> [hidden email]
> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >> --
> >> Miguel Cobá
> >> http://miguel.leugim.com.mx
> >>
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> [hidden email]
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >>
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
Miguel Cobá
http://miguel.leugim.com.mx


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI number of arguments

Nicolas Cellier
Bill,
that was not obvious... and is probably not helpful to me.
At least, Miguel's response was funny.
Thank you for provoking that, I owe you a smile :)

Nicolas

2010/10/6 Schwab,Wilhelm K <[hidden email]>:

> What I am saying to him is that the decision of whether or not to wrap pllegend() is complicated, so whether or not I adopt his proposed solution will probably be more about the relevance of pllegend() to those funding my efforts than the technical merits of what he suggests.
>
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
> Sent: Wednesday, October 06, 2010 4:21 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] FFI number of arguments
>
> El mié, 06-10-2010 a las 16:08 -0400, Schwab,Wilhelm K escribió:
>> It might still work at first try, though your initial presentation of it left me expecting something else.  Don't give up as quickly as you seem to think I do.  I will admit that the legend support in PLplot is not all that great to start, and it might not be worthy of heroic measures.  It is not even clear that it is finalized, though they seem resistant to changing what they have.  A clean way to go from a fraction of 0@0 extent:1@1 (aka a viewport) to a legend might be even more valuable.  I have already used viewports to good effect, so adding a legend based on them might be reasonable and not all that different from what I will be doing with R not too long from now.  Controlling text size can be problematic, which with a couple of other quirks is why I initially had high hopes for pllegend().
>>
>> What PLplot does very nicely is plot "large" numbers of points from arrays of doubles.  For now, we are lacking in the infrastructure required to take advantage of that.  My solution so far is not ideal.
>>
>
> Sorry but when reading those types of emails sometimes I ask myself if I
> am not victim of a prank and lose to the Turing machine test and the
> mails were really generated automatically from a computer or some kind
> of Eliza software.
>
> What are you talking about Bill? And what has that to do with the words
> and the very reasonable points that Nicolas expresed in the mail you are
> responding to?
>
>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
>> Sent: Wednesday, October 06, 2010 3:30 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] FFI number of arguments
>>
>> 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
>> > Nicolas,
>> >
>> > The "not trivial" did indeed reduce my interest.  I can get around it for my own needs far more easily than taking a detour.  If a detour is required, then economics will all but force me to take the more sensible path.  The question is whether you get a PLplot interface with or without legend support.  I get it either way.  So much for this mattering only to me (not directed at you).
>> >
>>
>> Well, it might have worked at first try, or not... At least that would
>> be a valuable information.
>> You could even have enrolled me in helping a port to Pharo, my time is
>> scarse, but it's free.
>> If you have a simple solution, that's OK, but I just wonder why you
>> asked this list.
>> If you don't take our answers into account, then we're in a dead-end.
>> No feedback, no win-win cycle.
>> If it's just to diiscuss technical merit of whatever solution, without
>> a line of code to share, then it's gonna get too abstract to interest
>> many of us.
>> Beware to not dry the sources.
>>
>> Cheers
>>
>> Nicolas
>>
>> > If you look on the PLplot lists, you will find some discussion of the function's design; IMHO, it's not optimal.  However, as most things in PLplot, it works; see link below.  The options are:
>> >
>> > (1) call the function as designed (hence my question)
>> > (2) use a viewport to make a new coordinate system inside the graph and draw "the hard way" relative to it
>> > (3) wrap pllegend() in a .so of my own; five minutes later, I'm calling a restricted functionality version with defaults of value to me.
>> >
>> > Even I am not thrilled about (3), if only because of linking hassles from my .so to theirs, but it would be quick.  (2) is questionable.  I have used viewports very successfully to make grids of related graphs and to do limited versions of what gnuplot does with "y2."  In this case, it has the potential to turn into a bit of a time sink, and then the question arises "why am I doing it?"  If it is just to spread around the benefits of legend support, I probably have to rethink it.  If it is better for all of us ("us" is complicated), then it's on the table.
>> >
>> > Bill
>> >
>> >
>> > http://plplot.sourceforge.net/examples.php?demo=26
>> >
>> >
>> >
>> > ________________________________________
>> > From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]]
>> > Sent: Wednesday, October 06, 2010 2:31 PM
>> > To: [hidden email]
>> > Subject: Re: [Pharo-project] FFI number of arguments
>> >
>> > Hi Bill,
>> > I somehow share some of Miguel impressions.
>> > Some (most) of your messages are too verbose for me, and - no offense
>> > - I often discard them, though I may have a solution to propose.
>> > It's hard to understand if our answer was helpful or not, if some
>> > details should be changed etc...
>> > In one word I've got the feeling to give, but not to share.
>> > Maybe my english level is just too low, but you know, these lists are
>> > rather international.
>> > Sorry for the rant, but please, help us to help you.
>> >
>> > Back to the technical problem, did the updated version at
>> > http://www.squeaksource.com/Smallapack/Compiler-nice.150.mcz help, or
>> > did my words "not trivial" stopped you?
>> >
>> > Nicolas
>> >
>> > 2010/10/6 Schwab,Wilhelm K <[hidden email]>:
>> >> Miguel,
>> >>
>> >> I do not "need" to make the call.  I am wondering whether I can do so in a way that will benefit others, or I should just say the hell with it and either provide similar functionality a different way or provide the same functionality via a .so of my own creation.  The latter is fine for me but does not do much for anyone else.
>> >>
>> >> And let's say I make it and the thing seg faults.  How can I tell the difference between a limitation of the plugin or a mistake on my part calling a fairly cumbersome function?  The answer: I can't, not without work that I cannot justify doing when a ready solution exists.
>> >>
>> >> Bill
>> >>
>> >>
>> >>
>> >> ________________________________________
>> >> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> >> Sent: Wednesday, October 06, 2010 12:52 PM
>> >> To: [hidden email]
>> >> Subject: Re: [Pharo-project] FFI number of arguments
>> >>
>> >> El mié, 06-10-2010 a las 12:33 -0400, Schwab,Wilhelm K escribió:
>> >>> Miguel,
>> >>>
>> >>> I see it very differently: I do extensive searches and summarize the results, dropping keywords along the way that I wish had been present in what I finally uncovered somewhere else.  The Pharo archives are then a more rich resource they than had been.  I happen to know it works, because many of the helpful messages I find are in fact mine.
>> >>>
>> >>> As for whether I could "easily" make the call in question: give me a break.  It has roughly 20 arguments, and would be a fair amount of work to set up.  If someone else knows one way or the other, it might trigger either a reply along the lines of  "yeah, I did ti with 30 arguments" or "I fell for that, the plugin choked on...."  Restating what I linked from another group is not helpful, nor is telling me how easy it would be to do something that you have never seen.  Did it occur to you that there might be pointer arguments that would be a potential sources of complexity?  You might read what I asked: "have you tried this?"  Not "please do this for me."  It would be wasteful to attempt the call without asking for scouting reports.
>> >>>
>> >>
>> >> But in the end if you really need to use that call, either it works or
>> >> don't, you'll need to write it, even if someone says that it doesn't
>> >> work. Why, because you need it, and if you don't need it then your
>> >> question is rhetoric, because you don't even mind the answer.
>> >> You can't ask for advise for every and each step you take, most times
>> >> you should walk away, _fix_ what you find wrong and then report back the
>> >> fix. That would really make the archives more rich because you are
>> >> contributing back real knowledge and maybe code and not just polluting
>> >> the archives with threads that ask things but solve nothing for anyone
>> >> but you.
>> >>
>> >> Cheers
>> >>
>> >>
>> >>> Bill
>> >>>
>> >>>
>> >>>
>> >>> ________________________________________
>> >>> From: [hidden email] [[hidden email]] On Behalf Of Miguel Cobá [[hidden email]]
>> >>> Sent: Wednesday, October 06, 2010 12:13 PM
>> >>> To: [hidden email]
>> >>> Subject: Re: [Pharo-project] FFI number of arguments
>> >>>
>> >>> El mié, 06-10-2010 a las 11:50 -0400, Schwab,Wilhelm K escribió:
>> >>> > Levente,
>> >>> >
>> >>> > What problem do you have with asking whether someone else has already tried it?  Really, have you not seen examples of working hard on advice from one source only to discover yet another limit that was not in fine print?
>> >>> >
>> >>>
>> >>> But Bill, almost all your questions are long and without apparent focus
>> >>> on the real point. Some other times are like this, things that you could
>> >>> easily test by yourself maybe in less time that takes you to write so
>> >>> many words, send the email and wait for a response from someone willing
>> >>> to decipher what the real problem is. Other times you point at problems
>> >>> that you find in your environment without giving better hints than "in a
>> >>> hopefully updated image", "in a, I think, not modified image", "in my
>> >>> machine", that doesn't help in helping you.
>> >>> Then you point some problems that it appears that are very evident to
>> >>> you and whose solution is also very obvious to you but you don't provide
>> >>> a fix for them neither, like the always topic of yours about sockets.
>> >>>
>> >>> Then when someone points and the  obvious things you should do (your
>> >>> homework, in verifying yourself what you are asking to the list) or to
>> >>> precise the information needed to better answer you, you respond upset
>> >>> as if anyone should be obliged to answer you or even read your mails.
>> >>>
>> >>> So, please, read
>> >>>
>> >>> http://www.catb.org/esr/faqs/smart-questions.html
>> >>>
>> >>> do your homework and then ask the list.
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> >
>> >>> >
>> >>> >
>> >>> > ________________________________________
>> >>> > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> >>> > Sent: Tuesday, October 05, 2010 11:09 PM
>> >>> > To: [hidden email]
>> >>> > Subject: Re: [Pharo-project] FFI number of arguments
>> >>> >
>> >>> > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> >>> >
>> >>> > > yes, that's what the link describes.  The open question is whether anyone has successfully done that with 15+ arguments?
>> >>> >
>> >>> > It works up to 128 arguments. But why don't you try it yourself?
>> >>> >
>> >>> >
>> >>> > Levente
>> >>> >
>> >>> > >
>> >>> > >
>> >>> > >
>> >>> > > ________________________________________
>> >>> > > From: [hidden email] [[hidden email]] On Behalf Of Levente Uzonyi [[hidden email]]
>> >>> > > Sent: Tuesday, October 05, 2010 10:26 PM
>> >>> > > To: [hidden email]
>> >>> > > Subject: Re: [Pharo-project] FFI number of arguments
>> >>> > >
>> >>> > > On Tue, 5 Oct 2010, Schwab,Wilhelm K wrote:
>> >>> > >
>> >>> > >> Hello all,
>> >>> > >>
>> >>> > >> I have been bumping into some functions with large numbers of arguments.  One in particular would be best handled in the image if at all possible.  The following might be the answer:
>> >>> > >>
>> >>> > >>   http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/98538/focus=98543
>> >>> > >>
>> >>> > >> Have any of you done this with >15 (or whatever the cutoff is) arguments?
>> >>> > >
>> >>> > > You can create your own function object and invoke it with an array.
>> >>> > > Here's an fprintf example on windows:
>> >>> > >
>> >>> > > fprintf := ExternalLibraryFunction
>> >>> > >        name: 'fprintf'
>> >>> > >        module: 'msvcrt.dll'
>> >>> > >        callType: ExternalFunction callTypeCDecl
>> >>> > >        returnType: ExternalType signedLong
>> >>> > >        argumentTypes: {
>> >>> > >                (ExternalType structTypeNamed: #FILE) asPointerType.
>> >>> > >                ExternalType string.
>> >>> > >                ExternalType signedLong }.
>> >>> > > file := Stdio default fopenWith: 'test.txt' with: 'w'.
>> >>> > > fprintf invokeWithArguments: { file. 'Your number is %d.'. 42 }.
>> >>> > > Stdio default fcloseWith: file.
>> >>> > >
>> >>> > >
>> >>> > > Levente
>> >>> > >
>> >>> > > P.S.: Note that you need the FILE and Stdio classes to run this example.
>> >>> > >
>> >>> > >>
>> >>> > >> Bill
>> >>> > >>
>> >>> > >>
>> >>> > >> _______________________________________________
>> >>> > >> Pharo-project mailing list
>> >>> > >> [hidden email]
>> >>> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>> > >>
>> >>> > >
>> >>> > > _______________________________________________
>> >>> > > Pharo-project mailing list
>> >>> > > [hidden email]
>> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>> > >
>> >>> > > _______________________________________________
>> >>> > > Pharo-project mailing list
>> >>> > > [hidden email]
>> >>> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>> > >
>> >>> >
>> >>> > _______________________________________________
>> >>> > Pharo-project mailing list
>> >>> > [hidden email]
>> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>> >
>> >>> > _______________________________________________
>> >>> > Pharo-project mailing list
>> >>> > [hidden email]
>> >>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>>
>> >>> --
>> >>> Miguel Cobá
>> >>> http://miguel.leugim.com.mx
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Pharo-project mailing list
>> >>> [hidden email]
>> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>>
>> >>> _______________________________________________
>> >>> Pharo-project mailing list
>> >>> [hidden email]
>> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>
>> >> --
>> >> Miguel Cobá
>> >> http://miguel.leugim.com.mx
>> >>
>> >>
>> >> _______________________________________________
>> >> Pharo-project mailing list
>> >> [hidden email]
>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>
>> >> _______________________________________________
>> >> Pharo-project mailing list
>> >> [hidden email]
>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project