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
May 2015
- 100 participants
- 788 messages
Re: [Pharo-users] mac address on windows
by Nicolai Hess
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen <
henrik.s.johansen(a)veloxit.no>:
> A few easily fixed Type/pointers to Types mixups, and a slipup where two
> different classes are confused for the same aside, the real show stopper,
> if I haven't missed something entirely, is that the struct parser/NB in
> general does not handle const sized arrays*, which is used in a few of the
> required structs.
>
> Extending the parser should be relatively straight forward, along the
> lines of adding
> stream peek: #'[' ifTrue: [stream next.
> type := SizedExternalArrayType type: type size: stream next.
> stream next = #']' ifFalse: [self error: 'Missing closing bracket for
> ', type printString]]
> to NBExtenralStructureFields >> #parseFields:... after the name is read.
>
> Coding SizedExternalArrayType is a bit more work though...
>
> Cheers,
> Henry
>
>
> *The end goal would be to be able to generate accessors/read/write for a
> simple test-struct such as
> #fieldsDesc
> ^#(
> char ip[MyClassVar +2];
> )
>
Yes, a parser for this would be great.
I tried it with a little hack
NBExternalStructure subclass: #Char_260 ...
Char_260 class>>#fieldDesc
^ #(char data)
Char_260 class>>instanceSize
^ 260
You need another accessor for accessing the data, otherwise you'll only get
the first char. AND I don't know how
the external memory is handle, probably it is never freed :)
Now a complete example (attached code) call it with
GetMacWin32 getMacAddress
>
> On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm(a)gmail.com>
> wrote:
>
>>
>> On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess(a)web.de> wrote:
>>
>>
>>
>> 2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm(a)gmail.com>:
>>
>>>
>>> On 06 May 2015, at 12:10, phil(a)highoctane.be wrote:
>>>
>>> I've loaded your package.
>>>
>>> A prerequisite is to load OS-Window to make it work.
>>>
>>>
>>> why?
>>> in any case, oswindow is already included in pharo4
>>>
>>
>> OS-Windows (by TorstenBergmann)
>>
>> not
>> OSWindow :)
>>
>>
>> ahhh. Name clash :)
>>
>>
>> It is needed for the shared pool WinTypes,
>> but without OS-Window, he can use NBWinTypes instead.
>>
>>
>>
>>>
>>> Esteban
>>>
>>>
>>> I've got the DLL call working nicely and the nativeboost with the
>>> structure freezing.
>>>
>>> Now, we should all have a look at:
>>>
>>> https://github.com/ronsaldo/bullet-pharo
>>>
>>> and
>>>
>>> https://github.com/ronsaldo/swig
>>>
>>> because it looks like the way to go to wrap libraries...
>>>
>>> Ronie, I know you modified swig for generating Pharo code;
>>>
>>> Is cloning your swig repo the way to go ?
>>>
>>>
>>> Phil
>>>
>>>
>>>
>>>
>>> On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti(a)gmail.com>
>>> wrote:
>>>
>>>> Hi Nicolai,
>>>>
>>>> Here is my package that defines the nativeboost call and associated C
>>>> structs.
>>>> The external C struct is self referencing and hence sometimes I get
>>>> infinite recursion when trying to change field descriptions. That is the
>>>> reason why the automatically generated accessors are absent (although I had
>>>> them in an earlier version).
>>>>
>>>> Attached also the DLL referenced in the code.
>>>>
>>>>
>>>>
>>>> On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess(a)web.de>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> 2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti(a)gmail.com>:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, May 5, 2015 at 7:34 PM, phil(a)highoctane.be <
>>>>>> phil(a)highoctane.be> wrote:
>>>>>>
>>>>>>>
>>>>>>> On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti(a)gmail.com
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> I succeeded to do it by encapsulating the C routine as a DLL and
>>>>>>>> doing an FFI call from my image (as suggested by Guille).
>>>>>>>>
>>>>>>>
>>>>>>> At least there was a way!
>>>>>>>
>>>>>>
>>>>>> Exactly :)
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Looks like this is the most controlled|debuggable way:
>>>>>>> - get it working with C code out of Pharo
>>>>>>> - make a bridge that can be used easily with FFI in a dll
>>>>>>> - use that from Pharo with proven FFI
>>>>>>>
>>>>>>> Would NativeBoost work with your dll? Should.
>>>>>>>
>>>>>>
>>>>>> I have read a few resources about Nativeboost but I am still naive to
>>>>>> know the difference between FFI and nativeboost. The FFI call I made to
>>>>>> invoke the DLL function looked similar to the nativeboost calls.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I also tried to perform the nativeboost call by creating my
>>>>>>>> structures in Pharo. The function in Windows that can be used to retrieve
>>>>>>>> mac address in Windows: GetAdaptersInfo
>>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85…> that
>>>>>>>> accepts a PIP_ADAPTER_INFO
>>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).…> structure.
>>>>>>>> I subclassed NBExternalStructure to define this struct and the other used
>>>>>>>> by it in the image but my NB call returned with 87 code (Invalid parameter)
>>>>>>>> and it was impossible to debug. However, I would like to make this thing
>>>>>>>> work to understand what went wrong.
>>>>>>>>
>>>>>>>
>>>>>>> Has this something to do with 32|64 bit library complications?
>>>>>>>
>>>>>>
>>>>>> Not exactly. For me, it was more related to the fact that I had to
>>>>>> map a complex C struct in Pharo. Here is an excerpt of the definition from
>>>>>> MSDN:
>>>>>>
>>>>>> typedef struct _IP_ADAPTER_INFO {
>>>>>> struct _IP_ADAPTER_INFO *Next;
>>>>>> ...
>>>>>> PIP_ADDR_STRING CurrentIpAddress;
>>>>>> IP_ADDR_STRING GatewayList;
>>>>>> ...
>>>>>> }
>>>>>>
>>>>>> So, I had to define three external structures (all names in capitals)
>>>>>> and I did the effort but in the end I got an error code that I could not
>>>>>> debug in the image. Hence, I gave up and opted to go in the native
>>>>>> environment. But I would like someone knowledgable to have a look at my
>>>>>> nativeboost code because the nativeboost approach is more simple
>>>>>> (everything's in the image).
>>>>>>
>>>>>
>>>>> I can have a look.
>>>>>
>>>>> btw. for what do you need the mac address?
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> usman
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Phil
>>>>>>>
>>>>>>> With ProcessWrapper, I could not load the classes essential for
>>>>>>> making the plugin work.
>>>>>>>
>>>>>>> HTH,
>>>>>>>
>>>>>>> Usman
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc(a)openinworld.com>
>>>>>>> wrote:
>>>>>>> As a complete newb to VM building I found this fairly straight
>>>>>>> forward (on a Mac btw).
>>>>>>> https://github.com/pharo-project/pharo-vm
>>>>>>> cheers -ben
>>>>>>>
>>>>>>> On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti(a)gmail.com
>>>>>>> > wrote:
>>>>>>>
>>>>>>>
>>>>>>> On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce(a)samadhiweb.com>
>>>>>>> wrote:
>>>>>>> On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
>>>>>>> > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig
>>>>>>> /all') output.
>>>>>>>
>>>>>>> I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper
>>>>>>> successfully
>>>>>>> back when I was on Windows using some now-ancient version of Pharo.
>>>>>>>
>>>>>>> I had initially discarded the idea of using this project because it
>>>>>>> required a plugin and the information of the plugin was outdated on
>>>>>>> squeaksource. However, having evaluated superficially the complexity of
>>>>>>> doing it with nativeboost (because too many external c struct involved in
>>>>>>> the call), I would like to see if I am better off using this wrapper.
>>>>>>>
>>>>>>> I loaded it with:
>>>>>>>
>>>>>>> Gofer it
>>>>>>> url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main';
>>>>>>> package: 'ProcessWrapper-Core';
>>>>>>> package: 'ProcessWrapper-Plugin';
>>>>>>> package: 'ProcessWrapper-Tests';
>>>>>>> load.
>>>>>>>
>>>>>>> But the plugins wont load because it requires the
>>>>>>> class SmartSyntaxInterpreterPlugin and apparently this file is a part of
>>>>>>> the VMMaker. Is there any recent config for VMMaker in Pharo because this
>>>>>>> one looks outdated:
>>>>>>>
>>>>>>> http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Pierce
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
May 6, 2015
Re: [Pharo-users] mac address on windows
by Nicolai Hess
2015-05-06 13:38 GMT+02:00 phil(a)highoctane.be <phil(a)highoctane.be>:
>
>
> On Wed, May 6, 2015 at 12:29 PM, Nicolai Hess <nicolaihess(a)web.de> wrote:
>
>>
>>
>> 2015-05-06 12:10 GMT+02:00 phil(a)highoctane.be <phil(a)highoctane.be>:
>>
>>> I've loaded your package.
>>>
>>> A prerequisite is to load OS-Window to make it work.
>>>
>>> I've got the DLL call working nicely and the nativeboost with the
>>> structure freezing.
>>>
>>
>> This is because you have a recursive datastructure description, but
>> acutually the IP_ADAPTER_INFO structure is not recursive:
>>
>> PIP_ADAPTER_INFO class >>fieldsDex
>> ^ #(
>> PIP_ADAPTER_INFO nextVariable;
>> DWORD ComboIndex;
>> CHAR AdapterName;
>> CHAR Description;
>> ....)
>>
>> The "nextVariable" should be a pointer to the structure.
>>
>> from MSDN:
>>
>> struct _IP_ADAPTER_INFO {
>> struct _IP_ADAPTER_INFO *Next; "<- pointer"
>> DWORD ComboIndex;
>> char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
>> char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
>> UINT AddressLength;
>>
>> ....
>>
>>
>>
>
> So, what's to put in there then?
>
>
IpAdapterInfo class>>#fieldsDesc
^#(
IpAdapterInfo* Next;
DWORD ComboIndex;
....
This would work
> I can use FFI / NB for basic cases but never ventured into those structure.
> I'd like to :-)
>
> Phil
> I
>
>>
>>
>>
>>
>>
>>
>>
>>>
>>> Now, we should all have a look at:
>>>
>>> https://github.com/ronsaldo/bullet-pharo
>>>
>>> and
>>>
>>> https://github.com/ronsaldo/swig
>>>
>>> because it looks like the way to go to wrap libraries...
>>>
>>> Ronie, I know you modified swig for generating Pharo code;
>>>
>>> Is cloning your swig repo the way to go ?
>>>
>>>
>>> Phil
>>>
>>>
>>>
>>>
>>>
>>> On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti(a)gmail.com>
>>> wrote:
>>>
>>>> Hi Nicolai,
>>>>
>>>> Here is my package that defines the nativeboost call and associated C
>>>> structs.
>>>> The external C struct is self referencing and hence sometimes I get
>>>> infinite recursion when trying to change field descriptions. That is the
>>>> reason why the automatically generated accessors are absent (although I had
>>>> them in an earlier version).
>>>>
>>>> Attached also the DLL referenced in the code.
>>>>
>>>>
>>>>
>>>> On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess(a)web.de>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> 2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti(a)gmail.com>:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, May 5, 2015 at 7:34 PM, phil(a)highoctane.be <
>>>>>> phil(a)highoctane.be> wrote:
>>>>>>
>>>>>>>
>>>>>>> On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti(a)gmail.com
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> I succeeded to do it by encapsulating the C routine as a DLL and
>>>>>>>> doing an FFI call from my image (as suggested by Guille).
>>>>>>>>
>>>>>>>
>>>>>>> At least there was a way!
>>>>>>>
>>>>>>
>>>>>> Exactly :)
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Looks like this is the most controlled|debuggable way:
>>>>>>> - get it working with C code out of Pharo
>>>>>>> - make a bridge that can be used easily with FFI in a dll
>>>>>>> - use that from Pharo with proven FFI
>>>>>>>
>>>>>>> Would NativeBoost work with your dll? Should.
>>>>>>>
>>>>>>
>>>>>> I have read a few resources about Nativeboost but I am still naive to
>>>>>> know the difference between FFI and nativeboost. The FFI call I made to
>>>>>> invoke the DLL function looked similar to the nativeboost calls.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I also tried to perform the nativeboost call by creating my
>>>>>>>> structures in Pharo. The function in Windows that can be used to retrieve
>>>>>>>> mac address in Windows: GetAdaptersInfo
>>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85…> that
>>>>>>>> accepts a PIP_ADAPTER_INFO
>>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).…> structure.
>>>>>>>> I subclassed NBExternalStructure to define this struct and the other used
>>>>>>>> by it in the image but my NB call returned with 87 code (Invalid parameter)
>>>>>>>> and it was impossible to debug. However, I would like to make this thing
>>>>>>>> work to understand what went wrong.
>>>>>>>>
>>>>>>>
>>>>>>> Has this something to do with 32|64 bit library complications?
>>>>>>>
>>>>>>
>>>>>> Not exactly. For me, it was more related to the fact that I had to
>>>>>> map a complex C struct in Pharo. Here is an excerpt of the definition from
>>>>>> MSDN:
>>>>>>
>>>>>> typedef struct _IP_ADAPTER_INFO {
>>>>>> struct _IP_ADAPTER_INFO *Next;
>>>>>> ...
>>>>>> PIP_ADDR_STRING CurrentIpAddress;
>>>>>> IP_ADDR_STRING GatewayList;
>>>>>> ...
>>>>>> }
>>>>>>
>>>>>> So, I had to define three external structures (all names in capitals)
>>>>>> and I did the effort but in the end I got an error code that I could not
>>>>>> debug in the image. Hence, I gave up and opted to go in the native
>>>>>> environment. But I would like someone knowledgable to have a look at my
>>>>>> nativeboost code because the nativeboost approach is more simple
>>>>>> (everything's in the image).
>>>>>>
>>>>>
>>>>> I can have a look.
>>>>>
>>>>> btw. for what do you need the mac address?
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> usman
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Phil
>>>>>>>
>>>>>>>>
>>>>>>>> With ProcessWrapper, I could not load the classes essential for
>>>>>>>> making the plugin work.
>>>>>>>>
>>>>>>>> HTH,
>>>>>>>>
>>>>>>>> Usman
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc(a)openinworld.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> As a complete newb to VM building I found this fairly straight
>>>>>>>>> forward (on a Mac btw).
>>>>>>>>> https://github.com/pharo-project/pharo-vm
>>>>>>>>> cheers -ben
>>>>>>>>>
>>>>>>>>> On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <
>>>>>>>>> usman.bhatti(a)gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce(a)samadhiweb.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
>>>>>>>>>>> > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig
>>>>>>>>>>> /all') output.
>>>>>>>>>>>
>>>>>>>>>>> I have used
>>>>>>>>>>> http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper
>>>>>>>>>>> successfully
>>>>>>>>>>> back when I was on Windows using some now-ancient version of
>>>>>>>>>>> Pharo.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I had initially discarded the idea of using this project because
>>>>>>>>>> it required a plugin and the information of the plugin was outdated on
>>>>>>>>>> squeaksource. However, having evaluated superficially the complexity of
>>>>>>>>>> doing it with nativeboost (because too many external c struct involved in
>>>>>>>>>> the call), I would like to see if I am better off using this wrapper.
>>>>>>>>>>
>>>>>>>>>> I loaded it with:
>>>>>>>>>>
>>>>>>>>>> Gofer it
>>>>>>>>>> url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main
>>>>>>>>>> ';
>>>>>>>>>> package: 'ProcessWrapper-Core';
>>>>>>>>>> package: 'ProcessWrapper-Plugin';
>>>>>>>>>> package: 'ProcessWrapper-Tests';
>>>>>>>>>> load.
>>>>>>>>>>
>>>>>>>>>> But the plugins wont load because it requires the
>>>>>>>>>> class SmartSyntaxInterpreterPlugin and apparently this file is a part of
>>>>>>>>>> the VMMaker. Is there any recent config for VMMaker in Pharo because this
>>>>>>>>>> one looks outdated:
>>>>>>>>>>
>>>>>>>>>> http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Pierce
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
>
May 6, 2015
Re: [Pharo-users] MouseWheel events
by Sean P. DeNigris
Matthieu Lacaton wrote
> Shouldn't I get a MouseWheel event when i use the wheel and a keystroke
> when I use CTRL + Arrow ?
Yes! But the hack that you discovered is what we have :) It's done well for
us given it's simplicity. But it's far from ideal. For instance, IIRC the
delta is fixed, so scrolling a lot sends a lot of tiny scrolls instead of
more appropriately-sized ones. The keystroke-equivalence differences I think
are due to the underlying platform - the meta key for Mac is CMD, so that is
what's used. I extended the hack recently to get horizontal scrolling, but
it's only implemented for the Mac VM (there is not even corresponding code
in the image yet, pending Windows/Linux implementation). If you trap the
events, you can see that now it's simulating
cmd+alt+ctrl+shift+[up/down/left/right].
-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/MouseWheel-events-tp4824839p4824929.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
May 6, 2015
Re: [Pharo-users] SDL plugin ?
by Esteban Lorenzano
I can add them to the vm compilation.
Adding it to the TODOâ¦
Esteban
ps: again, pharo-dev :)
> On 06 May 2015, at 22:45, Matthieu Lacaton <matthieu.lacaton(a)gmail.com> wrote:
>
> Thanks for your answers, I understand now.
> But even if the plugin is not needed it is handy to have because it allows you to use "OSSDL2Driver current" without being returned an OSNullWindowDriver because of the "hasPlugin" returning false.
> Moreover the "eventLoopProcessWithPlugin" is actually much more efficient than the "eventLoopWithoutPlugin" because of the semaphore.
>
> So basically, even if it is not necessary, having the plugin just allows me to code without hacking these methods :p
>
> Thank you,
>
> Matthieu
>
> 2015-05-06 22:32 GMT+02:00 Esteban Lorenzano <estebanlm(a)gmail.com <mailto:estebanlm@gmail.com>>:
> actually, the SDL plugin is not being included because until now it was not necessary.
> There is a difference between the SDL2 dependent functions and the plugin.
> The plugin provides just two functions:
>
> /**
> * Called by the VM heartbeat if installed, to check for the presence of events.
> */
> static void ioCheckForEvents() {
> if (inited) {
> SDL_PumpEvents();
> if (SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
> interpreterProxy->signalSemaphoreWithIndex(inputSemaphoreIndex);
> }
> }
> }
>
> void setSDL2InputSemaphoreIndex(int semaIndex) {
> inited = 1;
> inputSemaphoreIndex = semaIndex;
> setIoProcessEventsHandler(&ioCheckForEvents);
> }
>
> and they are used to replace the event handling the world uses⦠something that you cannot do at this moment because I did not integrate that chunk yet :)
>
> So you should not need it⦠for now.
>
> Esteban
>
> ps: btw⦠this kind of questions are not for regular users but for pharo developers (because you are playing with something that is or will be part of pharo it self), so Iâm redirecting this question there.
>
>> On 06 May 2015, at 22:03, Merwan Ouddane <merwanouddane(a)gmail.com <mailto:merwanouddane@gmail.com>> wrote:
>>
>> Hello Matthieu
>>
>> The sdl plugin is just the SDL runtime binaries recompiled with the vm for eaach plateform, you can find the sources here: https://www.libsdl.org/release/SDL2-2.0.1.zip <https://www.libsdl.org/release/SDL2-2.0.1.zip>
>>
>> The compiled plugin for windows can be found inside the last vm here: http://files.pharo.org/get-files/40/pharo-win-latest.zip <http://files.pharo.org/get-files/40/pharo-win-latest.zip>
>>
>> Cheers,
>> Merwan
>>
>>
>> On 06/05/2015 21:48, Matthieu Lacaton wrote:
>>> Hello, I am currently playing with OSWindow and I am wondering what the "SDL plugin" is in the OSSDL2Driver ?
>>> When I downloaded the latest linux VM + image I got a library called libSDL2DisplayPlugin but how can I get this plugin for windows ? Is it possible to get the source code too ?
>>>
>>> Thanks,
>>>
>>> Matthieu
>>
>>
>
>
May 6, 2015
Re: [Pharo-users] mac address on windows
by Henrik Sperre Johansen
A few easily fixed Type/pointers to Types mixups, and a slipup where two
different classes are confused for the same aside, the real show stopper,
if I haven't missed something entirely, is that the struct parser/NB in
general does not handle const sized arrays*, which is used in a few of the
required structs.
Extending the parser should be relatively straight forward, along the lines
of adding
stream peek: #'[' ifTrue: [stream next.
type := SizedExternalArrayType type: type size: stream next.
stream next = #']' ifFalse: [self error: 'Missing closing bracket for ',
type printString]]
to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers,
Henry
*The end goal would be to be able to generate accessors/read/write for a
simple test-struct such as
#fieldsDesc
^#(
char ip[MyClassVar +2];
)
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm(a)gmail.com>
wrote:
>
> On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess(a)web.de> wrote:
>
>
>
> 2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm(a)gmail.com>:
>
>>
>> On 06 May 2015, at 12:10, phil(a)highoctane.be wrote:
>>
>> I've loaded your package.
>>
>> A prerequisite is to load OS-Window to make it work.
>>
>>
>> why?
>> in any case, oswindow is already included in pharo4
>>
>
> OS-Windows (by TorstenBergmann)
>
> not
> OSWindow :)
>
>
> ahhh. Name clash :)
>
>
> It is needed for the shared pool WinTypes,
> but without OS-Window, he can use NBWinTypes instead.
>
>
>
>>
>> Esteban
>>
>>
>> I've got the DLL call working nicely and the nativeboost with the
>> structure freezing.
>>
>> Now, we should all have a look at:
>>
>> https://github.com/ronsaldo/bullet-pharo
>>
>> and
>>
>> https://github.com/ronsaldo/swig
>>
>> because it looks like the way to go to wrap libraries...
>>
>> Ronie, I know you modified swig for generating Pharo code;
>>
>> Is cloning your swig repo the way to go ?
>>
>>
>> Phil
>>
>>
>>
>>
>> On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti(a)gmail.com>
>> wrote:
>>
>>> Hi Nicolai,
>>>
>>> Here is my package that defines the nativeboost call and associated C
>>> structs.
>>> The external C struct is self referencing and hence sometimes I get
>>> infinite recursion when trying to change field descriptions. That is the
>>> reason why the automatically generated accessors are absent (although I had
>>> them in an earlier version).
>>>
>>> Attached also the DLL referenced in the code.
>>>
>>>
>>>
>>> On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess(a)web.de> wrote:
>>>
>>>>
>>>>
>>>> 2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti(a)gmail.com>:
>>>>
>>>>>
>>>>>
>>>>> On Tue, May 5, 2015 at 7:34 PM, phil(a)highoctane.be <phil(a)highoctane.be
>>>>> > wrote:
>>>>>
>>>>>>
>>>>>> On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti(a)gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I succeeded to do it by encapsulating the C routine as a DLL and
>>>>>>> doing an FFI call from my image (as suggested by Guille).
>>>>>>>
>>>>>>
>>>>>> At least there was a way!
>>>>>>
>>>>>
>>>>> Exactly :)
>>>>>
>>>>>
>>>>>>
>>>>>> Looks like this is the most controlled|debuggable way:
>>>>>> - get it working with C code out of Pharo
>>>>>> - make a bridge that can be used easily with FFI in a dll
>>>>>> - use that from Pharo with proven FFI
>>>>>>
>>>>>> Would NativeBoost work with your dll? Should.
>>>>>>
>>>>>
>>>>> I have read a few resources about Nativeboost but I am still naive to
>>>>> know the difference between FFI and nativeboost. The FFI call I made to
>>>>> invoke the DLL function looked similar to the nativeboost calls.
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>> I also tried to perform the nativeboost call by creating my
>>>>>>> structures in Pharo. The function in Windows that can be used to retrieve
>>>>>>> mac address in Windows: GetAdaptersInfo
>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85…> that
>>>>>>> accepts a PIP_ADAPTER_INFO
>>>>>>> <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).…> structure.
>>>>>>> I subclassed NBExternalStructure to define this struct and the other used
>>>>>>> by it in the image but my NB call returned with 87 code (Invalid parameter)
>>>>>>> and it was impossible to debug. However, I would like to make this thing
>>>>>>> work to understand what went wrong.
>>>>>>>
>>>>>>
>>>>>> Has this something to do with 32|64 bit library complications?
>>>>>>
>>>>>
>>>>> Not exactly. For me, it was more related to the fact that I had to map
>>>>> a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
>>>>>
>>>>> typedef struct _IP_ADAPTER_INFO {
>>>>> struct _IP_ADAPTER_INFO *Next;
>>>>> ...
>>>>> PIP_ADDR_STRING CurrentIpAddress;
>>>>> IP_ADDR_STRING GatewayList;
>>>>> ...
>>>>> }
>>>>>
>>>>> So, I had to define three external structures (all names in capitals)
>>>>> and I did the effort but in the end I got an error code that I could not
>>>>> debug in the image. Hence, I gave up and opted to go in the native
>>>>> environment. But I would like someone knowledgable to have a look at my
>>>>> nativeboost code because the nativeboost approach is more simple
>>>>> (everything's in the image).
>>>>>
>>>>
>>>> I can have a look.
>>>>
>>>> btw. for what do you need the mac address?
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> usman
>>>>>
>>>>>
>>>>>>
>>>>>> Phil
>>>>>>
>>>>>> With ProcessWrapper, I could not load the classes essential for
>>>>>> making the plugin work.
>>>>>>
>>>>>> HTH,
>>>>>>
>>>>>> Usman
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc(a)openinworld.com>
>>>>>> wrote:
>>>>>> As a complete newb to VM building I found this fairly straight
>>>>>> forward (on a Mac btw).
>>>>>> https://github.com/pharo-project/pharo-vm
>>>>>> cheers -ben
>>>>>>
>>>>>> On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti(a)gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce(a)samadhiweb.com>
>>>>>> wrote:
>>>>>> On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
>>>>>> > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all')
>>>>>> output.
>>>>>>
>>>>>> I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper
>>>>>> successfully
>>>>>> back when I was on Windows using some now-ancient version of Pharo.
>>>>>>
>>>>>> I had initially discarded the idea of using this project because it
>>>>>> required a plugin and the information of the plugin was outdated on
>>>>>> squeaksource. However, having evaluated superficially the complexity of
>>>>>> doing it with nativeboost (because too many external c struct involved in
>>>>>> the call), I would like to see if I am better off using this wrapper.
>>>>>>
>>>>>> I loaded it with:
>>>>>>
>>>>>> Gofer it
>>>>>> url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main';
>>>>>> package: 'ProcessWrapper-Core';
>>>>>> package: 'ProcessWrapper-Plugin';
>>>>>> package: 'ProcessWrapper-Tests';
>>>>>> load.
>>>>>>
>>>>>> But the plugins wont load because it requires the
>>>>>> class SmartSyntaxInterpreterPlugin and apparently this file is a part of
>>>>>> the VMMaker. Is there any recent config for VMMaker in Pharo because this
>>>>>> one looks outdated:
>>>>>>
>>>>>> http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Pierce
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>
>
May 6, 2015
Re: [Pharo-users] SDL plugin ?
by Matthieu Lacaton
Thanks for your answers, I understand now.
But even if the plugin is not needed it is handy to have because it allows
you to use "OSSDL2Driver current" without being returned an
OSNullWindowDriver because of the "hasPlugin" returning false.
Moreover the "eventLoopProcessWithPlugin" is actually much more efficient
than the "eventLoopWithoutPlugin" because of the semaphore.
So basically, even if it is not necessary, having the plugin just allows me
to code without hacking these methods :p
Thank you,
Matthieu
2015-05-06 22:32 GMT+02:00 Esteban Lorenzano <estebanlm(a)gmail.com>:
> actually, the SDL plugin is not being included because until now it was
> not necessary.
> There is a difference between the SDL2 dependent functions and the plugin.
> The plugin provides just two functions:
>
> /**
> * Called by the VM heartbeat if installed, to check for the presence of
> events.
> */
> static void ioCheckForEvents() {
> if (inited) {
> SDL_PumpEvents();
> if (SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
> interpreterProxy->signalSemaphoreWithIndex(inputSemaphoreIndex);
> }
> }
> }
>
> void setSDL2InputSemaphoreIndex(int semaIndex) {
> inited = 1;
> inputSemaphoreIndex = semaIndex;
> setIoProcessEventsHandler(&ioCheckForEvents);
> }
>
> and they are used to replace the event handling the world uses⦠something
> that you cannot do at this moment because I did not integrate that chunk
> yet :)
>
> So you should not need it⦠for now.
>
> Esteban
>
> ps: btw⦠this kind of questions are not for regular users but for pharo
> developers (because you are playing with something that is or will be part
> of pharo it self), so Iâm redirecting this question there.
>
> On 06 May 2015, at 22:03, Merwan Ouddane <merwanouddane(a)gmail.com> wrote:
>
> Hello Matthieu
>
> The sdl plugin is just the SDL runtime binaries recompiled with the vm for
> eaach plateform, you can find the sources here:
> https://www.libsdl.org/release/SDL2-2.0.1.zip
>
> The compiled plugin for windows can be found inside the last vm here:
> http://files.pharo.org/get-files/40/pharo-win-latest.zip
>
> Cheers,
> Merwan
>
>
> On 06/05/2015 21:48, Matthieu Lacaton wrote:
>
> Hello, I am currently playing with OSWindow and I am wondering what the
> "SDL plugin" is in the OSSDL2Driver ?
> When I downloaded the latest linux VM + image I got a library called
> libSDL2DisplayPlugin but how can I get this plugin for windows ? Is it
> possible to get the source code too ?
>
> Thanks,
>
> Matthieu
>
>
>
>
>
May 6, 2015
Re: [Pharo-users] Some Athens modifications ?
by Nicolai Hess
2015-05-06 17:27 GMT+02:00 Matthieu Lacaton <matthieu.lacaton(a)gmail.com>:
> Hello everybody,
>
> I was playing arround with Athens lately and I think I encountered a few
> small bugs along the way (I may be wrong though) :
>
> 1) In *LinearGradientPaint class >> from:* aStartPoint *to:* aStopPoint
> There is a call to the method *"initializeFrom: aStartPoint to:
> aStopPoint"* but this method does not exist. I think the whole method
> could probably be replaced by :
>
> *LinearGradientPaint class >>* *from:* aStartPoint *to:* aStopPoint
> ^ self new start: aStartPoint; stop: aStopPoint; yourself.
>
Yes
>
> 2) This is not much but in the *GradientPaint* class there is an instance
> variable named *"stops"* but it seems that it is never used.
>
Yes, stops are part of the color ramp associations.
>
> 3) In AthensCairoMatrix there is a difference in the variable order
> between *AthensCairoMatrix class >> fieldsDesc* and *AthensCairoMatrix >>
> initx: y: sx: sy: shx: shy:*
>
> In the first one the order is "sx, shx, shy, sy, x, y" whereas in the
> second one it is "sx, shy, shx, sy, x, y". However, according to the
> cairoGraphics API documentation, the order should be the same.
>
I don't know why i t was done that way.
>
> By the way I have a small question : Why not keep the same variable names
> than in cairoGraphics here (xx, yx, xy, yy, x0, y0) ?
>
No idea :)
>
> 4) In *AthensCairoMatrix >> primMultiplyBy:* m.
>
> The function as defined in C is the following :
>
> void
> cairo_matrix_multiply (*cairo_matrix_t <http://cairographics.org/manual/cairo-cairo-matrix-t.html#cairo-matrix-t> *result*,
> *const cairo_matrix_t <http://cairographics.org/manual/cairo-cairo-matrix-t.html#cairo-matrix-t> *a*,
> *const cairo_matrix_t <http://cairographics.org/manual/cairo-cairo-matrix-t.html#cairo-matrix-t> *b*);
>
> It is stated that
>
> *"The effect of the resulting transformation is to first apply the
> transformation in a to the coordinates and then apply the transformation in
> b to the coordinates."*
> In Pharo it is defined like this :
>
>
>
>
>
> *void cairo_matrix_multiply ( AthensCairoMatrix * self,
> AthensCairoMatrix * m ,
> AthensCairoMatrix * self )*
> For me, when writing "self multiplyBy: aRotationTransformation" it seems
> more logical to first do the self transformation" and then the rotation
> transformation (especially if we want a cascade of transformations).
> However, as currently written in Pharo it is actually the rotation
> transformation that is applied and then the self transformation.
>
> For example, if I want a scaling then a rotation then a translation it
> seems easier to me to do :
> myTransformation := myTransformation multiplyBy: scalingTransformation.
> myTransformation := myTransformation multiplyBy: rotationTransformation.
> myTransformation := myTransformation multiplyBy: translationTransformation.
> etc. if I want some other transformations.
>
> So it could be nice to have a
>
>
>
> *a method defined like this : void cairo_matrix_multiply (
> AthensCairoMatrix * self,
> AthensCairoMatrix * self ,
> AthensCairoMatrix * m )*
>
>
> What do you think about it ?
>
maybe with different names post_multiply / pre_multiply ?
>
> Thanks,
>
> Matthieu
>
>
May 6, 2015
Re: [Pharo-users] SDL plugin ?
by Esteban Lorenzano
actually, the SDL plugin is not being included because until now it was not necessary.
There is a difference between the SDL2 dependent functions and the plugin.
The plugin provides just two functions:
/**
* Called by the VM heartbeat if installed, to check for the presence of events.
*/
static void ioCheckForEvents() {
if (inited) {
SDL_PumpEvents();
if (SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
interpreterProxy->signalSemaphoreWithIndex(inputSemaphoreIndex);
}
}
}
void setSDL2InputSemaphoreIndex(int semaIndex) {
inited = 1;
inputSemaphoreIndex = semaIndex;
setIoProcessEventsHandler(&ioCheckForEvents);
}
and they are used to replace the event handling the world uses⦠something that you cannot do at this moment because I did not integrate that chunk yet :)
So you should not need it⦠for now.
Esteban
ps: btw⦠this kind of questions are not for regular users but for pharo developers (because you are playing with something that is or will be part of pharo it self), so Iâm redirecting this question there.
> On 06 May 2015, at 22:03, Merwan Ouddane <merwanouddane(a)gmail.com> wrote:
>
> Hello Matthieu
>
> The sdl plugin is just the SDL runtime binaries recompiled with the vm for eaach plateform, you can find the sources here: https://www.libsdl.org/release/SDL2-2.0.1.zip
>
> The compiled plugin for windows can be found inside the last vm here: http://files.pharo.org/get-files/40/pharo-win-latest.zip
>
> Cheers,
> Merwan
>
>
> On 06/05/2015 21:48, Matthieu Lacaton wrote:
>> Hello, I am currently playing with OSWindow and I am wondering what the "SDL plugin" is in the OSSDL2Driver ?
>> When I downloaded the latest linux VM + image I got a library called libSDL2DisplayPlugin but how can I get this plugin for windows ? Is it possible to get the source code too ?
>>
>> Thanks,
>>
>> Matthieu
>
>
May 6, 2015
Re: [Pharo-users] SDL plugin ?
by Merwan Ouddane
Hello Matthieu
The sdl plugin is just the SDL runtime binaries recompiled with the vm
for eaach plateform, you can find the sources here:
https://www.libsdl.org/release/SDL2-2.0.1.zip
The compiled plugin for windows can be found inside the last vm here:
http://files.pharo.org/get-files/40/pharo-win-latest.zip
Cheers,
Merwan
On 06/05/2015 21:48, Matthieu Lacaton wrote:
> Hello, I am currently playing with OSWindow and I am wondering what
> the "SDL plugin" is in the OSSDL2Driver ?
> When I downloaded the latest linux VM + image I got a library called
> libSDL2DisplayPlugin but how can I get this plugin for windows ? Is it
> possible to get the source code too ?
>
> Thanks,
>
> Matthieu
May 6, 2015
SDL plugin ?
by Matthieu Lacaton
Hello, I am currently playing with OSWindow and I am wondering what the
"SDL plugin" is in the OSSDL2Driver ?
When I downloaded the latest linux VM + image I got a library called
libSDL2DisplayPlugin but how can I get this plugin for windows ? Is it
possible to get the source code too ?
Thanks,
Matthieu
May 6, 2015