[MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Louis-Philippe
Hi,
I don't know if this is the good list to ask this question as it is my
first...
So,

I saw how I can have a MacRuby cocoa app, importing objective-c classes.
I can't find info on how to do the opposite...  having an Objective-C cocoa
app, importing and using MacRuby Classes...

All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"

Thanks!

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


Re: [MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Louis-Philippe
great!
I can even seem to send messages directly to my MacRuby classes and
instances...
like:
id obj = [Foo new:@"objc"];
and
[obj hello];

but in the second case I get a compiler warning: "No -hello method found"??

2010/5/18 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> Assuming MacRuby code defines:
>
> class Foo
>  def initialize(message)
>@message
>  end
>  def hello
>puts "hello #{message}"
>  end
> end
>
> You should be able to retrieve a reference to Foo using:
>
> Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
>
> Or, more simply:
>
> Class foo = NSClassFromString(@"Foo");
>
> You might want to use the first way in case the class has a complex path
> (if it's defined inside modules, like "Foo::Bar").
>
> Later, you can send messages to it.
>
> id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc",
> nil];
> [obj performRubySelector:@selector(hello)];
>
> Laurent
>
> On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:
>
> > Hi,
> > I don't know if this is the good list to ask this question as it is my
> first...
> > So,
> >
> > I saw how I can have a MacRuby cocoa app, importing objective-c classes.
> > I can't find info on how to do the opposite...  having an Objective-C
> cocoa app, importing and using MacRuby Classes...
> >
> > All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
> >
> > Thanks!
> >
> > L-P
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby class inside obj-c

2010-05-19 Thread Louis-Philippe
And by trying a bit I see blocks are not supported,
am I right?

2010/5/18 Laurent Sansonetti 

> Indeed, methods with normal arities (0..n arguments) conform to the
> Objective-C ABI, so using the bracket syntax just works. But for Ruby
> methods using complex arities (like splat or optional arguments), you will
> likely get a crash. This is why the -performRubySelector: method was
> introduced. It is better to always use that method, because it always works
> (in theory).
>
> Laurent
>
>
> On May 18, 2010, at 3:05 PM, Louis-Philippe wrote:
>
> great!
> I can even seem to send messages directly to my MacRuby classes and
> instances...
> like:
> id obj = [Foo new:@"objc"];
> and
> [obj hello];
>
> but in the second case I get a compiler warning: "No -hello method found"??
>
> 2010/5/18 Laurent Sansonetti 
>
>> Hi Louis-Philippe,
>>
>> Assuming MacRuby code defines:
>>
>> class Foo
>>  def initialize(message)
>>@message
>>  end
>>  def hello
>>puts "hello #{message}"
>>  end
>> end
>>
>> You should be able to retrieve a reference to Foo using:
>>
>> Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
>>
>> Or, more simply:
>>
>> Class foo = NSClassFromString(@"Foo");
>>
>> You might want to use the first way in case the class has a complex path
>> (if it's defined inside modules, like "Foo::Bar").
>>
>> Later, you can send messages to it.
>>
>> id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc",
>> nil];
>> [obj performRubySelector:@selector(hello)];
>>
>> Laurent
>>
>> On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:
>>
>> > Hi,
>> > I don't know if this is the good list to ask this question as it is my
>> first...
>> > So,
>> >
>> > I saw how I can have a MacRuby cocoa app, importing objective-c classes.
>> > I can't find info on how to do the opposite...  having an Objective-C
>> cocoa app, importing and using MacRuby Classes...
>> >
>> > All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
>> >
>> > Thanks!
>> >
>> > L-P
>> > ___
>> > MacRuby-devel mailing list
>> > MacRuby-devel@lists.macosforge.org
>> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] CSV still buggy

2010-05-19 Thread Louis-Philippe
Hi,
I saw:
Ticket #125 (closed defect: fixed)
about CSV.

I do a pretty simple test:
###
require 'csv'

CSV.open('testCSV.csv', 'r') do |row|
  p row
end
###

this test works in ruby 1.8.7, but in macruby 0.6 I get an empty reader...
my arch is: MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

thanks!

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


[MacRuby-devel] c++ lib

2010-05-26 Thread Louis-Philippe
Hi folks,

I need to work with a c++ sdk in my code.
Is this possible within macruby?

I tried loading the files all sorts of way and making a bundle with it and
got no luck at this point...

thanks!

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


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
So far, I got my c++ sdk in a framework (without objc wrapper) I can call it
from objective-c...
but macruby is not happy with it, importing it with 'framework
"./MYSDK.framework"', I get:

RuntimeError: framework at path `./MYSDK.framework' cannot be loaded: Error
Domain=NSCocoaErrorDomain Code=3585 UserInfo=0x2002b5080 "The bundle
“MYSDK.framework” couldn’t be loaded because it doesn’t contain a version
for the current architecture."
(dlopen_preflight(/PATH/MYSDK.framework/MYSDK): no suitable image found.
 Did find:
/PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
from /PATH/(irb):2:in `'

2010/5/26 Thibault Martin-Lagardette 

> Hi!
>
> That's exactly what I was going to recommend.
> MacRuby is able to interact with Obj-C, so you can write an Obj-C++ wrapper
> (.mm files) around your SDK, and then use it with MacRuby :-)
>
> Any of you two, if you manage / managed to do it, please do not hesitate
> sharing the recipe to the world :-).
>
> --
> Thibault Martin-Lagardette
>
>
>
> On May 26, 2010, at 11:31, Gregoire LEJEUNE wrote:
>
> > I do it with a C lib (but it must be the same with C++). First I
> > create a ObjC class over my C lib. Then i can use my ObjC class within
> > MacRuby.
> >
> > Greg
> >
> > 2010/5/26 Louis-Philippe :
> >> Hi folks,
> >> I need to work with a c++ sdk in my code.
> >> Is this possible within macruby?
> >> I tried loading the files all sorts of way and making a bundle with it
> and
> >> got no luck at this point...
> >> thanks!
> >> L-P
> >> ___
> >> MacRuby-devel mailing list
> >> MacRuby-devel@lists.macosforge.org
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >>
> >>
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
uname -a:
Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26
11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

./MYSDK (from the MYSDK.framework)
-bash: ./R3DSDK: No such file or directory

which macruby:
/usr/local/bin/macruby

by the way, I tried it in a MacRuby cocoa app inside of xcode, but the error
sample I pasted above is from a macirb execution


2010/5/27 Joel Reymont 

> Louis-Philippe,
>
> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>
> > Did find:
> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
> >   from /PATH/(irb):2:in `'
>
> Can you paste the output from the following?
>
> uname -a
>
> file ATH/MYSDK.framework/MYSDK
>
> file `which macruby`
>
>Thanks, Joel
>
> ---
> http://twitter.com/wagerlabs
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
sorry, the second one really is:

./MYSDK (from the MYSDK.framework)
-bash: ./MYSDK: cannot execute binary file

2010/5/27 Louis-Philippe 

> uname -a:
> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26
> 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>
> ./MYSDK (from the MYSDK.framework)
> -bash: ./R3DSDK: No such file or directory
>
> which macruby:
> /usr/local/bin/macruby
>
> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
> error sample I pasted above is from a macirb execution
>
>
> 2010/5/27 Joel Reymont 
>
> Louis-Philippe,
>>
>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>
>> > Did find:
>> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>> >   from /PATH/(irb):2:in `'
>>
>> Can you paste the output from the following?
>>
>> uname -a
>>
>> file ATH/MYSDK.framework/MYSDK
>>
>> file `which macruby`
>>
>>Thanks, Joel
>>
>> ---
>> http://twitter.com/wagerlabs
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
file PATH/MYSDK.framework/MYSDK
./MYSDK: Mach-O dynamically linked shared library i386

file `which macruby`:
/usr/local/bin/macruby: Mach-O universal binary with 2 architectures
/usr/local/bin/macruby (for architecture i386): Mach-O executable i386
/usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit executable
x86_64


2010/5/27 Louis-Philippe 

