Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread isaac kearse
Hi Brian,

I tried running your minimal app but it crashed with a similar error.  Here
are all the gory details (including Problem Details and System Profile from
the crash reporter):
http://gist.github.com/114723

I have also put the whole directory structure for the minimal hotcocoa app
on github so we can be sure we are running exactly the same app:
http://github.com/isaac/shortcut/tree/master
I also got a few more warnings when compiling shortcut.m but I am assuming I
can just ignore them? (I included them at the bottom of the gist also)

Cheers,
Isaac

On Wed, May 20, 2009 at 1:10 PM, isaac kearse  wrote:

> Yeah I think you're right.  I was calling it inside a hotcocoa app but not
> in the application context.  I'll try it out tonight and let you know how it
> goes.
> Thanks a lot for walking me through this.
>
> On Wed, May 20, 2009 at 12:47 PM, Brian Chapados  wrote:
>
>> I'm not sure how you're testing this, but beware of doing this from a
>> command line-only script or through macirb.  I suspect you need to be
>> in an Application context (or hook into the event loop through some
>> other means).  It works from a minimal hotcocoa app:
>> http://gist.github.com/114523
>>
>> I also made some slight modifications to your Obj-C code to add a
>> delegate that gives you a callback hook that you can define in Ruby.
>> There is probably a better way to do this, but this was fast.
>> see: http://gist.github.com/114521
>>
>> Note that I changed the keyboard shortcut to controlKey+optionKey, so
>> you'll need to press Control+Option+Space.
>>
>>
>> On Tue, May 19, 2009 at 4:33 PM, isaac kearse 
>> wrote:
>> > Hey thanks Brian that worked!
>> > I tried compiling with the Carbon Framework but I didn't think to try it
>> > with both Carbon and Foundation.  I still got the warning "makes pointer
>> > from integer without a cast" but I'm just ignoring that :)
>> > So the bundle was created and I compiled it and required it my app.
>> > But when I actually call it with "Shortcut.new.addShortcut" (from the
>> start
>> > method in my application.rb) I get a nasty error:
>> > isaac:~/src/tasks isaac$ macrake
>> > (in /Users/isaac/src/tasks)
>> >
>> /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:
>> > [BUG] Segmentation fault
>> > MacRuby version 0.4 (ruby 1.9.1) [universal-darwin9.0, x86_64]
>> > -- stack frame 
>> >  (0xc0860): 0004
>> > 0001 (0xc0868): 
>> > 0002 (0xc0870): 0004
>> > 0003 (0xc0878): 
>> > 0004 (0xc0880): 0004
>> > 0005 (0xc0888): 
>> > 0006 (0xc0890): 0004
>> > 0007 (0xc0898): 80003ffe0
>> > 0008 (0xc08a0): 0004
>> > 0009 (0xc08a8): 
>> > 0010 (0xc08b0): 0004
>> > 0011 (0xc08b8): 
>> > 0012 (0xc08c0): 0004
>> > 0013 (0xc08c8): 
>> > 0014 (0xc08d0): 8004f3380
>> > 0015 (0xc08d8): 0004
>> > 0016 (0xc08e0): 
>> > 0017 (0xc08e8): 8004eb020
>> > 0018 (0xc08f0): 0004
>> > 0019 (0xc08f8):  <- lfp <- dfp
>> > -- control frame --
>> > c:0008 p: s:0020 b:0020 l:19 d:19 CFUNC  :addShortcut
>> > c:0007 p:0019 s:0017 b:0017 l:16 d:16 METHOD
>> >
>> /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12
>> > c:0006 p:0103 s:0014 b:0014 l:13 d:13 TOP
>> >
>>  /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:297
>> > c:0005 p: s:0012 b:0012 l:11 d:11 FINISH :set_encoding:
>> > c:0004 p: s:0010 b:0010 l:09 d:09 CFUNC  :load
>> > c:0003 p:0043 s:0006 b:0006 l:05 d:05 TOP
>> >  /Users/isaac/src/tasks/Tasks.app/Contents/Resources/rb_main.rb:2
>> > c:0002 p: s:0004 b:0004 l:03 d:03 FINISH :inherited:
>> > c:0001 p: s:0002 b:0002 l:01 d:01 TOP
>> > ---
>> > DBG> :
>> >
>> "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:in
>> > `addShortcut'"
>> > DBG> :
>> >
>> "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:in
>> > `start'"
>> > DBG> :
>> >
>> "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:297:in
>> > `'"
>> > DBG> :
>> "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/rb_main.rb:2:in
>> > `load'"
>> > DBG> :
>> "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/rb_main.rb:2:in
>> > `'"
>> > -- backtrace of native function call (Use addr2line) --
>> > 0x10010f2c1
>> > 0x100029334
>> > 0x100029418
>> > 0x1000c240d
>> > 0x7fff803763fa
>> > 0x0
>> > 0x7fff8108094d
>> > 0x105a31e8c
>> > 0x100121855
>> > 0x10010af7d
>> > 0x10010074f
>> > 0x1001056e2
>> > 0x10010596c
>> > 0x100030c96
>> > 0x100030d15
>> > 0x10010ada7
>> > 0x10010074f
>> > 0x1001056e2
>> > 0x10010596c
>> > 0x10002cd32
>> > 0x1000300f7
>> > 0x100118723
>> > 0x10f84
>> > 0x10f40
>> > ---
>> > Any ideas?
>> > Cheers,
>> > Isaac
>> > On Wed, May 20

[MacRuby-devel] Crash with NSUInteger in delegate method

2009-05-20 Thread Łukasz Adamczak
Don't know if it deserves a ticket, so I'm posting here first.

I'm trying to use ObjectiveFlickr from my MacRuby project:
http://github.com/czak/flickrtest

One of the ObjectiveFlickr delegate methods receives NSUIntegers from
the library:
http://github.com/lukhnos/objectiveflickr/blob/b480aa39fa0e96f40a1b44523e0b6f918b2ed441/Source/ObjectiveFlickr.m#L525

When I implement the delegate method in ruby (even an empty implementation):
http://github.com/czak/flickrtest/blob/00ad51b155b65221770aa4ab1661fd99957a689e/app_controller.rb#L92-93

...I get a crash saying:

Program received signal: “EXC_BAD_ACCESS”.
warning: Could not find object file
"/private/tmp/mrr/trunk/array.o" - no debug information available for
"array.c".
warning: Could not find object file
"/private/tmp/mrr/trunk/bignum.o" - no debug information available for
"bignum.c".
warning: Could not find object file
"/private/tmp/mrr/trunk/class.o" - no debug information available for
"class.c".
...
(a total of about 80 warnings for missing *.o files)


Lukhnos (the author of ObjectiveFlickr) suggests it might be a case of
primitive C types being passed to the delegate.

Please advise - is it a bug in MacRuby that I should submit a ticket
for or is there a way to avoid that?

-- 
Regards,
Łukasz Adamczak
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #256: Compilation is broken

2009-05-20 Thread MacRuby
#256: Compilation is broken
+---
 Reporter:  hipertrac...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:  compilation trunk
+---
 I cannot compile MacRuby from source.

 Mac OS-X 10.5.7 (PowerMac, 2x2.8GHz Xeon)

 MacRuby SVN rev1579

 llvm v2.5.0 (installed with MacPorts)

 {{{
 # rake

 (in /usr/local/src/macruby-experimental)
 /usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new
 rm miniprelude.c.new
 /usr/bin/g++ -I/opt/local/include  -D_DEBUG  -D_GNU_SOURCE
 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3   -Woverloaded-virtual
 -I. -I./include -g -Wall -arch i386 -arch x86_64 -Wno-parentheses -Wno-
 deprecated-declarations -Werror -c roxor.cpp -o roxor.o
 roxor.cpp: In member function ‘void
 RoxorJITManager::SetDlsymTable(void*)’:
 roxor.cpp:136: error: ‘class llvm::JITMemoryManager’ has no member named
 ‘SetDlsymTable’
 roxor.cpp: In member function ‘void* RoxorJITManager::getDlsymTable()
 const’:
 roxor.cpp:140: error: ‘class llvm::JITMemoryManager’ has no member named
 ‘getDlsymTable’
 roxor.cpp: In member function ‘void
 RoxorJITManager::SetDlsymTable(void*)’:
 roxor.cpp:136: error: ‘class llvm::JITMemoryManager’ has no member named
 ‘SetDlsymTable’
 roxor.cpp: In member function ‘void* RoxorJITManager::getDlsymTable()
 const’:
 roxor.cpp:140: error: ‘class llvm::JITMemoryManager’ has no member named
 ‘getDlsymTable’
 lipo: can't figure out the architecture type of: /var/tmp//ccLRmo1B.out
 rake aborted!
 Command failed with status (1): [/usr/bin/g++ -I/opt/local/include
 -D_DEBU...]
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #256: Compilation is broken

2009-05-20 Thread MacRuby
#256: Compilation is broken
+---
 Reporter:  hipertrac...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  blocker |Milestone:   
Component:  MacRuby |   Resolution:  invalid  
 Keywords:  compilation trunk   |  
+---
Changes (by mattaimone...@…):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 You are not trying to compile trunk but the experimental branch. For the
 moment only miniruby compiles properly. We are aware of the situation and
 this is going to be solved soon.

 Thanks for the taking the time to file a ticket tho.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread Brian Chapados
I didn't use the hotcocoa cli interface to generate the file, so I
don't have a Rakefile or anything.  I just used a text editor and
followed an old example[1]. Try putting the ruby code into a file
called 'shortcutapp.rb' and type:

[1]: http://andymatuschak.org/articles/2008/09/12/hotcocoa-is-pretty-damn-hot/

macruby shortcutapp.rb

If you want to package things up into an actual .app bundle, then you
would need a slightly different approach.   It shouldn't be too bad,
since hotcocoa helps you layout your code in a sensible way.  Make
sure the above works first, then go from there.

On Wed, May 20, 2009 at 2:53 AM, isaac kearse  wrote:
> Hi Brian,
> I tried running your minimal app but it crashed with a similar error.  Here
> are all the gory details (including Problem Details and System Profile from
> the crash reporter):
> http://gist.github.com/114723
>
> I have also put the whole directory structure for the minimal hotcocoa app
> on github so we can be sure we are running exactly the same app:
> http://github.com/isaac/shortcut/tree/master
> I also got a few more warnings when compiling shortcut.m but I am assuming I
> can just ignore them? (I included them at the bottom of the gist also)
> Cheers,
> Isaac
> On Wed, May 20, 2009 at 1:10 PM, isaac kearse  wrote:
>>
>> Yeah I think you're right.  I was calling it inside a hotcocoa app but not
>> in the application context.  I'll try it out tonight and let you know how it
>> goes.
>> Thanks a lot for walking me through this.
>> On Wed, May 20, 2009 at 12:47 PM, Brian Chapados  wrote:
>>>
>>> I'm not sure how you're testing this, but beware of doing this from a
>>> command line-only script or through macirb.  I suspect you need to be
>>> in an Application context (or hook into the event loop through some
>>> other means).  It works from a minimal hotcocoa app:
>>> http://gist.github.com/114523
>>>
>>> I also made some slight modifications to your Obj-C code to add a
>>> delegate that gives you a callback hook that you can define in Ruby.
>>> There is probably a better way to do this, but this was fast.
>>> see: http://gist.github.com/114521
>>>
>>> Note that I changed the keyboard shortcut to controlKey+optionKey, so
>>> you'll need to press Control+Option+Space.
>>>
>>>
>>> On Tue, May 19, 2009 at 4:33 PM, isaac kearse 
>>> wrote:
>>> > Hey thanks Brian that worked!
>>> > I tried compiling with the Carbon Framework but I didn't think to try
>>> > it
>>> > with both Carbon and Foundation.  I still got the warning "makes
>>> > pointer
>>> > from integer without a cast" but I'm just ignoring that :)
>>> > So the bundle was created and I compiled it and required it my app.
>>> > But when I actually call it with "Shortcut.new.addShortcut" (from the
>>> > start
>>> > method in my application.rb) I get a nasty error:
>>> > isaac:~/src/tasks isaac$ macrake
>>> > (in /Users/isaac/src/tasks)
>>> >
>>> > /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:
>>> > [BUG] Segmentation fault
>>> > MacRuby version 0.4 (ruby 1.9.1) [universal-darwin9.0, x86_64]
>>> > -- stack frame 
>>> >  (0xc0860): 0004
>>> > 0001 (0xc0868): 
>>> > 0002 (0xc0870): 0004
>>> > 0003 (0xc0878): 
>>> > 0004 (0xc0880): 0004
>>> > 0005 (0xc0888): 
>>> > 0006 (0xc0890): 0004
>>> > 0007 (0xc0898): 80003ffe0
>>> > 0008 (0xc08a0): 0004
>>> > 0009 (0xc08a8): 
>>> > 0010 (0xc08b0): 0004
>>> > 0011 (0xc08b8): 
>>> > 0012 (0xc08c0): 0004
>>> > 0013 (0xc08c8): 
>>> > 0014 (0xc08d0): 8004f3380
>>> > 0015 (0xc08d8): 0004
>>> > 0016 (0xc08e0): 
>>> > 0017 (0xc08e8): 8004eb020
>>> > 0018 (0xc08f0): 0004
>>> > 0019 (0xc08f8):  <- lfp <- dfp
>>> > -- control frame --
>>> > c:0008 p: s:0020 b:0020 l:19 d:19 CFUNC  :addShortcut
>>> > c:0007 p:0019 s:0017 b:0017 l:16 d:16 METHOD
>>> >
>>> > /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12
>>> > c:0006 p:0103 s:0014 b:0014 l:13 d:13 TOP
>>> >
>>> >  /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:297
>>> > c:0005 p: s:0012 b:0012 l:11 d:11 FINISH :set_encoding:
>>> > c:0004 p: s:0010 b:0010 l:09 d:09 CFUNC  :load
>>> > c:0003 p:0043 s:0006 b:0006 l:05 d:05 TOP
>>> >  /Users/isaac/src/tasks/Tasks.app/Contents/Resources/rb_main.rb:2
>>> > c:0002 p: s:0004 b:0004 l:03 d:03 FINISH :inherited:
>>> > c:0001 p: s:0002 b:0002 l:01 d:01 TOP
>>> > ---
>>> > DBG> :
>>> >
>>> > "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:in
>>> > `addShortcut'"
>>> > DBG> :
>>> >
>>> > "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:in
>>> > `start'"
>>> > DBG> :
>>> >
>>> > "/Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:297:in
>>> 

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread Brian Chapados
I was able to reproduce your bug, and have a fix. This was somewhat
obscure, but RTFM to the rescue...

Note that GetApplicationEventTarget is not available on 64-bit systems
(see Notes in the docs):
http://developer.apple.com/documentation/Carbon/Reference/Carbon_Event_Manager_Ref/Reference/reference.html#//apple_ref/c/func/GetApplicationEventTarget

Although you were not calling it directly, the macro
InstallApplicationEventHandler() was calling it for you. I had
compiled macruby with archs="i386" so it was working fine for me.
When I did a default build it broke.

In general, always double-check any Carbon stuff for
64bit-compatibility issues. I think Apple has said that Carbon is
being phased out.  Maybe someone else knows more about that than I do.

To make a long story short, just use GetEventMonitorTarget() to send
your hotkey event to the event monitor.  That seems to be available on
both platforms.

I updated the gists with the new Obj-C code and hotcocoa file.
Obj-C: http://gist.github.com/114521
hotcocoa: http://gist.github.com/114523

Brian


On Wed, May 20, 2009 at 9:11 AM, Brian Chapados  wrote:
> I didn't use the hotcocoa cli interface to generate the file, so I
> don't have a Rakefile or anything.  I just used a text editor and
> followed an old example[1]. Try putting the ruby code into a file
> called 'shortcutapp.rb' and type:
>
> [1]: http://andymatuschak.org/articles/2008/09/12/hotcocoa-is-pretty-damn-hot/
>
> macruby shortcutapp.rb
>
> If you want to package things up into an actual .app bundle, then you
> would need a slightly different approach.   It shouldn't be too bad,
> since hotcocoa helps you layout your code in a sensible way.  Make
> sure the above works first, then go from there.
>
> On Wed, May 20, 2009 at 2:53 AM, isaac kearse  wrote:
>> Hi Brian,
>> I tried running your minimal app but it crashed with a similar error.  Here
>> are all the gory details (including Problem Details and System Profile from
>> the crash reporter):
>> http://gist.github.com/114723
>>
>> I have also put the whole directory structure for the minimal hotcocoa app
>> on github so we can be sure we are running exactly the same app:
>> http://github.com/isaac/shortcut/tree/master
>> I also got a few more warnings when compiling shortcut.m but I am assuming I
>> can just ignore them? (I included them at the bottom of the gist also)
>> Cheers,
>> Isaac
>> On Wed, May 20, 2009 at 1:10 PM, isaac kearse  wrote:
>>>
>>> Yeah I think you're right.  I was calling it inside a hotcocoa app but not
>>> in the application context.  I'll try it out tonight and let you know how it
>>> goes.
>>> Thanks a lot for walking me through this.
>>> On Wed, May 20, 2009 at 12:47 PM, Brian Chapados  wrote:

 I'm not sure how you're testing this, but beware of doing this from a
 command line-only script or through macirb.  I suspect you need to be
 in an Application context (or hook into the event loop through some
 other means).  It works from a minimal hotcocoa app:
 http://gist.github.com/114523

 I also made some slight modifications to your Obj-C code to add a
 delegate that gives you a callback hook that you can define in Ruby.
 There is probably a better way to do this, but this was fast.
 see: http://gist.github.com/114521

 Note that I changed the keyboard shortcut to controlKey+optionKey, so
 you'll need to press Control+Option+Space.


 On Tue, May 19, 2009 at 4:33 PM, isaac kearse 
 wrote:
 > Hey thanks Brian that worked!
 > I tried compiling with the Carbon Framework but I didn't think to try
 > it
 > with both Carbon and Foundation.  I still got the warning "makes
 > pointer
 > from integer without a cast" but I'm just ignoring that :)
 > So the bundle was created and I compiled it and required it my app.
 > But when I actually call it with "Shortcut.new.addShortcut" (from the
 > start
 > method in my application.rb) I get a nasty error:
 > isaac:~/src/tasks isaac$ macrake
 > (in /Users/isaac/src/tasks)
 >
 > /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:
 > [BUG] Segmentation fault
 > MacRuby version 0.4 (ruby 1.9.1) [universal-darwin9.0, x86_64]
 > -- stack frame 
 >  (0xc0860): 0004
 > 0001 (0xc0868): 
 > 0002 (0xc0870): 0004
 > 0003 (0xc0878): 
 > 0004 (0xc0880): 0004
 > 0005 (0xc0888): 
 > 0006 (0xc0890): 0004
 > 0007 (0xc0898): 80003ffe0
 > 0008 (0xc08a0): 0004
 > 0009 (0xc08a8): 
 > 0010 (0xc08b0): 0004
 > 0011 (0xc08b8): 
 > 0012 (0xc08c0): 0004
 > 0013 (0xc08c8): 
 > 0014 (0xc08d0): 8004f3380
 > 0015 (0xc08d8): 0004
 > 0016 (0xc08e0): 
 > 0017 (0xc08e8): 8004eb020
 > 0018 (0xc08f0): 

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread isaac kearse
Brian you are a legend,That works perfectly, no errors or warnings.

I think I might have run into a similar issue when I tried to compile this
framework:
http://github.com/Caged/aixmlserialize/tree/master
(NSXMLDocument => NSDictionary conversion)
I ended up just extracting the one method that I was using and packaging it
into a bundle.

If it happens again I might have to switch to 32bit, or maybe its better to
stick with 64bit as 32bit-only APIs will probably be phased out eventually.

Thanks again for all your help,
Isaac


On Thu, May 21, 2009 at 7:23 AM, Brian Chapados  wrote:

> I was able to reproduce your bug, and have a fix. This was somewhat
> obscure, but RTFM to the rescue...
>
> Note that GetApplicationEventTarget is not available on 64-bit systems
> (see Notes in the docs):
>
> http://developer.apple.com/documentation/Carbon/Reference/Carbon_Event_Manager_Ref/Reference/reference.html#//apple_ref/c/func/GetApplicationEventTarget
>
> Although you were not calling it directly, the macro
> InstallApplicationEventHandler() was calling it for you. I had
> compiled macruby with archs="i386" so it was working fine for me.
> When I did a default build it broke.
>
> In general, always double-check any Carbon stuff for
> 64bit-compatibility issues. I think Apple has said that Carbon is
> being phased out.  Maybe someone else knows more about that than I do.
>
> To make a long story short, just use GetEventMonitorTarget() to send
> your hotkey event to the event monitor.  That seems to be available on
> both platforms.
>
> I updated the gists with the new Obj-C code and hotcocoa file.
> Obj-C: http://gist.github.com/114521
> hotcocoa: http://gist.github.com/114523
>
> Brian
>
>
> On Wed, May 20, 2009 at 9:11 AM, Brian Chapados  wrote:
> > I didn't use the hotcocoa cli interface to generate the file, so I
> > don't have a Rakefile or anything.  I just used a text editor and
> > followed an old example[1]. Try putting the ruby code into a file
> > called 'shortcutapp.rb' and type:
> >
> > [1]:
> http://andymatuschak.org/articles/2008/09/12/hotcocoa-is-pretty-damn-hot/
> >
> > macruby shortcutapp.rb
> >
> > If you want to package things up into an actual .app bundle, then you
> > would need a slightly different approach.   It shouldn't be too bad,
> > since hotcocoa helps you layout your code in a sensible way.  Make
> > sure the above works first, then go from there.
> >
> > On Wed, May 20, 2009 at 2:53 AM, isaac kearse 
> wrote:
> >> Hi Brian,
> >> I tried running your minimal app but it crashed with a similar error.
>  Here
> >> are all the gory details (including Problem Details and System Profile
> from
> >> the crash reporter):
> >> http://gist.github.com/114723
> >>
> >> I have also put the whole directory structure for the minimal hotcocoa
> app
> >> on github so we can be sure we are running exactly the same app:
> >> http://github.com/isaac/shortcut/tree/master
> >> I also got a few more warnings when compiling shortcut.m but I am
> assuming I
> >> can just ignore them? (I included them at the bottom of the gist also)
> >> Cheers,
> >> Isaac
> >> On Wed, May 20, 2009 at 1:10 PM, isaac kearse 
> wrote:
> >>>
> >>> Yeah I think you're right.  I was calling it inside a hotcocoa app but
> not
> >>> in the application context.  I'll try it out tonight and let you know
> how it
> >>> goes.
> >>> Thanks a lot for walking me through this.
> >>> On Wed, May 20, 2009 at 12:47 PM, Brian Chapados 
> wrote:
> 
>  I'm not sure how you're testing this, but beware of doing this from a
>  command line-only script or through macirb.  I suspect you need to be
>  in an Application context (or hook into the event loop through some
>  other means).  It works from a minimal hotcocoa app:
>  http://gist.github.com/114523
> 
>  I also made some slight modifications to your Obj-C code to add a
>  delegate that gives you a callback hook that you can define in Ruby.
>  There is probably a better way to do this, but this was fast.
>  see: http://gist.github.com/114521
> 
>  Note that I changed the keyboard shortcut to controlKey+optionKey, so
>  you'll need to press Control+Option+Space.
> 
> 
>  On Tue, May 19, 2009 at 4:33 PM, isaac kearse 
>  wrote:
>  > Hey thanks Brian that worked!
>  > I tried compiling with the Carbon Framework but I didn't think to
> try
>  > it
>  > with both Carbon and Foundation.  I still got the warning "makes
>  > pointer
>  > from integer without a cast" but I'm just ignoring that :)
>  > So the bundle was created and I compiled it and required it my app.
>  > But when I actually call it with "Shortcut.new.addShortcut" (from
> the
>  > start
>  > method in my application.rb) I get a nasty error:
>  > isaac:~/src/tasks isaac$ macrake
>  > (in /Users/isaac/src/tasks)
>  >
>  >
> /Users/isaac/src/tasks/Tasks.app/Contents/Resources/lib/application.rb:12:
>  > [BUG] Seg

[MacRuby-devel] Adobe Illustrator scripting with MacRuby

2009-05-20 Thread Chris Brown
Can anyone post an example of how to add (1) a layer and (2) a path  
object to an Adobe Illustrator document? I am able to do these things  
using rb-appscript with Ruby 1.8, but have not been successful with  
MacRuby and ScriptingBridge. I have also failed trying to get  
appscript to work with MacRuby.


This works (irb):

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'appscript'
=> true
irb(main):003:0> include Appscript
=> Object
irb(main):004:0> ai = app('Adobe Illustrator')
=> app("/Applications/Adobe Illustrator CS3/Adobe Illustrator.app")
irb(main):005:0> doc = ai.documents[1]
=> app("/Applications/Adobe Illustrator CS3/Adobe  
Illustrator.app").documents[1]

irb(main):006:0> doc.name.get
=> "Sample.ai"
irb(main):007:0> doc.make(:new => :layer, :with_properties => {:name  
=> 'Test'})
=> app("/Applications/Adobe Illustrator CS3/Adobe  
Illustrator.app").documents[1].layers[1]



I get this far with macirb:

>> framework 'ScriptingBridge'
=> true
>> ai =  
SBApplication.applicationWithBundleIdentifier('com.adobe.illustrator')

=> #
>> doc = ai.currentDocument
=> #
>> doc.name
=> "Sample.ai"

I can query and set properties on my Illustrator documents, no  
problem. It is creating new objects that is not working for me.


I am running plain-vanilla MacRuby 0.4 on a 2 x 2.8 Quad-Core Xeon, OS  
10.5.7.


Thanks in advance,

- Chris

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #256: Compilation is broken

2009-05-20 Thread MacRuby
#256: Compilation is broken
+---
 Reporter:  hipertrac...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  blocker |Milestone:   
Component:  MacRuby |   Resolution:  invalid  
 Keywords:  compilation trunk   |  
+---

Comment(by vincent.isamb...@…):

 > llvm v2.5.0 (installed with MacPorts)

 The experimental branch won't compile with llvm 2.5.0, it requires a more
 recent version (trunk) of llvm. llvm 2.5 has problems with exception
 handling.

 From README.rdoc:

 {{{
 * LLVM trunk, compiled for both i386 and x86_64.

   In case trunk reveals to be unstable we recommend revision 67244.

 $ svn co -r 67244 https://llvm.org/svn/llvm-project/llvm/trunk llvm-
 trunk
 $ cd llvm-trunk
 $ ./configure
 $ UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make
 $ sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1
 make install
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel