Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 5 participants
- 50345 messages
[ANN] Traits installer/uninstaller utility
by Johan Fabry
Hi all,
this is a small package that I wrote after doing a traits-based refactoring of AspectMaps (Plug: Check out AspectMaps for a cool visualization of Aspects. http://pleiad.cl/aspectmaps. It has nice screencasts. All comments welcome!)
AspectMaps extends a number of classes of FAMIX to do its thing, using standard class extensions. This works OK when you are not using traits. But when using a trait, you need to redef the class, i.e. change the original package (in this case one of the moose packages). A big no-no. This kind of change should also be encapusulated in the AspectMaps package, but currently this is not possible. So, as long as traits and packages dont play well together, these kinds of refactorings are out.
However not so when you are using the TraitsApplication package. This package provides a means to programmatically install/uninstall traits. Call it in a post-load action on a package (if such a thing exists), in a class initialize method, et cetera (for AspectMaps I do it in the AspectMaps>>open method). I thought this could be useful to some members of the community so I am releasing it publicly. You can find it at http://www.squeaksource.com/TraitsApplication
CAVEAT: This is a quick implementation, it is non-optimal. It can be made much more elegant, but that requires time that I dont have right now :-(. I does not handle fancy trait compositions (yet). I give no guarantees other than that
1) it passes all of its tests
2) it works for me :-)
So check it out. Comments are welcome!
--
Johan Fabry
jfabry(a)dcc.uchile.cl - http://dcc.uchile.cl/~jfabry
PLEIAD Lab - Computer Science Department (DCC) - University of Chile
May 16, 2010
Need help with Alien, unexpected function return value
by Joachim Geidel
Hello everybody,
I need some help with Alien on Mac OS X 10.6.3 in Pharo 1.0. I am calling a
function from a vtable struct in the Java Native Interface of the Java VM
which comes with Mac OS X and which is defined as
jint ( __stdcall * GetVersion)(JNIEnv * env);
The result type jint is just an alias for int. The Smalltalk method is
----
primGetVersion
| functionPointer result vtablePointer |
vtablePointer := Alien
atAddress: self externalData asUnsignedLong
dataSize: Alien sizeofPointer * self vtableSize.
functionPointer := Alien forPointer:
(vtablePointer unsignedLongAt: (4 * Alien sizeofPointer + 1)).
result := (Alien newGC: 4) pointer.
functionPointer
primFFICallResult: result
with: self asJNIParameter.
^result signedIntAt: 1
----
functionPointer is the pointer to the GetVersion function.
The result should be 65542 (16r00010006), which is also what I get when
calling the function from VisualWorks, but the method answers -394042288
(-16r177C9BB0). The "result" Alien has the printString '#[0 0 0 0 6 0 1 0]'
which suspiciously contains the 1 and the 6 I am looking for, but in the
wrong places. ;-)
I looked at examples for callouts, which seem to indicate that result should
be the Alien and not a pointer to it. So I changed the code to
----
result := (Alien newC: 4).
functionPointer
primFFICallResult: result pointer
with: self asJNIParameter.
^result signedIntAt: 1
----
This didn't really help. The result is now 0 (zero), although the Alien
prints as #[252 255 255 255 80 15 38 0] which doesn't look like a 0 at first
sight.
Am I using those Aliens in a correct way? What can I try to debug this?
If this is too obscure and someone who knows about Aliens would like to have
a look at the rest of the code, I am willing to send a bunch of Monticello
packages and instructions for reproducing the problem, but I won't make it
publicly available yet.
Any help is welcome.
Best regards,
Joachim Geidel
--
View this message in context: http://forum.world.st/Need-help-with-Alien-unexpected-function-return-value…
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
May 15, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
On Sat, May 15, 2010 at 8:42 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
> Hi Mariano
>
> I now see that my solution (yesterday) was a hack.
>
hahhaha I though that when I read it ;)
But as I don't know how it is, I didn't say anything.
> John Macintosh' post (
> http://forum.world.st/Re-Pharo-users-Using-FFI-to-call-a-MacOs-System-funct…)
> shows how to do this properly.
> If I do something with this (ie gain real experience) then I'll look at
> working on the documentation.
>
>
Excellent!
> Cheers
>
> David
>
>
> On 14 May, 2010, at 20:16, Mariano Martinez Peck wrote:
>
>
>
>> Let us know your progress. Now...would you like to help us and document
>> all this in http://book.seaside.st/ ?
>>
>
>
> Sorry I mean http://book.pharo-project.org/ ;) too many books
>
>
>
>
>> We need to write all this down. Image the poor guy that comes after
>> you...imagine if someone already had this problem and you would have found
>> such info...wouldn't that be cool ? Don't worry for the English neither to
>> the text. It doesn't need to be perfect. This is continuous...we first
>> write, and then the community will give feedback, correct it, complete it,
>> etc...
>>
>> If you want to join, please let us know and we generate a user for you.
>>
>> Cheers
>>
>> Mariano
>>
>> Cheers
>>>
>>> David
>>>
>>>
>>>
>>>
>>>
>>> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>>>
>>> BTW....keyboards seems to be a .h (a header) , but not a library...at
>>> least in my mac
>>>
>>> Do you have also the library ? I am still newbie with the Mac OS :(
>>>
>>> Cheers
>>>
>>> mariano
>>>
>>> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
>>> marianopeck(a)gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
>>>>> and I'm trying to use FFI to access an MacOs system function:
>>>>>
>>>>>
>>>> Hi and welcome!
>>>>
>>>>
>>>>> apiKLGetKeyboardLayoutCount
>>>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
>>>>> 'keyboards'>
>>>>> ^ self externalCallFailed.
>>>>>
>>>>> I get an error "'Unable to find function address'" which seems to say
>>>>> the OS-module "keyboards" can't be found.
>>>>>
>>>>
>>>> Exactly. That's the problem.
>>>>
>>>>
>>>>> I can't figure out what the address should be.
>>>>> The function is defined here:
>>>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>>>
>>>>>
>>>> But you see the library in your computer, isn't it ? I mean, it is
>>>> there, but FFI doesn't find it ?
>>>>
>>>>
>>>>
>>>>> I'm not sure if I'm using FFI correctly, do I have to somehow include
>>>>> the external library in the Pharo VM?
>>>>>
>>>>
>>>> No, you shouldn't need to do that. However, you can try to put them
>>>> there just to see if that's the problem. I think that at some point (depends
>>>> on an order) the library is searched in the same place where you are calling
>>>> from. So, yes, do a test, but just a test. It should work without doing
>>>> that.
>>>>
>>>> How did you install FFI ? Which Pharo VM and image versions are you
>>>> using ?
>>>>
>>>> Can anyone help?
>>>>>
>>>>>
>>>> I would like too, but I don't have such library.
>>>>
>>>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>>>> website, some people experimented similar problems.
>>>> Please take a look to the title "Problems with Mac OS:" of the
>>>> following link:
>>>>
>>>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>>>
>>>> I also cc'ed people that can help you.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>>
>>>> I'm looked for FFI examples, but don't find anything helpful.
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-users mailing list
>>>>> Pharo-users(a)lists.gforge.inria.fr
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>>
>>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
May 15, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by David Wilson
Hi Mariano
I now see that my solution (yesterday) was a hack.
John Macintosh' post (http://forum.world.st/Re-Pharo-users-Using-FFI-
to-call-a-MacOs-System-function-tt2131691.html#a2217998) shows how to
do this properly.
If I do something with this (ie gain real experience) then I'll look
at working on the documentation.
Cheers
David
On 14 May, 2010, at 20:16, Mariano Martinez Peck wrote:
Let us know your progress. Now...would you like to help us and
document all this in http://book.seaside.st/ ?
Sorry I mean http://book.pharo-project.org/ ;) too many books
We need to write all this down. Image the poor guy that comes after
you...imagine if someone already had this problem and you would have
found such info...wouldn't that be cool ? Don't worry for the
English neither to the text. It doesn't need to be perfect. This is
continuous...we first write, and then the community will give
feedback, correct it, complete it, etc...
If you want to join, please let us know and we generate a user for you.
Cheers
Mariano
Cheers
David
On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
BTW....keyboards seems to be a .h (a header) , but not a
library...at least in my mac
Do you have also the library ? I am still newbie with the Mac OS :(
Cheers
mariano
On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck
<marianopeck(a)gmail.com> wrote:
On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>
wrote:
Hi
I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
and I'm trying to use FFI to access an MacOs system function:
Hi and welcome!
apiKLGetKeyboardLayoutCount
< cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
'keyboards'>
^ self externalCallFailed.
I get an error "'Unable to find function address'" which seems to say
the OS-module "keyboards" can't be found.
Exactly. That's the problem.
I can't figure out what the address should be.
The function is defined here: http://developer.apple.com/legacy/mac/
library/documentation/Carbon/Reference/KeyboardLayoutServices/
Reference/reference.html
(yes, it's deprecated, I have a very old mac runnning 10.4).
But you see the library in your computer, isn't it ? I mean, it is
there, but FFI doesn't find it ?
I'm not sure if I'm using FFI correctly, do I have to somehow include
the external library in the Pharo VM?
No, you shouldn't need to do that. However, you can try to put them
there just to see if that's the problem. I think that at some point
(depends on an order) the library is searched in the same place where
you are calling from. So, yes, do a test, but just a test. It should
work without doing that.
How did you install FFI ? Which Pharo VM and image versions are you
using ?
Can anyone help?
I would like too, but I don't have such library.
I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
website, some people experimented similar problems.
Please take a look to the title "Problems with Mac OS:" of the
following link:
http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
I also cc'ed people that can help you.
Cheers
Mariano
I'm looked for FFI examples, but don't find anything helpful.
David
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
May 15, 2010
Re: [Pharo-users] Resolving some dependencies...
by Mariano Martinez Peck
Done. Check http://www.squeaksource.com/PharoMorphicExtras.html
On Wed, May 12, 2010 at 10:08 PM, Stéphane Ducasse <
stephane.ducasse(a)inria.fr> wrote:
> We should edit the project wiki to say that and also the status to private
> so that PharoMorphicExtras is just
> there for archival purposes.
>
> Setf
>
> On May 12, 2010, at 5:18 PM, Mariano Martinez Peck wrote:
>
> > Carla: some time ago with stef we moved the working packages form
> http://www.squeaksource.com/PharoMorphicExtras to
> >
> > http://www.squeaksource.com/PharoNonCorePackages
> >
> > As you can see in PharoNonCorePackages it is no more MorphicExtras.
> > In addition, we did ConfigurationOfPharoMorphicExtras
> >
> > So please, from nowon, use that repository. And in case of changing
> something, commit it there, as the next dev images will use
> PharoNonCorePackages and not PharoMorphicExtras.
> >
> > Cheers
> >
> > Mariano
> >
> >
> > On Mon, May 10, 2010 at 7:15 PM, Stéphane Ducasse <
> stephane.ducasse(a)inria.fr> wrote:
> > ExtraMorphs?
> > On May 10, 2010, at 5:15 PM, Mariano Martinez Peck wrote:
> >
> > >
> > >
> > > On Mon, May 10, 2010 at 5:09 PM, Carla F. Griggio <
> carla.griggio(a)gmail.com> wrote:
> > > Uff, then... I'll have to do some work over this :)
> > >
> > > About MorphicExtras, if you say it's a lot of crap, I trust you.
> > >
> > > me too.
> > >
> > > But the name of ConfigurationOfPharoMorphicExtras suggests that it will
> load MorphicExtras (at least for me, because I had the package name 'Morphic
> Extras' stucked in my head when I found the metacello configuration) :$ So
> that might be a little confusing.
> > >
> > > That's exactly why I asked. Stef, Carla, do you have a better name for
> such configuration ?
> > >
> > > Cheers
> > >
> > > Mariano
> > >
> > >
> > >
> > > Thanks!
> > >
> > > Carla
> > >
> > >
> > > On Mon, May 10, 2010 at 8:03 AM, Stéphane Ducasse <
> stephane.ducasse(a)inria.fr> wrote:
> > > >
> > > > >
> > > > > PS: When I used ConfigurationOfPharoMorphicExtras, it loaded some
> Morphic packages but not the MorphicExtras package itself, I had to load it
> manually later. Is that OK?
> > > >
> > > > Yes because MorphicExtras-StephaneDucasse.144 is a dead package. It
> is full of crap or experimental code.
> > >
> > >
> > >
> > > >
> > > >
> > > > But anyway, I think she is right.
> > >
> > > she is not
> > >
> > > > The package MorphicExtras should be loaded, together with
> MorphExamplesAndDemos and LED, shouldn't it ?
> > >
> > > No it should NOT!
> > > Check the classes in there and you will see that you do NOT want that
> in your image. :)
> > > What I did was to extract the MorphExampleAndDemos where I cleaned the
> code made sure that the xamples
> > > are working......
> > >
> > > So MorphicExtras should just be there so that people can extract
> something that they would like to repackage. Period.
> > >
> > > >
> > > > Cheers
> > > >
> > > > mariano
> > > >
> > > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Pharo-users mailing list
> > > > > Pharo-users(a)lists.gforge.inria.fr
> > > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > > >
> > > >
> > > > _______________________________________________
> > > > Pharo-users mailing list
> > > > Pharo-users(a)lists.gforge.inria.fr
> > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > > >
> > > > _______________________________________________
> > > > Pharo-users mailing list
> > > > Pharo-users(a)lists.gforge.inria.fr
> > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> > >
> > >
> > > _______________________________________________
> > > Pharo-users mailing list
> > > Pharo-users(a)lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> >
> >
> > _______________________________________________
> > Pharo-users mailing list
> > Pharo-users(a)lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
> >
> > _______________________________________________
> > Pharo-users mailing list
> > Pharo-users(a)lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
May 14, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
>
> Let us know your progress. Now...would you like to help us and document all
> this in http://book.seaside.st/ ?
>
Sorry I mean http://book.pharo-project.org/ ;) too many books
> We need to write all this down. Image the poor guy that comes after
> you...imagine if someone already had this problem and you would have found
> such info...wouldn't that be cool ? Don't worry for the English neither to
> the text. It doesn't need to be perfect. This is continuous...we first
> write, and then the community will give feedback, correct it, complete it,
> etc...
>
> If you want to join, please let us know and we generate a user for you.
>
> Cheers
>
> Mariano
>
> Cheers
>>
>> David
>>
>>
>>
>>
>>
>> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>>
>> BTW....keyboards seems to be a .h (a header) , but not a library...at
>> least in my mac
>>
>> Do you have also the library ? I am still newbie with the Mac OS :(
>>
>> Cheers
>>
>> mariano
>>
>> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
>> marianopeck(a)gmail.com> wrote:
>>
>>>
>>>
>>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>wrote:
>>>
>>>> Hi
>>>>
>>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
>>>> and I'm trying to use FFI to access an MacOs system function:
>>>>
>>>>
>>> Hi and welcome!
>>>
>>>
>>>> apiKLGetKeyboardLayoutCount
>>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
>>>> 'keyboards'>
>>>> ^ self externalCallFailed.
>>>>
>>>> I get an error "'Unable to find function address'" which seems to say
>>>> the OS-module "keyboards" can't be found.
>>>>
>>>
>>> Exactly. That's the problem.
>>>
>>>
>>>> I can't figure out what the address should be.
>>>> The function is defined here:
>>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>>
>>>>
>>> But you see the library in your computer, isn't it ? I mean, it is there,
>>> but FFI doesn't find it ?
>>>
>>>
>>>
>>>> I'm not sure if I'm using FFI correctly, do I have to somehow include
>>>> the external library in the Pharo VM?
>>>>
>>>
>>> No, you shouldn't need to do that. However, you can try to put them there
>>> just to see if that's the problem. I think that at some point (depends on an
>>> order) the library is searched in the same place where you are calling from.
>>> So, yes, do a test, but just a test. It should work without doing that.
>>>
>>> How did you install FFI ? Which Pharo VM and image versions are you
>>> using ?
>>>
>>> Can anyone help?
>>>>
>>>>
>>> I would like too, but I don't have such library.
>>>
>>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>>> website, some people experimented similar problems.
>>> Please take a look to the title "Problems with Mac OS:" of the following
>>> link:
>>>
>>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>>
>>> I also cc'ed people that can help you.
>>>
>>> Cheers
>>>
>>> Mariano
>>>
>>>
>>> I'm looked for FFI examples, but don't find anything helpful.
>>>>
>>>> David
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-users mailing list
>>>> Pharo-users(a)lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>>
>>>
>>>
>> _______________________________________________
>> Pharo-users mailing list
>> Pharo-users(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>
>>
>> _______________________________________________
>> Pharo-users mailing list
>> Pharo-users(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>
>>
>
May 14, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by Mariano Martinez Peck
On Fri, May 14, 2010 at 7:04 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
> Hi Mariano
>
> Thanks for the tips, you got me on the right track. Some trial and lots of
> error got me to a solution.
>
>
Hi David. I am glad it worked.
> In order to use MacOs system calls you have to:
> 1) identify the function you want to use e.g. KLGetKeyboardLayoutCount
> 2) find out what header file this is defined in. here it's "Keyboards.h" in
> the Framework "Carbon/Carbon.h"
> So far it's easy from the Apple documentation
>
> 3) find out which Bundle this is in. I used Finder to find out where
> Keyboards.h is used, it's used in HIToolbox.framework
> 4) find the actual compiled framework, on my system it's at:
>
> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
> 5) I placed a copy of this file in the Pharo bundle at:
> Pharo-1.0.app/Contents/Resources/HIToolbox
>
> An the call looks like:
>
> apiKLGetKeyboardLayoutCount
> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module: 'HIToolbox'>
>
> ^ self externalCallFailed.
>
> I tried a link to the bundle, that didn't work.
> Probably the correct way to do this is to change Pharos RES path (in
> Pharo.sh) to include the a pointer to HIToolbox executable.
> I may try that if I go further with this than a prototype.
>
>
Let us know your progress. Now...would you like to help us and document all
this in http://book.seaside.st/ ?
We need to write all this down. Image the poor guy that comes after
you...imagine if someone already had this problem and you would have found
such info...wouldn't that be cool ? Don't worry for the English neither to
the text. It doesn't need to be perfect. This is continuous...we first
write, and then the community will give feedback, correct it, complete it,
etc...
If you want to join, please let us know and we generate a user for you.
Cheers
Mariano
Cheers
>
> David
>
>
>
>
>
> On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
>
> BTW....keyboards seems to be a .h (a header) , but not a library...at
> least in my mac
>
> Do you have also the library ? I am still newbie with the Mac OS :(
>
> Cheers
>
> mariano
>
> On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck <
> marianopeck(a)gmail.com> wrote:
>
>>
>>
>> On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch> wrote:
>>
>>> Hi
>>>
>>> I'm new to Pharo (although I was a Smalltalk programmer in the 90's), and
>>> I'm trying to use FFI to access an MacOs system function:
>>>
>>>
>> Hi and welcome!
>>
>>
>>> apiKLGetKeyboardLayoutCount
>>> < cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module: 'keyboards'>
>>> ^ self externalCallFailed.
>>>
>>> I get an error "'Unable to find function address'" which seems to say the
>>> OS-module "keyboards" can't be found.
>>>
>>
>> Exactly. That's the problem.
>>
>>
>>> I can't figure out what the address should be.
>>> The function is defined here:
>>> http://developer.apple.com/legacy/mac/library/documentation/Carbon/Referenc…
>>> (yes, it's deprecated, I have a very old mac runnning 10.4).
>>>
>>>
>> But you see the library in your computer, isn't it ? I mean, it is there,
>> but FFI doesn't find it ?
>>
>>
>>
>>> I'm not sure if I'm using FFI correctly, do I have to somehow include the
>>> external library in the Pharo VM?
>>>
>>
>> No, you shouldn't need to do that. However, you can try to put them there
>> just to see if that's the problem. I think that at some point (depends on an
>> order) the library is searched in the same place where you are calling from.
>> So, yes, do a test, but just a test. It should work without doing that.
>>
>> How did you install FFI ? Which Pharo VM and image versions are you using
>> ?
>>
>> Can anyone help?
>>>
>>>
>> I would like too, but I don't have such library.
>>
>> I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
>> website, some people experimented similar problems.
>> Please take a look to the title "Problems with Mac OS:" of the following
>> link:
>>
>> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>>
>> I also cc'ed people that can help you.
>>
>> Cheers
>>
>> Mariano
>>
>>
>> I'm looked for FFI examples, but don't find anything helpful.
>>>
>>> David
>>>
>>>
>>> _______________________________________________
>>> Pharo-users mailing list
>>> Pharo-users(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>
>>
>>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> Pharo-users(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
May 14, 2010
IWST 2010 CfP - Deadline Extension
by Michael Haupt
* apologies for multiple copies *
The submission deadline for the International Workshop on Smalltalk
Technologies (IWST) 2010 has been extended to June 18. Please find the
details below.
Call for Papers
International Workshop on Smalltalk Technologies (IWST) 2010
co-located with European Smalltalk User Group Conference (ESUG)
Barcelona, Spain, September 11-17, 2010
** Description
The goal of the IWST workshop series is to create and foster a forum
around advances or experience in Smalltalk. We welcome contributions
on all aspects, theoretical as well as practical, of Smalltalk-related
topics.
There are two possible kinds of submissions, which must be in ACM SIGPLAN style:
* Research papers (up to 10 pages). Submissions in this category will
be rigorously reviewed, and accepted papers will be published in the
ACM Digital Library (ACM SIGPLAN has approved, the final ACM approval
is pending).
* Demonstration papers (up to 4 pages). Submissions in this category
will not be published in the ACM Digital Library, but will be
available for download from the workshop web page.
** Submission and Reviewing Process
The EasyChair submission web site is at
http://www.easychair.org/conferences/?conf=iwst10.
Authors will be given the opportunity to comment on reviewers' work by
providing feedback on the reviews. For this purpose, a questionnaire
will be sent to authors. Their answers will be evaluated anonymously,
and feedback will be handed on to reviewers.
** Important Dates
Submission: June 18, 2010 (Samoa time)
Feedback: July 16, 2010
ESUG Early Registration Deadline: July 9, 2010
Authors will be able to register for the early rate if their
registration depends on IWST notification.
Workshop: September 12, 2010, Barcelona, Spain
** Programme Committee
Co-Chairs:
Michael Haupt, Hasso-Plattner-Institut, University of Potsdam, Germany
Robert Hirschfeld, Hasso-Plattner-Institut, University of Potsdam, Germany
PC Members:
Gabriela Arevalo, Universidad Nacional de La Plata, Argentina
Johannes Brauer, NORDAKADEMIE, Germany
Johan Brichau, Université catholique de Louvain, Belgium
Marcus Denker, INRIA Lille - Nord Europe, France
Theo D'Hondt, Vrije Universiteit Brussel, Belgium
James Foster, GemStone Systems, Inc., USA
Andy Kellens, Vrije Universiteit Brussel, Belgium
Andreas Raab, Teleplace Inc., USA
Lukas Renggli, Software Composition Group (SCG), University of Bern, Switzerland
Randal L. Schwartz, Stonehenge Consulting Services, Inc.
Dave Ungar, IBM Research
May 14, 2010
Re: [Pharo-users] Using FFI to call a MacOs System function
by David Wilson
Hi Mariano
Thanks for the tips, you got me on the right track. Some trial and
lots of error got me to a solution.
In order to use MacOs system calls you have to:
1) identify the function you want to use e.g. KLGetKeyboardLayoutCount
2) find out what header file this is defined in. here it's
"Keyboards.h" in the Framework "Carbon/Carbon.h"
So far it's easy from the Apple documentation
3) find out which Bundle this is in. I used Finder to find out where
Keyboards.h is used, it's used in HIToolbox.framework
4) find the actual compiled framework, on my system it's at:
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/
HIToolbox.framework/Versions/A/HIToolbox
5) I placed a copy of this file in the Pharo bundle at:
Pharo-1.0.app/Contents/Resources/HIToolbox
An the call looks like:
apiKLGetKeyboardLayoutCount
< cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
'HIToolbox'>
^ self externalCallFailed.
I tried a link to the bundle, that didn't work.
Probably the correct way to do this is to change Pharos RES path (in
Pharo.sh) to include the a pointer to HIToolbox executable.
I may try that if I go further with this than a prototype.
Cheers
David
On 05 May, 2010, at 23:15, Mariano Martinez Peck wrote:
BTW....keyboards seems to be a .h (a header) , but not a
library...at least in my mac
Do you have also the library ? I am still newbie with the Mac OS :(
Cheers
mariano
On Wed, May 5, 2010 at 11:10 PM, Mariano Martinez Peck
<marianopeck(a)gmail.com> wrote:
On Tue, May 4, 2010 at 4:46 PM, David Wilson <djwilson(a)bluewin.ch>
wrote:
Hi
I'm new to Pharo (although I was a Smalltalk programmer in the 90's),
and I'm trying to use FFI to access an MacOs system function:
Hi and welcome!
apiKLGetKeyboardLayoutCount
< cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module:
'keyboards'>
^ self externalCallFailed.
I get an error "'Unable to find function address'" which seems to say
the OS-module "keyboards" can't be found.
Exactly. That's the problem.
I can't figure out what the address should be.
The function is defined here: http://developer.apple.com/legacy/mac/
library/documentation/Carbon/Reference/KeyboardLayoutServices/
Reference/reference.html
(yes, it's deprecated, I have a very old mac runnning 10.4).
But you see the library in your computer, isn't it ? I mean, it is
there, but FFI doesn't find it ?
I'm not sure if I'm using FFI correctly, do I have to somehow include
the external library in the Pharo VM?
No, you shouldn't need to do that. However, you can try to put them
there just to see if that's the problem. I think that at some point
(depends on an order) the library is searched in the same place where
you are calling from. So, yes, do a test, but just a test. It should
work without doing that.
How did you install FFI ? Which Pharo VM and image versions are you
using ?
Can anyone help?
I would like too, but I don't have such library.
I developed a wrapper for a Clibrary called OpenDBX using FFI. In our
website, some people experimented similar problems.
Please take a look to the title "Problems with Mac OS:" of the
following link:
http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
I also cc'ed people that can help you.
Cheers
Mariano
I'm looked for FFI examples, but don't find anything helpful.
David
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-users mailing list
Pharo-users(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
May 14, 2010
Help (perfect for newcomers) migrating a technical FAQ
by Mariano Martinez Peck
Hi folks. I had a good idea and and it perfect for someone that wants to
help and don't know how. It is not the most entertained task, but I promise
you will learn a lot. Mostly, if you are newcomer.
The idea is basically to migrate the FAQ that is here:
http://scg.unibe.ch/wiki/faq/pharofaq
to a new section in the collaborative Pharo book:
http://book.pharo-project.org/
So....any takers ? Let us know so that we generate a new user in the Book
The idea is also to check whether what is says is still correct for pharo or
if it needs an update. Or even how to improve it (from the view of a
newcomer).
Thanks
Mariano
May 13, 2010