[squeak-dev] iPhone 1.07

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

[squeak-dev] iPhone 1.07

johnmci
I've push out an iPhone 1.07 VM.   http://www.smalltalkconsulting.com/squeak.html

This VM uses the latest core Pharo image.

The VM has a number of changes to enable C data structure support and  
code examples for
putting up a UITextEdit and UITextView for single and multiple line  
textual input, along with
the ability to execute objective-c methods on the main thread versus  
the squeak thread.
There is of course a new ObjectiveCPlugin for os-x users.

For developers the key to getting a UITextEdit field to work is that  
you *must* create the UITextEdit
thread on the main thread, otherwise if you create the object on the  
squeak thread, then attempt to
use it for textual input on the main thread as per recommendations it  
deadlocks on a semaphore when it
decides that the two process threads are different.

Still to do is finishing the Keyboard entry logic, (oh I'm sure just a  
few minutes should do it...). Then
I'll see if I can get a Menu control example working

I've not included the VNC logic since I don't know if anyone uses it,  
or if it can be integrated into the
Pharo image at this time, however I suspect someone will let me know.

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

stephane ducasse
Thanks john

BTW I have a request for the mac VM

Since I would like to use Squeak as a scripting language I would  
really like to be able to do
        squeak image file
right now I have to pass the full pathname of image and file.
Would it be possible to get that?

Thanks

Stef


On Oct 28, 2008, at 1:08 AM, John M McIntosh wrote:

> I've push out an iPhone 1.07 VM.   http://www.smalltalkconsulting.com/squeak.html
>
> This VM uses the latest core Pharo image.
>
> The VM has a number of changes to enable C data structure support  
> and code examples for
> putting up a UITextEdit and UITextView for single and multiple line  
> textual input, along with
> the ability to execute objective-c methods on the main thread versus  
> the squeak thread.
> There is of course a new ObjectiveCPlugin for os-x users.
>
> For developers the key to getting a UITextEdit field to work is that  
> you *must* create the UITextEdit
> thread on the main thread, otherwise if you create the object on the  
> squeak thread, then attempt to
> use it for textual input on the main thread as per recommendations  
> it deadlocks on a semaphore when it
> decides that the two process threads are different.
>
> Still to do is finishing the Keyboard entry logic, (oh I'm sure just  
> a few minutes should do it...). Then
> I'll see if I can get a Menu control example working
>
> I've not included the VNC logic since I don't know if anyone uses  
> it, or if it can be integrated into the
> Pharo image at this time, however I suspect someone will let me know.
>
> --
> =
> =
> =
> =
> =
> ======================================================================
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> =
> =
> =
> =
> =
> ======================================================================
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

Mark Volkmann
On Oct 28, 2008, at 2:10 AM, stephane ducasse wrote:

> Thanks john
>
> BTW I have a request for the mac VM
>
> Since I would like to use Squeak as a scripting language I would  
> really like to be able to do
> squeak image file
> right now I have to pass the full pathname of image and file.
> Would it be possible to get that?

I would like that too! However, I think there are additional problems  
with starting scripts on the Mac. Simple things that work for me under  
Windows do not work on the Mac. When started this way on a Mac, at  
least for me, Squeak doesn't respond to mouse events and doesn't run  
the script. The GUI comes up, but that's it. I have to kill the process.

> Thanks
>
> Stef
>
>
> On Oct 28, 2008, at 1:08 AM, John M McIntosh wrote:
>
>> I've push out an iPhone 1.07 VM.   http://www.smalltalkconsulting.com/squeak.html
>>
>> This VM uses the latest core Pharo image.
>>
>> The VM has a number of changes to enable C data structure support  
>> and code examples for
>> putting up a UITextEdit and UITextView for single and multiple line  
>> textual input, along with
>> the ability to execute objective-c methods on the main thread  
>> versus the squeak thread.
>> There is of course a new ObjectiveCPlugin for os-x users.
>>
>> For developers the key to getting a UITextEdit field to work is  
>> that you *must* create the UITextEdit
>> thread on the main thread, otherwise if you create the object on  
>> the squeak thread, then attempt to
>> use it for textual input on the main thread as per recommendations  
>> it deadlocks on a semaphore when it
>> decides that the two process threads are different.
>>
>> Still to do is finishing the Keyboard entry logic, (oh I'm sure  
>> just a few minutes should do it...). Then
>> I'll see if I can get a Menu control example working
>>
>> I've not included the VNC logic since I don't know if anyone uses  
>> it, or if it can be integrated into the
>> Pharo image at this time, however I suspect someone will let me know.
>>
>> --
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> John M. McIntosh <[hidden email]>
>> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>>
>>
>>
>>
>>
>
>

