Re: [MacRuby-devel] Exposing c structs and functions

2008-12-22 Thread Jim Getzen
Laurent, OK, it has taken me awhile to get back to this issue again, but yes, you were exactly right, I needed to look at the newer BridgeSupport format in /System/Library/Frameworks... It works great now. Thanks for the help! Jim Hi Jim, You're probably looking at an old BridgeSupport

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Laurent Sansonetti
Hi Jim, You're probably looking at an old BridgeSupport file. function_retval and function_arg do not exist anymore since a very long time, and were replaced by retval and arg. You should be able to get the latest Foundation bridgesupport file from here: /System/Library/Frameworks/F

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Rich Morin
At 16:18 -0500 12/19/08, Jim Getzen wrote: > I have read the man pages (I had to learn what a "man page" was > first!), but I didn't see anything that would solve that error. FYI, man pages are great at reminding folks of options, details, etc. They are less useful as tutorials. In any case, it

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Jim Getzen
Hi Laurent, First, why does the Foundation.xml use the elements "function_retval" and "function_arg" instead of just "retval" and "arg"? Second, I used the xml you suggested, but I now get this error: `ZPointMake': unrecognized octype `{_ZPoint="x"f"y"f}' (RuntimeError) I have read the man p

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Laurent Sansonetti
Hi Jim, Sorry for the late response! Indeed the best way to make your C API available from MacRuby is to cover it with a BridgeSupport file and load it, MacRuby will reconstruct the corresponding API in the Ruby world. BridgeSupport descriptions are language agnostic and can be loaded in o

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Jim Getzen
OK, I decided to devote a little time to see if I could make any headway with BridgeSupport. It doesn't seem too terribly complicated, but I have run into a problem. My framework is called ZenGL, so I first created a struct in ZenGL.h based on NSPoint: typedef struct _ZPoint { floa

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Eloy Duran
Your best bet is to take a look at the bridgesupport files for most system frameworks and learn from those. They are found inside Resources/BridgeSupport. Nonetheless, it would indeed be very nice if a more elaborate guide could be written. Eloy On Dec 19, 2008, at 4:45 PM, Jim Getzen wrot

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-19 Thread Jim Getzen
John, thanks for the ideas. Currently, I am using a simple Obj-C class with methods instead of a struct and functions. That works OK, but it is not the best solution, especially in those cases where the framework would be used by Obj-C code instead of MacRuby code and where speed is a conce

Re: [MacRuby-devel] Exposing c structs and functions : Addendum

2008-12-18 Thread John Shea
Hi again Jim, another note, down the bottom of the MacRuby tutorial http://www.macruby.org/trac/wiki/MacRubyTutorial, you will see the words: "On some occasions. you will want to load bridge support files that you personally generated using gen_bridge_metadata(1). To do that, you can use the Kerne

Re: [MacRuby-devel] Exposing c structs and functions

2008-12-18 Thread John Shea
Hi Jim,looks like no one who really knows this stuff is offering anything - so I will suggest some of my naive solutions / possibilities: - as far as I know C functions, structs etc are brought into macruby by the bridgesupport project: http://bridgesupport.macosforge.org/trac/ - however I cannot

[MacRuby-devel] Exposing c structs and functions

2008-12-18 Thread Jim Getzen
Is there a way to expose some c structs and functions from a custom Objective-C framework to MacRuby? For instance, in my framework I have a 3-D point struct, such as: typedef struct { CGFloat x, y, z; } JPoint3; In addition, I have creation functions such as 'JPoint3Make(x, y, z)' e