> sorry, the second one really is:
>
> ./MYSDK (from the MYSDK.framework)
> -bash: ./MYSDK: cannot execute binary file
>
> 2010/5/27 Louis-Philippe 
>
> uname -a:
>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb
>> 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>
>> ./MYSDK (from the MYSDK.framework)
>> -bash: ./R3DSDK: No such file or directory
>>
>> which macruby:
>> /usr/local/bin/macruby
>>
>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
>> error sample I pasted above is from a macirb execution
>>
>>
>> 2010/5/27 Joel Reymont 
>>
>> Louis-Philippe,
>>>
>>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>>
>>> > Did find:
>>> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>>> >   from /PATH/(irb):2:in `'
>>>
>>> Can you paste the output from the following?
>>>
>>> uname -a
>>>
>>> file ATH/MYSDK.framework/MYSDK
>>>
>>> file `which macruby`
>>>
>>>Thanks, Joel
>>>
>>> ---
>>> http://twitter.com/wagerlabs
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> MacRuby-devel@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>
>>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
it only builds for i386...
getting errors when trying to build for x86_64...
thats why I tried as I tested to build only for i386...

2010/5/27 Jordan Breeding 

> Try building your framework as both i386 and x86_64.
>
> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>
> file PATH/MYSDK.framework/MYSDK
> ./MYSDK: Mach-O dynamically linked shared library i386
>
> file `which macruby`:
> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
> /usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit executable
> x86_64
>
>
> 2010/5/27 Louis-Philippe 
>
>> sorry, the second one really is:
>>
>> ./MYSDK (from the MYSDK.framework)
>> -bash: ./MYSDK: cannot execute binary file
>>
>> 2010/5/27 Louis-Philippe 
>>
>> uname -a:
>>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb
>>> 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>>
>>> ./MYSDK (from the MYSDK.framework)
>>> -bash: ./R3DSDK: No such file or directory
>>>
>>> which macruby:
>>> /usr/local/bin/macruby
>>>
>>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
>>> error sample I pasted above is from a macirb execution
>>>
>>>
>>> 2010/5/27 Joel Reymont 
>>>
>>> Louis-Philippe,
>>>>
>>>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>>>
>>>> > Did find:
>>>> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>>>> >   from /PATH/(irb):2:in `'
>>>>
>>>> Can you paste the output from the following?
>>>>
>>>> uname -a
>>>>
>>>> file ATH/MYSDK.framework/MYSDK
>>>>
>>>> file `which macruby`
>>>>
>>>>Thanks, Joel
>>>>
>>>> ---
>>>> http://twitter.com/wagerlabs
>>>>
>>>> ___
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel@lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>
>>>
>>>
>>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
Thanks!
ok... I sorted some of the issues out... I was able to make a x86_64
framework out of the SDK by including the proper exports symbols (using nm
with the -arch flag).

so now it loads fine with the framework method...
but I cant access the c++ namespace:
"NameError: uninitialized constant MYSDK"

2010/5/27 Jordan Breeding 

> Then you could force macruby/macirb to run as i386:
>
> `arch -arch i386 macirb`
>
> On May 27, 2010, at 10:13, Louis-Philippe wrote:
>
> it only builds for i386...
> getting errors when trying to build for x86_64...
> thats why I tried as I tested to build only for i386...
>
> 2010/5/27 Jordan Breeding 
>
>> Try building your framework as both i386 and x86_64.
>>
>> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>>
>> file PATH/MYSDK.framework/MYSDK
>> ./MYSDK: Mach-O dynamically linked shared library i386
>>
>> file `which macruby`:
>> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
>> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
>> /usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit
>> executable x86_64
>>
>>
>> 2010/5/27 Louis-Philippe 
>>
>>> sorry, the second one really is:
>>>
>>> ./MYSDK (from the MYSDK.framework)
>>> -bash: ./MYSDK: cannot execute binary file
>>>
>>> 2010/5/27 Louis-Philippe 
>>>
>>> uname -a:
>>>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb
>>>> 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>>>
>>>> ./MYSDK (from the MYSDK.framework)
>>>> -bash: ./R3DSDK: No such file or directory
>>>>
>>>> which macruby:
>>>> /usr/local/bin/macruby
>>>>
>>>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
>>>> error sample I pasted above is from a macirb execution
>>>>
>>>>
>>>> 2010/5/27 Joel Reymont 
>>>>
>>>> Louis-Philippe,
>>>>>
>>>>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>>>>
>>>>> > Did find:
>>>>> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>>>>> >   from /PATH/(irb):2:in `'
>>>>>
>>>>> Can you paste the output from the following?
>>>>>
>>>>> uname -a
>>>>>
>>>>> file ATH/MYSDK.framework/MYSDK
>>>>>
>>>>> file `which macruby`
>>>>>
>>>>>Thanks, Joel
>>>>>
>>>>> ---
>>>>> http://twitter.com/wagerlabs
>>>>>
>>>>> ___
>>>>> MacRuby-devel mailing list
>>>>> MacRuby-devel@lists.macosforge.org
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>>
>>>>
>>>>
>>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
any idea why gen_bridge_metadata does spit this:

gen_bridge_metadata --64-bit -f ./MYSDK.framework -o MYSDK.bridgesupport
./MYSDK.framework/Headers/MYSDK.h:21:18: error: string: No such file or
directory
/usr/bin/cpp-4.2 returned 1 exit status
line was: /usr/bin/cpp-4.2 -D__APPLE_CPP__ -include
/usr/include/AvailabilityMacros.h -F"."
"./MYSDK.framework/Headers/MYSDK.h" 2>/tmp/.cpp.err
Usage: gen_bridge_metadata [options] 
Use the `-h' flag or consult gen_bridge_metadata(1) for help.

it's referring to this line in the SDK header:
#include 

and the SDK uses std::string all over the place...
why is it complaining like this?


2010/5/27 Jordan Breeding 