---
Mark Volkmann







smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

Eliot Miranda-2
In reply to this post by stephane ducasse


On Tue, Oct 28, 2008 at 12:10 AM, stephane ducasse <[hidden email]> wrote:
Thanks john

BTW I have a request for the mac VM

Since I would like to use Squeak as a scripting language I would really like to be able to do
       squeak image file
right now I have to pass the full pathname of image and file.
Would it be possible to get that?

I think the answer for the VM application is no because Mac OS X opens applications in /.
So the VM cannot find the image unless given a full pathname and cannot find file unless given a full pathname either since the image won't be in the same directory as the image file.

But it is trivial to write a shell script to wrapper the VM that supplies the full pathnames, e.g.

----8<---squeak---8<---
#!/bin/sh
open /Applications/SqueakFoo.app /Applications/SqueakFoo.app/Resources/Scripting.image "`pwd`/$1"
----8<---squeak---8<---

and then have Scripting.image change its working directory to that of the file argument, not the image.


I currently run from the command line using the attached CommandLineLauncher via e.g.

../stackvm/macbuild/Qwaq\ VM.app/Contents/MacOS/Qwaq\ VM ~/Qwaq/Cog/Benchmarks/stck-1.2.21.image -doit "UnixProcess stdOut nextPutAll: 'Hello world!'; nl"
Hello world!




Thanks

Stef


On Oct 28, 2008, at 1:08 AM, John M McIntosh wrote:

I've push out an iPhone 1.07 VM.   http://www.smalltalkconsulting.com/squeak.html

This VM uses the latest core Pharo image.

The VM has a number of changes to enable C data structure support and code examples for
putting up a UITextEdit and UITextView for single and multiple line textual input, along with
the ability to execute objective-c methods on the main thread versus the squeak thread.
There is of course a new ObjectiveCPlugin for os-x users.

For developers the key to getting a UITextEdit field to work is that you *must* create the UITextEdit
thread on the main thread, otherwise if you create the object on the squeak thread, then attempt to
use it for textual input on the main thread as per recommendations it deadlocks on a semaphore when it
decides that the two process threads are different.

Still to do is finishing the Keyboard entry logic, (oh I'm sure just a few minutes should do it...). Then
I'll see if I can get a Menu control example working

I've not included the VNC logic since I don't know if anyone uses it, or if it can be integrated into the
Pharo image at this time, however I suspect someone will let me know.

--
===========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================











CommandLineLauncher.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

Damien Pollet
On Tue, Oct 28, 2008 at 6:08 PM, Eliot Miranda <[hidden email]> wrote:
> I think the answer for the VM application is no because Mac OS X opens
> applications in /.
> So the VM cannot find the image unless given a full pathname and cannot find
> file unless given a full pathname either since the image won't be in the
> same directory as the image file.

But that's only when you run the application from the Finder or using
/usr/bin/open I think.

If you directly run the binary inside the .app bundle from a shell,
then the unix way applies, no ?

> But it is trivial to write a shell script to wrapper the VM that supplies
> the full pathnames, e.g.
> ----8<---squeak---8<---
> #!/bin/sh
> open /Applications/SqueakFoo.app
> /Applications/SqueakFoo.app/Resources/Scripting.image "`pwd`/$1"
> ----8<---squeak---8<---

Heh, I wasn't even aware that open would pass arguments like that.
What Stef and I are doing is
/Applications/Squeak.app/Contents/MacOS/Squeak\ VM\ Opt
$PWD/image.image $PWD/script.st


--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

Eliot Miranda-2


On Tue, Oct 28, 2008 at 10:38 AM, Damien Pollet <[hidden email]> wrote:
On Tue, Oct 28, 2008 at 6:08 PM, Eliot Miranda <[hidden email]> wrote:
> I think the answer for the VM application is no because Mac OS X opens
> applications in /.
> So the VM cannot find the image unless given a full pathname and cannot find
> file unless given a full pathname either since the image won't be in the
> same directory as the image file.

But that's only when you run the application from the Finder or using
/usr/bin/open I think.

If you directly run the binary inside the .app bundle from a shell,
then the unix way applies, no ?

You'd think so, but in my recent experience it isn't reliable.  Sometimes relative paths to the image work, sometimes not.  e.g. ../../foo might be interpreted as ../foo. So I think the only safe assumption is that one needs absolute paths.

> But it is trivial to write a shell script to wrapper the VM that supplies
> the full pathnames, e.g.
> ----8<---squeak---8<---
> #!/bin/sh
> open /Applications/SqueakFoo.app
> /Applications/SqueakFoo.app/Resources/Scripting.image "`pwd`/$1"
> ----8<---squeak---8<---

Heh, I wasn't even aware that open would pass arguments like that.
What Stef and I are doing is
/Applications/Squeak.app/Contents/MacOS/Squeak\ VM\ Opt
$PWD/image.image $PWD/script.st


--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

johnmci
In reply to this post by Eliot Miranda-2
I'm not sure this is accurate if I do

open Squeak.app Squeakx.image

Then with the carbon VM I get the VM launched which then asks me for  
an image via the file selection navigation services,
AND I get a copy of the VM launched which opens the Squeakx.image.  
This is because the Squeak.app runs, then the
Squeakx.image sends an open document request to the VM which then  
looks at the *.image and invokes some applescript to
launch a copy of the VM with the *.image.

This logic was developed a few years back to solve the problem of  
double-clicking
on the a image file and it would open file browser in the running  
squeak.image which wasn't exactly what a person wanted.

I note that saying

open -a Squeak.app Squeakx.image

does the right thing since it asks to open Squeakx.image with the  
application Squeak.app

Now if I do
open -a Squeak\ VM\ Opt.app Squeakx.image test.st

then that starts the application, opens the image, and then opens the  
test.st in a file edit browser, well not what we want either.

In looking at the issue for historical reasons I've done a cwd to the  
VM path when the app starts. If I remove that

./Development/Squeak.app/Contents/MacOS/Squeak\ VM\ Opt ./Development/
Squeakx.image test.st

Well that works as desired, now I wonder about side-effects...

Ok well it won't open the Squeak.image that is found in the same  
directory as the Squeak.app if you launch from the Dock because
the cwd isn't done and I'd guess cwd points to '/'   So let me add a  
change to check for no '.' or '/'  on the image name means look in VM  
directory,
so the default Squeak.image  turns into a search for /Application/
Squeak.image if Squeak.app is in /Application/

Yes that works.

Ok I'll push out a 3.8.19beta1U   for testing


On Oct 28, 2008, at 10:08 AM, Eliot Miranda wrote:

>
>
> On Tue, Oct 28, 2008 at 12:10 AM, stephane ducasse <[hidden email]
> > wrote:
> Thanks john
>
> BTW I have a request for the mac VM
>
> Since I would like to use Squeak as a scripting language I would  
> really like to be able to do
>        squeak image file
> right now I have to pass the full pathname of image and file.
> Would it be possible to get that?
>
> I think the answer for the VM application is no because Mac OS X  
> opens applications in /.
> So the VM cannot find the image unless given a full pathname and  
> cannot find file unless given a full pathname either since the image  
> won't be in the same directory as the image file.
>
> But it is trivial to write a shell script to wrapper the VM that  
> supplies the full pathnames, e.g.
>
> ----8<---squeak---8<---
> #!/bin/sh
> open /Applications/SqueakFoo.app /Applications/SqueakFoo.app/
> Resources/Scripting.image "`pwd`/$1"
> ----8<---squeak---8<---
>
> and then have Scripting.image change its working directory to that  
> of the file argument, not the image.
>
>
> I currently run from the command line using the attached  
> CommandLineLauncher via e.g.
>
> ../stackvm/macbuild/Qwaq\ VM.app/Contents/MacOS/Qwaq\ VM ~/Qwaq/Cog/
> Benchmarks/stck-1.2.21.image -doit "UnixProcess stdOut nextPutAll:  
> 'Hello world!'; nl"
> Hello world!
>
>
>
>
> Thanks
>
> Stef
>
>
> On Oct 28, 2008, at 1:08 AM, John M McIntosh wrote:
>
> I've push out an iPhone 1.07 VM.   http://www.smalltalkconsulting.com/squeak.html
>
> This VM uses the latest core Pharo image.
>
> The VM has a number of changes to enable C data structure support  
> and code examples for
> putting up a UITextEdit and UITextView for single and multiple line  
> textual input, along with
> the ability to execute objective-c methods on the main thread versus  
> the squeak thread.
> There is of course a new ObjectiveCPlugin for os-x users.
>
> For developers the key to getting a UITextEdit field to work is that  
> you *must* create the UITextEdit
> thread on the main thread, otherwise if you create the object on the  
> squeak thread, then attempt to
> use it for textual input on the main thread as per recommendations  
> it deadlocks on a semaphore when it
> decides that the two process threads are different.
>
> Still to do is finishing the Keyboard entry logic, (oh I'm sure just  
> a few minutes should do it...). Then
> I'll see if I can get a Menu control example working
>
> I've not included the VNC logic since I don't know if anyone uses  
> it, or if it can be integrated into the
> Pharo image at this time, however I suspect someone will let me know.
>
> --
> =
> =
> =
> =
> =
> ======================================================================
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> =
> =
> =
> =
> =
> ======================================================================
>
>
>
>
>
>
>
>
> <CommandLineLauncher.st>

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

Damien Pollet
On Wed, Oct 29, 2008 at 12:28 AM, John M McIntosh
<[hidden email]> wrote:
> Squeakx.image sends an open document request to the VM which then looks at
> the *.image and invokes some applescript to
> launch a copy of the VM with the *.image.
>
> This logic was developed a few years back to solve the problem of
> double-clicking
> on the a image file and it would open file browser in the running
> squeak.image which wasn't exactly what a person wanted.

Well ideally(*), from a Mac point of view, the Squeak.app application
would be a front-end to the command-line VM. From the user point of
view, this application could open multiple images, just like TextEdit
can open multiple files at once. Behind the scenes it would run
standard command-line VMs in separate processes, each from their image
directory etc.

(*) I'm sure this is a bit technically naive :)

Either that or the images should look like individual applications to
MacOS, simply using squeak as their interpreter. Maybe by bundling
image + changes + a small script in a .app, like the one-click images
but in a lightweight way ?

--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] iPhone 1.07

johnmci
Ok, well it's not quite that simple because the os-x application  
launcher toss open document requests to the running process that
claims it can handle *.image files.  The current production Squeak  
does not allow you to open multiple windows, where each window
is a threaded interpreter, so it launches yet another process using  
the current binary.  You could have a front end app that launches a
squeak process on each document open but technically that is what I do  
today anyway so adding more complexity gains what?

With lots of $ one could change things to allow one window per image,  
got funding? Noting most of the components are there
Hydra, Areithfa Ffenestri, etc. However since you can't interact with  
the GUI or quicktime from a background thread that makes the task
even more tricky, since now you need to pass draw events to the main  
thread and invoke FFI on the main thread and hope for the best.


On Oct 29, 2008, at 8:10 AM, Damien Pollet wrote:

> On Wed, Oct 29, 2008 at 12:28 AM, John M McIntosh
> <[hidden email]> wrote:
>> Squeakx.image sends an open document request to the VM which then  
>> looks at
>> the *.image and invokes some applescript to
>> launch a copy of the VM with the *.image.
>>
>> This logic was developed a few years back to solve the problem of
>> double-clicking
>> on the a image file and it would open file browser in the running
>> squeak.image which wasn't exactly what a person wanted.
>
> Well ideally(*), from a Mac point of view, the Squeak.app application
> would be a front-end to the command-line VM. From the user point of
> view, this application could open multiple images, just like TextEdit
> can open multiple files at once. Behind the scenes it would run
> standard command-line VMs in separate processes, each from their image
> directory etc.
>
> (*) I'm sure this is a bit technically naive :)
>
> Either that or the images should look like individual applications to
> MacOS, simply using squeak as their interpreter. Maybe by bundling
> image + changes + a small script in a .app, like the one-click images
> but in a lightweight way ?
>
> --
> Damien Pollet
> type less, do more [ | ] http://people.untyped.org/damien.pollet

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================