> You might have to make a bridge support file and include it in your
> framework.
>
> Something like this (although this is specific to running inside my Xcode
> project build):
>
> printf "Building BridgeSupport files...\n\n"
>
> BRIDGE_SUPPORT_DIR="Resources/BridgeSupport"
> BRIDGE_SUPPORT_FILE="${BRIDGE_SUPPORT_DIR}/${TARGET_NAME}.bridgesupport"
>
> if [[ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${TARGET_NAME}" -nt
> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}" ]]; then
>   if [[ ! -d "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
> ]]; then
> mkdir -p "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>   fi
>   gen_bridge_metadata --64-bit --framework
> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}" -o
> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}"
> fi
>
> On May 27, 2010, at 10:31, Louis-Philippe wrote:
>
> Thanks!
> ok... I sorted some of the issues out... I was able to make a x86_64
> framework out of the SDK by including the proper exports symbols (using nm
> with the -arch flag).
>
> so now it loads fine with the framework method...
> but I cant access the c++ namespace:
> "NameError: uninitialized constant MYSDK"
>
> 2010/5/27 Jordan Breeding 
>
>> Then you could force macruby/macirb to run as i386:
>>
>> `arch -arch i386 macirb`
>>
>> On May 27, 2010, at 10:13, Louis-Philippe wrote:
>>
>> it only builds for i386...
>> getting errors when trying to build for x86_64...
>> thats why I tried as I tested to build only for i386...
>>
>> 2010/5/27 Jordan Breeding 
>>
>>> Try building your framework as both i386 and x86_64.
>>>
>>> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>>>
>>> file PATH/MYSDK.framework/MYSDK
>>> ./MYSDK: Mach-O dynamically linked shared library i386
>>>
>>> file `which macruby`:
>>> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
>>> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
>>> /usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit
>>> executable x86_64
>>>
>>>
>>> 2010/5/27 Louis-Philippe 
>>>
>>>> sorry, the second one really is:
>>>>
>>>> ./MYSDK (from the MYSDK.framework)
>>>> -bash: ./MYSDK: cannot execute binary file
>>>>
>>>> 2010/5/27 Louis-Philippe 
>>>>
>>>> uname -a:
>>>>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri
>>>>> Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>>>>
>>>>> ./MYSDK (from the MYSDK.framework)
>>>>> -bash: ./R3DSDK: No such file or directory
>>>>>
>>>>> which macruby:
>>>>> /usr/local/bin/macruby
>>>>>
>>>>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
>>>>> error sample I pasted above is from a macirb execution
>>>>>
>>>>>
>>>>> 2010/5/27 Joel Reymont 
>>>>>
>>>>> Louis-Philippe,
>>>>>>
>>>>>> On May 27, 2010, at 3:25 PM, Louis-Philippe wrote:
>>>>>>
>>>>>> > Did find:
>>>>>> >   /PATH/MYSDK.framework/MYSDK: mach-o, but wrong architecture)
>>>>>> >   from /PATH/(irb):2:in `'
>>>>>>
>>>>>> Can you paste the output from the following?
>>>>>>
>>>>>> uname -a
>>>>>>
>>>>>> file ATH/MYSDK.framework/MYSDK
>>>>>>
>>>>>> file `which macruby`
>>>>>>
>>>>>>Thanks, Joel
>>>>>>
>>>>>> ---
>>>>&

Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
I see on the BridgeSupport support to redirect all request to Laurent...
so here it is...

Laurent,
Is it desperate to keep trying every options of gen_bridge_metadata?
will it swallow my c++ framework at some point?

thanks

2010/5/27 Jordan Breeding 

> Don't know, the only times I have used that method the header file itself
> is just straight C, the implementation hides all of the C++ in my case.
> Maybe gen_bridge_metadata doesn't handle C++.
>
> On May 27, 2010, at 11:49, Louis-Philippe wrote:
>
> any idea why gen_bridge_metadata does spit this:
>
> gen_bridge_metadata --64-bit -f ./MYSDK.framework -o MYSDK.bridgesupport
> ./MYSDK.framework/Headers/MYSDK.h:21:18: error: string: No such file or
> directory
> /usr/bin/cpp-4.2 returned 1 exit status
> line was: /usr/bin/cpp-4.2 -D__APPLE_CPP__ -include
> /usr/include/AvailabilityMacros.h -F"."
> "./MYSDK.framework/Headers/MYSDK.h" 2>/tmp/.cpp.err
> Usage: gen_bridge_metadata [options] 
> Use the `-h' flag or consult gen_bridge_metadata(1) for help.
>
> it's referring to this line in the SDK header:
> #include 
>
> and the SDK uses std::string all over the place...
> why is it complaining like this?
>
>
> 2010/5/27 Jordan Breeding 
>
>> You might have to make a bridge support file and include it in your
>> framework.
>>
>> Something like this (although this is specific to running inside my Xcode
>> project build):
>>
>> printf "Building BridgeSupport files...\n\n"
>>
>> BRIDGE_SUPPORT_DIR="Resources/BridgeSupport"
>> BRIDGE_SUPPORT_FILE="${BRIDGE_SUPPORT_DIR}/${TARGET_NAME}.bridgesupport"
>>
>> if [[ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${TARGET_NAME}" -nt
>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}" ]]; then
>>   if [[ ! -d "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>> ]]; then
>> mkdir -p "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>>   fi
>>   gen_bridge_metadata --64-bit --framework
>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}" -o
>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}"
>> fi
>>
>> On May 27, 2010, at 10:31, Louis-Philippe wrote:
>>
>> Thanks!
>> ok... I sorted some of the issues out... I was able to make a x86_64
>> framework out of the SDK by including the proper exports symbols (using nm
>> with the -arch flag).
>>
>> so now it loads fine with the framework method...
>> but I cant access the c++ namespace:
>> "NameError: uninitialized constant MYSDK"
>>
>> 2010/5/27 Jordan Breeding 
>>
>>> Then you could force macruby/macirb to run as i386:
>>>
>>> `arch -arch i386 macirb`
>>>
>>> On May 27, 2010, at 10:13, Louis-Philippe wrote:
>>>
>>> it only builds for i386...
>>> getting errors when trying to build for x86_64...
>>> thats why I tried as I tested to build only for i386...
>>>
>>> 2010/5/27 Jordan Breeding 
>>>
>>>> Try building your framework as both i386 and x86_64.
>>>>
>>>> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>>>>
>>>> file PATH/MYSDK.framework/MYSDK
>>>> ./MYSDK: Mach-O dynamically linked shared library i386
>>>>
>>>> file `which macruby`:
>>>> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
>>>> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
>>>> /usr/local/bin/macruby (for architecture x86_64): Mach-O 64-bit
>>>> executable x86_64
>>>>
>>>>
>>>> 2010/5/27 Louis-Philippe 
>>>>
>>>>> sorry, the second one really is:
>>>>>
>>>>> ./MYSDK (from the MYSDK.framework)
>>>>> -bash: ./MYSDK: cannot execute binary file
>>>>>
>>>>> 2010/5/27 Louis-Philippe 
>>>>>
>>>>> uname -a:
>>>>>> Darwin modullpmacbook.local 10.3.0 Darwin Kernel Version 10.3.0: Fri
>>>>>> Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
>>>>>>
>>>>>> ./MYSDK (from the MYSDK.framework)
>>>>>> -bash: ./R3DSDK: No such file or directory
>>>>>>
>>>>>> which macruby:
>>>>>> /usr/local/bin/macruby
>>>>>>
>>>>>> by the way, I tried it in a MacRuby cocoa app inside of xcode, but the
>>>

Re: [MacRuby-devel] c++ lib

2010-05-27 Thread Louis-Philippe
Thanks Laurent!
MYSDK is a c++ SDK... 4 c++ headers and a c++ binary archive (.a)
I will work out my Objective-C wrapper then!

2010/5/27 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> BridgeSupport doesn't support C++. It only exposes C and Objective-C
> symbols.
>
> In your C++ library, what is MYSDK exactly? If it isn't an Objective-C
> class, it won't be accessible from MacRuby.
>
> In order to use your C++ code in MacRuby, the best way is to wrap the calls
> you need in Objective-C APIs. You can then access them from MacRuby at no
> cost. And a bridgesupport file won't be needed.
>
> Laurent
>
> On May 27, 2010, at 12:48 PM, Louis-Philippe wrote:
>
> I see on the BridgeSupport support to redirect all request to Laurent...
> so here it is...
>
> Laurent,
> Is it desperate to keep trying every options of gen_bridge_metadata?
> will it swallow my c++ framework at some point?
>
> thanks
>
> 2010/5/27 Jordan Breeding 
>
>> Don't know, the only times I have used that method the header file itself
>> is just straight C, the implementation hides all of the C++ in my case.
>> Maybe gen_bridge_metadata doesn't handle C++.
>>
>> On May 27, 2010, at 11:49, Louis-Philippe wrote:
>>
>> any idea why gen_bridge_metadata does spit this:
>>
>> gen_bridge_metadata --64-bit -f ./MYSDK.framework -o MYSDK.bridgesupport
>> ./MYSDK.framework/Headers/MYSDK.h:21:18: error: string: No such file or
>> directory
>> /usr/bin/cpp-4.2 returned 1 exit status
>> line was: /usr/bin/cpp-4.2 -D__APPLE_CPP__ -include
>> /usr/include/AvailabilityMacros.h -F"."
>> "./MYSDK.framework/Headers/MYSDK.h" 2>/tmp/.cpp.err
>> Usage: gen_bridge_metadata [options] 
>> Use the `-h' flag or consult gen_bridge_metadata(1) for help.
>>
>> it's referring to this line in the SDK header:
>> #include 
>>
>> and the SDK uses std::string all over the place...
>> why is it complaining like this?
>>
>>
>> 2010/5/27 Jordan Breeding 
>>
>>> You might have to make a bridge support file and include it in your
>>> framework.
>>>
>>> Something like this (although this is specific to running inside my Xcode
>>> project build):
>>>
>>> printf "Building BridgeSupport files...\n\n"
>>>
>>> BRIDGE_SUPPORT_DIR="Resources/BridgeSupport"
>>> BRIDGE_SUPPORT_FILE="${BRIDGE_SUPPORT_DIR}/${TARGET_NAME}.bridgesupport"
>>>
>>> if [[ "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${TARGET_NAME}" -nt
>>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}" ]]; then
>>>   if [[ ! -d "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>>> ]]; then
>>> mkdir -p "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_DIR}"
>>>   fi
>>>   gen_bridge_metadata --64-bit --framework
>>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}" -o
>>> "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/${BRIDGE_SUPPORT_FILE}"
>>> fi
>>>
>>> On May 27, 2010, at 10:31, Louis-Philippe wrote:
>>>
>>> Thanks!
>>> ok... I sorted some of the issues out... I was able to make a x86_64
>>> framework out of the SDK by including the proper exports symbols (using nm
>>> with the -arch flag).
>>>
>>> so now it loads fine with the framework method...
>>> but I cant access the c++ namespace:
>>> "NameError: uninitialized constant MYSDK"
>>>
>>> 2010/5/27 Jordan Breeding 
>>>
>>>> Then you could force macruby/macirb to run as i386:
>>>>
>>>> `arch -arch i386 macirb`
>>>>
>>>> On May 27, 2010, at 10:13, Louis-Philippe wrote:
>>>>
>>>> it only builds for i386...
>>>> getting errors when trying to build for x86_64...
>>>> thats why I tried as I tested to build only for i386...
>>>>
>>>> 2010/5/27 Jordan Breeding 
>>>>
>>>>> Try building your framework as both i386 and x86_64.
>>>>>
>>>>> On May 27, 2010, at 10:00, Louis-Philippe wrote:
>>>>>
>>>>> file PATH/MYSDK.framework/MYSDK
>>>>> ./MYSDK: Mach-O dynamically linked shared library i386
>>>>>
>>>>> file `which macruby`:
>>>>> /usr/local/bin/macruby: Mach-O universal binary with 2 architectures
>>>>> /usr/local/bin/macruby (for architecture i386): Mach-O executable i386
>>>>>

[MacRuby-devel] NSNumber 32 bit arch???

2010-06-11 Thread Louis-Philippe
Hi folks,

Maybe I don't get the way NSNumber works... but how can these number be:

arch -arch i386 macirb --simple-prompt
>> 0x44485250
# reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)  # then
see all 32 NSNumber are weird...
=> 71848528
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590272.0
>> NSNumber.numberWithInt(1145590352)
=> 71848528
>> NSNumber.numberWithFloat(1145590352)
=> 1145590272.0
>> n = NSNumber.numberWithFloat(1145590352.0)
=> 1145590272.0
>> n.floatValue
=> 1145590272.0

versus:

arch -arch x86_64 macirb --simple-prompt
>> 0x44485250
  # reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)
=> 1145590352
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590400.0
>> NSNumber.numberWithInt(1145590352)
=> 1145590352
>> NSNumber.numberWithFloat(1145590352)
=> 1145590400.0
>> NSNumber.numberWithFloat(1145590352.0)  # this is
weird again...
=> 1145590400.0
>> n = NSNumber.numberWithFloat(1145590352.0)
=> 1145590400.0
>> n.floatValue
=> 1145590400.0

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


[MacRuby-devel] 32 bit Number Bug

2010-06-14 Thread Louis-Philippe
Hi folks,

there seems to be a bug in the 32bit release of 0.6 with numbers

arch -arch i386 macirb --simple-prompt
>> 0x44485250
# reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)  # then
see all 32 NSNumber are weird...
=> 71848528
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590272.0
>> NSNumber.numberWithInt(1145590352)
=> 71848528
>> NSNumber.numberWithFloat(1145590352)
=> 1145590272.0

versus:

arch -arch x86_64 macirb --simple-prompt
>> 0x44485250
  # reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)
=> 1145590352
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590400.0
>> NSNumber.numberWithInt(1145590352)
=> 1145590352
>> NSNumber.numberWithFloat(1145590352.0)  # this is
weird again...
=> 1145590400.0

to look a bit further, the bug turning point seems to be here for the 32bit
release:

>> NSNumber.numberWithInt(536870910)
=> 536870910
>> NSNumber.numberWithInt(536870911)
=> 536870911
>> NSNumber.numberWithInt(536870912)
=> -536870912
>> NSNumber.numberWithInt(536870913)
=> -536870911

and here in the 64 bit:

>> NSNumber.numberWithInt(2147483646)
=> 2147483646
>> NSNumber.numberWithInt(2147483647)
=> 2147483647
>> NSNumber.numberWithInt(2147483648)
=> -2147483648
>> NSNumber.numberWithInt(2147483649)
=> -2147483647


also an other detail:

32bit turning point:
>> 536870911 / 16
=> 33554431

64bit turning point:
>> 2147483647 / 64
=> 33554431

Is there a workaround for these conversion problem?
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] 32 bit Number Bug

2010-06-14 Thread Louis-Philippe
avec plaisir!

I found the bug when trying to use a 32bit only API... other way I could I
never found it since it runs in 64bit mode by default.

2010/6/14 Laurent Sansonetti 

> Bonjour Louis-Philippe,
>
> Could you open a ticket on the tracker for that?
>
> 32-bit mode is really not well tested at this point so it doesn't surprise
> me there are a few bugs around.
>
> Laurent
>
> On Jun 14, 2010, at 10:28 AM, Louis-Philippe wrote:
>
> Hi folks,
>
> there seems to be a bug in the 32bit release of 0.6 with numbers
>
> arch -arch i386 macirb --simple-prompt
> >> 0x44485250
> # reality check
> => 1145590352
> >> NSNumber.numberWithInt(0x44485250)  # then
> see all 32 NSNumber are weird...
> => 71848528
> >> NSNumber.numberWithFloat(0x44485250)
> => 1145590272.0
> >> NSNumber.numberWithInt(1145590352)
> => 71848528
> >> NSNumber.numberWithFloat(1145590352)
> => 1145590272.0
>
> versus:
>
> arch -arch x86_64 macirb --simple-prompt
> >> 0x44485250
> # reality check
> => 1145590352
> >> NSNumber.numberWithInt(0x44485250)
> => 1145590352
> >> NSNumber.numberWithFloat(0x44485250)
> => 1145590400.0
> >> NSNumber.numberWithInt(1145590352)
> => 1145590352
> >> NSNumber.numberWithFloat(1145590352.0)  # this is
> weird again...
> => 1145590400.0
>
> to look a bit further, the bug turning point seems to be here for the 32bit
> release:
>
> >> NSNumber.numberWithInt(536870910)
> => 536870910
> >> NSNumber.numberWithInt(536870911)
> => 536870911
> >> NSNumber.numberWithInt(536870912)
> => -536870912
> >> NSNumber.numberWithInt(536870913)
> => -536870911
>
> and here in the 64 bit:
>
> >> NSNumber.numberWithInt(2147483646)
> => 2147483646
> >> NSNumber.numberWithInt(2147483647)
> => 2147483647
> >> NSNumber.numberWithInt(2147483648)
> => -2147483648
> >> NSNumber.numberWithInt(2147483649)
> => -2147483647
>
>
> also an other detail:
>
> 32bit turning point:
> >> 536870911 / 16
> => 33554431
>
> 64bit turning point:
> >> 2147483647 / 64
> => 33554431
>
> Is there a workaround for these conversion problem?
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] testing?

2010-07-09 Thread Louis-Philippe
I have a project for which I use Bacon, but it is to test a cocoa
framework...

like:

http://www.macruby.org/recipes/tdd-in-objective-c-with-macruby.html

2010/7/9 Ryan Davis 

> So are you guys not testing your macruby code? I was hoping that the ruby
> community would bring the testing culture to the cocoa world and make it a
> better place. Having gotten no feedback/suggestions whatsoever on my testing
> setup has me a bit wary.
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby Graphics

2010-07-14 Thread Louis-Philippe
on the processing sidetrack...
have you had a look at field?
http://openendedgroup.com/field/wiki

run processing with no processing...  in Python, Clojure, Scala...  and we
might one day have Ruby in!
too bad its Java based again...

2010/7/14 Vincent Isambart 

> > Looking at all these nice low level APIs, I really wonder why Apple
> didn't
> > create more nice obj-c wrappers already.
> For audio and video you'll have to wait for Apple to bring the APIs
> they added to iOS 4 to Mac OS (probably for 10.7) ;-)
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Fibers and Enumerators

2010-08-11 Thread Louis-Philippe
Hi Scott,

If you haven't done so already, you might want to have a look at:
http://www.macruby.org/documentation/gcd.html

it speaks of MacRuby integrating Apple's latest multi-threading strategy:
Grand Central Dispatch.

2010/8/10 Scott Thompson 

> I recently had a discussion on a separate list about Coroutines and
> Cooperative Multitasking on Mac OS X.  The general result of that discussion
> was that the "best" solutions were to either rely on the (deprecated) Carbon
> Thread Manager, use a more complex scheme involving pthreads and semaphores
> to emulate cooperative multitasking, or look at a third party library which
> uses hand-rolled assembly to replace the (deprecated, non-POSIX)
> makecontext, swapcontext and friends.
>
> In the course of that discussion, I looked to see how MacRuby might be
> implementing Fibers (which is a coroutines mechanism similar to the one I
> was looking for) and found that, at the moment, it doesn't.  The Fiber code
> is commented out (at least in the few places in the source I looked at).
>
> Have you given some thought as to how that feature might be implemented?
>
> I suppose with the Ruby interpreter that the "co-routine" might be handled
> using internal features of the interpreter itself (the "green threads",
> fabled in song and story).  At the same time, it seems like all the work
> that went into improving Ruby's threading system as implemented by MacRuby
> might have made it harder to use the "green threads".
>
> I'm more curious than anything else, but has someone thought of a clever
> way to handle cooperative multitasking in MacRuby?
>
> Scott
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Macruby in a Benchmark

2010-09-24 Thread Louis-Philippe
Hi All,

I had fun building this benchmark which involves MacRuby:
http://www.untilnil.com/2010/09/recursivefibbench/

I think there might be some points of interest to MacRuby developers in
there.

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


Re: [MacRuby-devel] Macruby in a Benchmark

2010-09-27 Thread Louis-Philippe
Salut Laurent,

I totally agree, recursive fibonacci is not the most realwold routine, but
still I think it yields some significant data.

The benchmark will probably get some sequel, I will try then with an AOT
compilation, also maybe 0.7 will be out by that time, looking forward to it!

thanks for the tips,

L-P

2010/9/25 Laurent Sansonetti 

> Bonjour Louis-Philippe :)
>
> That's a cool micro-benchmark. I'm not sure if recursive arithmetic
> algorithms really represent the real world, but it's cool anyways.
>
> If you remove the startup times from the final number you should see better
> results for MacRuby. But I agree that the current MacRuby startup time,
> which is about 0.1s, is bad, and should be fixed (if you file a ticket that
> would be great).
>
> I recommend to give it a try with MacRuby trunk (you can grab a nightly
> build) and set up the VM_OPT_LEVEL environment variable to 3.
>
> $ VM_OPT_LEVEL=3 macruby test.rb
>
> You should get good results this way. This will enable optimized codegen
> and primitives inlining.
>
> Laurent
>
> On Sep 24, 2010, at 5:06 AM, Louis-Philippe wrote:
>
> Hi All,
>
> I had fun building this benchmark which involves MacRuby:
> http://www.untilnil.com/2010/09/recursivefibbench/
>
> I think there might be some points of interest to MacRuby developers in
> there.
>
> L-P
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] control tower with objective-c class

2010-10-06 Thread Louis-Philippe
Hi all,

I'm experimenting with Control Tower and tought I would try to get it
running with an Objective-C class, inside an imported framework,
implementing the Rack protocol.

My class imports right in macruby, has a proper call(env) method which
returns an array of 3 elements, when I call inspect on it it is same, same
same as the macruby one... but control tower doesn't display my return
string???

any idea?

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


Re: [MacRuby-devel] control tower with objective-c class

2010-10-06 Thread Louis-Philippe
my Objective-C class:

__

@implementation ObjcRackApp

- (NSArray*)call:(NSDictionary *)env {

return [NSArray arrayWithObjects:

[NSNumber numberWithInteger:200],

[NSDictionary dictionaryWithObject:@"text/plain" forKey:@"Content-Type"],

@"Hello Objc!",

nil];

}

@end



I can confirm it load and behaves properly with this script:



framework "ObjcRackApp.framework"

class Hello
  def call(env)
[200, { 'Content-Type' => 'text/plain' }, "Hello Control Tower!"]
  end
end

env = {"a"=>"hash"}

arr = ObjcRackApp.alloc.init.call(env)

puts arr.class
puts arr[0].class
puts arr[1].class
puts arr[2].class

arr = Hello.new.call(env)

puts arr.class
puts arr[0].class
puts arr[1].class
puts arr[2].class

__

which print:
__

Array
Fixnum
Hash
String
Array
Fixnum
Hash
String

__

but when I run:

__

framework "ObjcRackApp.framework"

app = ObjcRackApp.alloc.init
run app

__

with control_tower -R hello_objc.ru, the server starts without error but I
get served a blank page in my browser


2010/10/6 Joshua Ballanco 

> Hi L-P,
>
> That sounds like a neat idea! I can think of a few ways that it might go
> wrong, but they're only guesses. Do you have some small sample code that
> demonstrates the problem? If so, can you open a ticket on track (
> https://www.macruby.org/auth/login/?next=/trac/newticket) and set the
> component to "ControlTower"? Thanks!
>
> Cheers,
>
> Josh
>
>
> On Oct 6, 2010, at 11:36 AM, Louis-Philippe wrote:
>
> > Hi all,
> >
> > I'm experimenting with Control Tower and tought I would try to get it
> running with an Objective-C class, inside an imported framework,
> implementing the Rack protocol.
> >
> > My class imports right in macruby, has a proper call(env) method which
> returns an array of 3 elements, when I call inspect on it it is same, same
> same as the macruby one... but control tower doesn't display my return
> string???
> >
> > any idea?
> >
> > L-P
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] control tower with objective-c class

2010-10-06 Thread Louis-Philippe
Great!
Ticket Added!

L-P

2010/10/6 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> Could you paste all this into a new ticket? This way we won't forget to fix
> it.
>
> Thanks!
> Laurent
>
> On Oct 6, 2010, at 1:12 PM, Louis-Philippe wrote:
>
> my Objective-C class:
>
> __
>
> @implementation ObjcRackApp
>
> - (NSArray*)call:(NSDictionary *)env {
>
> return [NSArray arrayWithObjects:
>
> [NSNumber numberWithInteger:200],
>
> [NSDictionary dictionaryWithObject:@"text/plain" forKey:@"Content-Type"],
>
> @"Hello Objc!",
>
> nil];
>
> }
>
> @end
>
> 
>
> I can confirm it load and behaves properly with this script:
>
> 
>
> framework "ObjcRackApp.framework"
>
> class Hello
>   def call(env)
> [200, { 'Content-Type' => 'text/plain' }, "Hello Control Tower!"]
>   end
> end
>
> env = {"a"=>"hash"}
>
> arr = ObjcRackApp.alloc.init.call(env)
>
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
>
> arr = Hello.new.call(env)
>
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
>
> __
>
> which print:
> __
>
> Array
> Fixnum
> Hash
> String
> Array
> Fixnum
> Hash
> String
>
> __
>
> but when I run:
>
> __
>
> framework "ObjcRackApp.framework"
>
> app = ObjcRackApp.alloc.init
> run app
>
> __
>
> with control_tower -R hello_objc.ru, the server starts without error but I
> get served a blank page in my browser
>
>
> 2010/10/6 Joshua Ballanco 
>
>> Hi L-P,
>>
>> That sounds like a neat idea! I can think of a few ways that it might go
>> wrong, but they're only guesses. Do you have some small sample code that
>> demonstrates the problem? If so, can you open a ticket on track (
>> https://www.macruby.org/auth/login/?next=/trac/newticket) and set the
>> component to "ControlTower"? Thanks!
>>
>> Cheers,
>>
>> Josh
>>
>>
>> On Oct 6, 2010, at 11:36 AM, Louis-Philippe wrote:
>>
>> > Hi all,
>> >
>> > I'm experimenting with Control Tower and tought I would try to get it
>> running with an Objective-C class, inside an imported framework,
>> implementing the Rack protocol.
>> >
>> > My class imports right in macruby, has a proper call(env) method which
>> returns an array of 3 elements, when I call inspect on it it is same, same
>> same as the macruby one... but control tower doesn't display my return
>> string???
>> >
>> > any idea?
>> >
>> > L-P
>> > ___
>> > MacRuby-devel mailing list
>> > MacRuby-devel@lists.macosforge.org
>> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] NSArray constructor broken?

2010-10-14 Thread Louis-Philippe
Hi all,

on my system, with MacRuby 0.7, I get this error:

>> NSArray.array
ArgumentError: wrong number of arguments

every NSArray constructor method seems to exibit some kind of similar
behaviour.
I searched the tickets and couldn't find it there.

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


Re: [MacRuby-devel] NSArray constructor broken?

2010-10-14 Thread Louis-Philippe
0.7 release

2010/10/14 Eloy Duran 

> To be clear, by version I meant: are you using 0.7 release or did you
> compile it yourself from a different revision?
>
> On Oct 14, 2010, at 3:33 PM, Eloy Duran wrote:
>
> > Hi,
> >
> > It seems to work for me:
> >
> > % macruby -e 'p MACRUBY_VERSION, MACRUBY_REVISION'
> > "0.7"
> > "svn revision 4566 from
> http://svn.macosforge.org/repository/ruby/MacRuby/branches/0.7";
> >
> > % macruby -e 'p NSArray.array'
> > []
> >
> > % macruby -e 'p NSArray.new'
> > []
> >
> > Which version are you using?
> >
> > Eloy
> >
> > On Oct 14, 2010, at 3:15 PM, Louis-Philippe wrote:
> >
> >> Hi all,
> >>
> >> on my system, with MacRuby 0.7, I get this error:
> >>
> >>>> NSArray.array
> >> ArgumentError: wrong number of arguments
> >>
> >> every NSArray constructor method seems to exibit some kind of similar
> behaviour.
> >> I searched the tickets and couldn't find it there.
> >>
> >> L-P
> >> ___
> >> MacRuby-devel mailing list
> >> MacRuby-devel@lists.macosforge.org
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSArray constructor broken?

2010-10-14 Thread Louis-Philippe
>
> > It seems to work for me:
>> >
>> > % macruby -e 'p MACRUBY_VERSION, MACRUBY_REVISION'
>> > "0.7"
>> > "svn revision 4566 from
>> http://svn.macosforge.org/repository/ruby/MacRuby/branches/0.7";
>>
>>
Same Here


> > % macruby -e 'p NSArray.array'
>> > []
>> >
>>
>
This also work for me here...  so the behaviour is only in macirb.


> > % macruby -e 'p NSArray.new'
>> > []
>> >
>>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Hi all,

I'm looking  around MacRuby to find a way to run a subprocess and monitor
it, here is what I tried:

NSTask:

framework "foundation"
task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
p task.isRunning
p task.standardOutput

=> Segmentation fault

Open4:

require 'rubygems'
require 'popen4'
status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
  stdin.puts "a = 1"
  stdin.puts "a == 1"
  stdin.close
  puts "pid: #{pid}"
  puts "stdout: #{stdout.read.strip}"
  puts "stderr: #{stderr.read.strip}"
}
puts "status: #{status.inspect}"
puts "exitstatus: #{status.exitstatus}"

=> 
/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
`open4:': fork() function is unimplemented on this machine
(NotImplementedError)
from
/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
`popen4:'
from
/Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
`'

Open3:

require 'open3'
puts "starting..."
Open3.popen3('irb') { |stdin,stdout,stderr|
  stdin.puts "a = 1"
  stdin.puts "a == 1"
  stdin.close

  puts "stdout: #{stdout.read.strip}"
  puts "stderr: #{stderr.read.strip}"
}

=> starting...

So...  NSTask segfaults...  Open4 cannot work because of unimplemented
'fork' in MacRuby and Open3 hangs?
Anybody has an other solution to launch and monitor a subprocess?

Thanks!

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


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Great!  Thanks all for the answers!

I would have really liked to use backticks or open3, as they are really
easier to use, but what my example didn't show is that my subprocess will be
interactive, so in that case NSTask really seems like the way to go.

For NSTask segfault, you were right, it was only because arguments were
supposed to be an array, now it works!

Feels good to be able to use NSTask from macruby, lots of power in there!


2010/11/3 Matt Aimonetti 

> I have to respectfully agree that open3 is easier to use, however it
> doesn't offer some of the more advanced features offered by NSTask.
>
> I also found out why you are seeing a segfault, the arguments should be
> passed in an array, try:
>
>
> framework "foundation"
> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:["-l"])
> p task.isRunning
> p task.standardOutput
>
> # keep the run loop running
> NSRunLoop.currentRunLoop.runUntilDate(NSDate.distantFuture)
>
> This code works for me.
>
> - Matt
>
>
>
> On Wed, Nov 3, 2010 at 9:12 AM, Matt Massicotte wrote:
>
>> I respectfully disagree :)
>>
>> NSTask is a huge pain and will result in dramatically more code in the
>> simple cases.  Open3 is much easier to work with, and we can only dream of a
>> solution as simple as backticks in Cocoa.  It becomes less of an issue if
>> you are executing long-running processes and do not want to block on their
>> completion.
>>
>> All that said, using the Cocoa implementations is definitely generally
>> preferred.  But, if Ruby offers something that Cocoa either doesn't or
>> doesn't do well, you should:
>>
>> - use the one that best fits your problem
>> - file a bug so the Cocoa version can be improved
>>
>> Matt
>>
>> On Nov 3, 2010, at 9:00 AM, Matt Aimonetti wrote:
>>
>> > NSTask is the way to go, I used it in many cases, including some
>> examples in my O'Reilly book:
>> > http://macruby.labs.oreilly.com/ch04.html#_tasks_subprocesses
>> >
>> > You can also look at this more complex example:
>> >
>> >
>> https://github.com/mattetti/couchdbx-app/tree/master/macruby_version/CouchDBX/
>> >
>> > The wrappers might be interesting to look at to see how I'm hiding some
>> of the complexity.
>> >
>> > - Matt
>> >
>> > Sent from my iPhone
>> >
>> > On Nov 3, 2010, at 7:31, Louis-Philippe  wrote:
>> >
>> >> Hi all,
>> >>
>> >> I'm looking  around MacRuby to find a way to run a subprocess and
>> monitor it, here is what I tried:
>> >>
>> >> NSTask:
>> >>
>> >> framework "foundation"
>> >> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
>> >> p task.isRunning
>> >> p task.standardOutput
>> >>
>> >> => Segmentation fault
>> >>
>> >> Open4:
>> >>
>> >> require 'rubygems'
>> >> require 'popen4'
>> >> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>> >>  stdin.puts "a = 1"
>> >>  stdin.puts "a == 1"
>> >>  stdin.close
>> >>  puts "pid: #{pid}"
>> >>  puts "stdout: #{stdout.read.strip}"
>> >>  puts "stderr: #{stderr.read.strip}"
>> >> }
>> >> puts "status: #{status.inspect}"
>> >> puts "exitstatus: #{status.exitstatus}"
>> >>
>> >> =>
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>> `open4:': fork() function is unimplemented on this machine
>> (NotImplementedError)
>> >>  from
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>> `popen4:'
>> >>  from
>> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>> `'
>> >>
>> >> Open3:
>> >>
>> >> require 'open3'
>> >> puts "starting..."
>> >> Open3.popen3('irb') { |stdin,stdout,stderr|
>> >>  stdin.puts "a = 1"
>> >>  stdin.puts "a == 1"
>> >>  stdin.close
>> >>
>> >>  puts "stdout: #{stdout.read.strip}"
>> >>  puts "stderr: #{stderr.read.strip}

Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Totally agree Rob...  but right now it seems it does segfault on occasions
and I think some serious bugs affecting functionalities and RubySpecs are
still in the bugbase and I wouldn't like to dissolve those priorities with
more exception handling error... I may not understand how important this
segfault may be, so if you think its really worth it I'll let you file it.

2010/11/3 Rob Gleeson 

> I think you should still file a bug report -- MacRuby should never ever
> segfault :)
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Done,
>From now on I will absolutely report any segfault, with pleasure!

2010/11/3 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> MacRuby should never segfault, as others indicated here. Please help us by
> filing a ticket each time you can reproduce a segfault and we will triage /
> duplicate the reports accordingly.
>
> Thanks in advance :)
>
> Laurent
>
> On Nov 3, 2010, at 10:46 AM, Louis-Philippe wrote:
>
> Totally agree Rob...  but right now it seems it does segfault on occasions
> and I think some serious bugs affecting functionalities and RubySpecs are
> still in the bugbase and I wouldn't like to dissolve those priorities with
> more exception handling error... I may not understand how important this
> segfault may be, so if you think its really worth it I'll let you file it.
>
> 2010/11/3 Rob Gleeson 
>
>> I think you should still file a bug report -- MacRuby should never ever
>> segfault :)
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby methods with external frameworks

2010-11-04 Thread Louis-Philippe
Hi all,

I have a funny problem,
I have a framework I created, ObjCHiredis ,
which works with MacRuby.  Except I can't use methods with more than one
arguments in it???
like:  ObjCHiredis.redis works fine but ObjCHiredis.redis("127.0.0.1",
on:6379) doesn't.  ???  I know from my methods are OK as my Framework test
suite, in Objective-C passes the test, and I tried it in an other
Objective-C runtime language, Nu, which handles it flawlessly.

I first thought this problem was related to methods arguments overload, but
an other very unique method also does it:

framework "ObjCHiredis"

p redis = ObjCHiredis.alloc.init
p redis.connect("127.0.0.1", on:6379)

=> #
=> wrong number of arguments (2 for 0) (ArgumentError)

I feel like the error must be mine... but it works elsewhere and I looked
everywhere for a solution inside my code without avail.

thanks!

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


Re: [MacRuby-devel] MacRuby methods with external frameworks

2010-11-04 Thread Louis-Philippe
There are no non OO structure at all, at least I think...  One public Objc
class with 4 methods total.  Thats it.

and by the way, methods from foundation framework work:

>> framework "foundation"
=> true
>> base = NSURL.URLWithString("/usr/local/bin")
=> #
>> myurl = NSURL.URLWithString("myapp/prefs", relativeToURL:base)
=> #

2010/11/4 Matt Aimonetti 

> I'm not really sure what's going on there and to be honest, I didn't check
> your code, but did you try to generate a BridgeSupport file to expose non OO
> structures?
>
> - Matt
>
> On Thu, Nov 4, 2010 at 9:05 AM, Louis-Philippe wrote:
>
>> Hi all,
>>
>> I have a funny problem,
>> I have a framework I created, ObjCHiredis<http://github.com/lp/ObjCHiredis>,
>> which works with MacRuby.  Except I can't use methods with more than one
>> arguments in it???
>> like:  ObjCHiredis.redis works fine but ObjCHiredis.redis("127.0.0.1",
>> on:6379) doesn't.  ???  I know from my methods are OK as my Framework test
>> suite, in Objective-C passes the test, and I tried it in an other
>> Objective-C runtime language, Nu, which handles it flawlessly.
>>
>> I first thought this problem was related to methods arguments overload,
>> but an other very unique method also does it:
>>
>> framework "ObjCHiredis"
>>
>> p redis = ObjCHiredis.alloc.init
>> p redis.connect("127.0.0.1", on:6379)
>>
>> => #
>> => wrong number of arguments (2 for 0) (ArgumentError)
>>
>> I feel like the error must be mine... but it works elsewhere and I looked
>> everywhere for a solution inside my code without avail.
>>
>> thanks!
>>
>> L-P
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby methods with external frameworks

2010-11-04 Thread Louis-Philippe
Thanks Eloy!
I was starting to poke myself, trying to wakeup from a bad dream...
and your answer helped me to get it right:

what works:

>> framework 'ObjCHiredis.framework'
=> true
>> redis = ObjCHiredis.alloc.init
=> #
>> redis.connect("127.0.0.1", on:6379)
=> 1

what doesn't:

>> framework 'ObjCHiredis'
=> true
>> redis = ObjCHiredis.alloc.init
=> #
>> redis.connect("127.0.0.1", on:6379)
ArgumentError: wrong number of arguments (2 for 0)
so I guess that is a bug, isn't it?

2010/11/4 Eloy Duran 

> Oops, forgot to paste the result:
>
> % macirb
> irb(main):001:0> framework
> '/Users/eloy/Documents/DEVELOPMENT/MacRuby/ObjCHiredis/ObjCHiredis/build/Debug/ObjCHiredis.framework'
> => true
> irb(main):002:0> redis = ObjCHiredis.alloc.init
> => #
> irb(main):003:0> redis.connect("127.0.0.1", on:6379)
> 2010-11-04 19:20:32.892 macruby[4656:903] Connection error: connect:
> Connection refused
> => 0
>
> Nevermind the connection refused, I haven't actually got redis running :)
>
> On 4 nov 2010, at 17:44, Louis-Philippe wrote:
>
> There are no non OO structure at all, at least I think...  One public Objc
> class with 4 methods total.  Thats it.
>
> and by the way, methods from foundation framework work:
>
> >> framework "foundation"
> => true
> >> base = NSURL.URLWithString("/usr/local/bin")
> => #
> >> myurl = NSURL.URLWithString("myapp/prefs", relativeToURL:base)
> => #
>
> 2010/11/4 Matt Aimonetti 
>
>> I'm not really sure what's going on there and to be honest, I didn't check
>> your code, but did you try to generate a BridgeSupport file to expose non OO
>> structures?
>>
>> - Matt
>>
>>  On Thu, Nov 4, 2010 at 9:05 AM, Louis-Philippe wrote:
>>
>>>  Hi all,
>>>
>>> I have a funny problem,
>>> I have a framework I created, ObjCHiredis<http://github.com/lp/ObjCHiredis>,
>>> which works with MacRuby.  Except I can't use methods with more than one
>>> arguments in it???
>>> like:  ObjCHiredis.redis works fine but ObjCHiredis.redis("127.0.0.1",
>>> on:6379) doesn't.  ???  I know from my methods are OK as my Framework test
>>> suite, in Objective-C passes the test, and I tried it in an other
>>> Objective-C runtime language, Nu, which handles it flawlessly.
>>>
>>> I first thought this problem was related to methods arguments overload,
>>> but an other very unique method also does it:
>>>
>>> framework "ObjCHiredis"
>>>
>>> p redis = ObjCHiredis.alloc.init
>>> p redis.connect("127.0.0.1", on:6379)
>>>
>>> => #
>>> => wrong number of arguments (2 for 0) (ArgumentError)
>>>
>>> I feel like the error must be mine... but it works elsewhere and I looked
>>> everywhere for a solution inside my code without avail.
>>>
>>> thanks!
>>>
>>> L-P
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> MacRuby-devel@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>>
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby methods with external frameworks

2010-11-04 Thread Louis-Philippe
ok!
done!
Thanks!

2010/11/4 Eloy Duran 

> Yep, that's a bug. Can you file a ticket? Thanks :)
>
> On 4 nov 2010, at 19:44, Louis-Philippe wrote:
>
> Thanks Eloy!
> I was starting to poke myself, trying to wakeup from a bad dream...
> and your answer helped me to get it right:
>
> what works:
>
> >> framework 'ObjCHiredis.framework'
> => true
> >> redis = ObjCHiredis.alloc.init
> => #
> >> redis.connect("127.0.0.1", on:6379)
> => 1
>
> what doesn't:
>
> >> framework 'ObjCHiredis'
> => true
> >> redis = ObjCHiredis.alloc.init
> => #
> >> redis.connect("127.0.0.1", on:6379)
> ArgumentError: wrong number of arguments (2 for 0)
> so I guess that is a bug, isn't it?
>
> 2010/11/4 Eloy Duran 
>
>> Oops, forgot to paste the result:
>>
>> % macirb
>> irb(main):001:0> framework
>> '/Users/eloy/Documents/DEVELOPMENT/MacRuby/ObjCHiredis/ObjCHiredis/build/Debug/ObjCHiredis.framework'
>> => true
>> irb(main):002:0> redis = ObjCHiredis.alloc.init
>> => #
>> irb(main):003:0> redis.connect("127.0.0.1", on:6379)
>> 2010-11-04 19:20:32.892 macruby[4656:903] Connection error: connect:
>> Connection refused
>> => 0
>>
>> Nevermind the connection refused, I haven't actually got redis running :)
>>
>> On 4 nov 2010, at 17:44, Louis-Philippe wrote:
>>
>> There are no non OO structure at all, at least I think...  One public Objc
>> class with 4 methods total.  Thats it.
>>
>> and by the way, methods from foundation framework work:
>>
>> >> framework "foundation"
>> => true
>> >> base = NSURL.URLWithString("/usr/local/bin")
>> => #
>> >> myurl = NSURL.URLWithString("myapp/prefs", relativeToURL:base)
>> => #
>>
>> 2010/11/4 Matt Aimonetti 
>>
>>> I'm not really sure what's going on there and to be honest, I didn't
>>> check your code, but did you try to generate a BridgeSupport file to expose
>>> non OO structures?
>>>
>>> - Matt
>>>
>>>  On Thu, Nov 4, 2010 at 9:05 AM, Louis-Philippe wrote:
>>>
>>>>  Hi all,
>>>>
>>>> I have a funny problem,
>>>> I have a framework I created, 
>>>> ObjCHiredis<http://github.com/lp/ObjCHiredis>,
>>>> which works with MacRuby.  Except I can't use methods with more than one
>>>> arguments in it???
>>>> like:  ObjCHiredis.redis works fine but ObjCHiredis.redis("127.0.0.1",
>>>> on:6379) doesn't.  ???  I know from my methods are OK as my Framework test
>>>> suite, in Objective-C passes the test, and I tried it in an other
>>>> Objective-C runtime language, Nu, which handles it flawlessly.
>>>>
>>>> I first thought this problem was related to methods arguments overload,
>>>> but an other very unique method also does it:
>>>>
>>>> framework "ObjCHiredis"
>>>>
>>>> p redis = ObjCHiredis.alloc.init
>>>> p redis.connect("127.0.0.1", on:6379)
>>>>
>>>> => #
>>>> => wrong number of arguments (2 for 0) (ArgumentError)
>>>>
>>>> I feel like the error must be mine... but it works elsewhere and I
>>>> looked everywhere for a solution inside my code without avail.
>>>>
>>>> thanks!
>>>>
>>>> L-P
>>>>
>>>> ___
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel@lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>
>>>>
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> MacRuby-devel@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>>
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby methods with external frameworks

2010-11-04 Thread Louis-Philippe
while I was replying to the ticket comment ;)

so:

my use case is one of TDD, where the framework is not installed but in the
build folder.
Even if I:
ENV['DYLD_FRAMEWORK_PATH'] = ENV['BUILT_PRODUCTS_DIR']
the framework doesn't load properly.

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


[MacRuby-devel] sharedRuntime same context as MacRuby's runtime

2010-11-08 Thread Louis-Philippe
Hi,

I am trying to implement some macruby pre-initialisation inside an
Objective-C class, to enhance the Objective-C class with some ruby methods
before returning the initialized object to MacRuby.  I was wondering if the
+ MacRuby sharedRuntime execution context is the same as my MacRuby
application execution context?  Right now, it does not seem like the
sharedRuntime preparation I do inside my Objective-C initializer does affect
my MacRuby execution:

in MacRuby:

framework "MyObjCFramework"
myObject = MyClass.enhancedInitializer

in Objective-C:
// MyObjCFramework

...

+ (id)enhancedInitializer
{
id myInstance = [MyClass regularInitializer];
 NSBundle * fbundle = [NSBundle bundleForClass:[MyClass class]];
NSString * rbPath = [fbundle pathForResource:@"myClass_ruby" ofType:@"rb"];
 [[MacRuby sharedRuntime] evaluateFileAtPath:rbPath];
 return myInstance;
}

Is something like this supposed to be possible?

Thanks!

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


Re: [MacRuby-devel] what are you building with macruby?

2011-01-19 Thread Louis-Philippe
Over here I built a video processing cluster of MacOS workstations, where
the processing nodes are implemented using MacRuby.  It's an internal tool
protected by NDA so I won't say more ;).

Works great overall.

2011/1/18 Eloy Duran 

> We’re working on a pretty big (code wise) product for designers, with
> complete custom views based on CALayers. Besides that I'm working on a
> Cocoa front-end for some simple input/output thingy that I can't
> elaborate on too much atm… ;)
>
> On Tue, Jan 18, 2011 at 8:41 PM, Gabriel Gilder
>  wrote:
> > I'm working on an internal tool that we use to provide a friendly/better
> > interface to an email distribution system, but unfortunately it's under
> NDA
> > so I can't really share more info than that... ;)
> > -Gabriel
> >
> > On Tue, Jan 18, 2011 at 12:18 AM, Jarkko Laine 
> wrote:
> >>
> >> On 17.1.2011, at 22.19, Matt Aimonetti wrote:
> >> > Anyone else building awesome MacRuby apps? Care to share?
> >>
> >> Something like this: http://www.matstroeng.se/quickroute/en/, except
> for
> >> Mac (and awesome).
> >>
> >> //jarkko
> >>
> >> --
> >> Jarkko Laine
> >> http://jlaine.net
> >> http://notkea.fi
> >> http://odesign.fi
> >>
> >> Check out my latest book, Unobtrusive Prototype, fresh off the Peepcode
> >> oven:
> >> http://peepcode.com/products/unobtrusive-prototype-js
> >>
> >> ___
> >> MacRuby-devel mailing list
> >> MacRuby-devel@lists.macosforge.org
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >
> >
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> >
> >
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Extending MacRuby to platforms other than OSX?

2011-01-25 Thread Louis-Philippe
An other Objective-C Runtime language, Nu, is already iOS and Linux
compatible, but doesn't rely on Objective-C GC...
nothing is impossible and this one is certainly worth it.

2011/1/25 Gary Weaver 

> Not trying to be a downer, because I really like the idea of it being more
> accessible, but:
>
> Looks like no recent activity on PureFoundation:
> https://code.google.com/p/purefoundation/
> http://www.puredarwin.org/purefoundation
>
> Some activity 3 months ago on opencflite, which there was claim that
> PureFoundation might move to:
> http://opencflite.svn.sourceforge.net/viewvc/opencflite/
>
> I don't get the feeling that these projects are active enough and have
> enough behind them to get distracted from focusing on OS X, but maybe their
> developers are just not committing code frequently?
>
> MacRuby on iOS would be neat, but from what I've read on the list, it isn't
> happening anytime soon.
>
> Personally, I'm still hoping that someone picks up HotCocoa, but from what
> I hear, the guys need to stayed focus on OS X, until more developers start
> helping out.
>
> I noticed a few projects for Posix and Ruby and CFLite and Ruby, if you
> google for it. Might not be what people need, but worth mentioning.
>
>
>
> On 1/25/11 12:05 PM, Adam Strzelecki wrote:
>
>> Hi,
>>
>> First of all I think MacRuby is amazing project, and one and only Ruby
>> runtime/compiler (macrubyc) that is able to produce standalone
>> self-contained binaries. Since I have used Ruby heavily to produce
>> server-side applications rather than Cocoa based application and I am iPhone
>> developer as well, I wish to ask if and what are the plans for extending
>> MacRuby to other platforms like:
>>
>> (1) iOS - here I know the basic problem is lack of Obj-C GC. I've seen
>> some post you're working on it, any clues about that?
>>
>> (2) any UNIX (POSIX) platforms (Linux servers) - most of tech MacRuby
>> relays on is OpenSource including LLVM, Obj-C runtime... most except
>> Foundation framework is closed-source and exists only on OSX, however
>> there's CFLite and there were couple of tries to port Foundation to generic
>> UNIX (POSIX), one of them is PureFoundation.
>>
>> Do you guys considered stripped down MacRuby version for any POSIX OS
>> where Array, String and some core classes use some alternative
>> implementation of Foundation or Foundation-free implementation?
>>
>> Regards,
>>
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel