jruby

Posted by colby

Added automatically generated method wrappers for calls into the GSL library using the object itself:

rgslffi GSL4r is a set of wrapper routines I'm creating around GNU Scientific Library (GSL) mathematical routines using the Foreign Function Interface (FFI) library for Ruby/JRuby. Using FFI helps avoid tying GSL only to the C based Ruby interpreters and potentially will make the library universally available across all Ruby implementations. Something we'd like to have while using JRuby for the ATA.

Posted by colby

While working on rgslffiGSL4r, I needed to define a mapping for the gsl_complex struct (we'll ignore for now that gsl_complex is potentially platform dependent).

Here's my attempt:

  class GSL_Complex < ::FFI::Struct
    layout :dat, [:double, 2]

    R = 0
    I = 1

    def real()
      return self[:dat][R]
    end

    def imag()
      return self[:dat][I]
    end

    def equals( a )
      return ( a[:dat][R] == self[:dat][R] && a[:dat][I] == self[:dat][I] )
    end

    def set( r, i )
      self[:dat][R] = r
      self[:dat][I] = i
      return self
    end

    def set_real( r )
      self[:dat][R] = r
    end

    def set_imag( i )
      self[:dat][I] = i
    end

    def to_s()
      return "(#{self[:dat][R]},#{self[:dat][I]})"
    end
  end
Posted by colby

I was stumped for a few hours on passing FFI::Structs into external routines, luckily, this post, 'Functions returning structures' (groups/google/ruby-ffi), tipped me off by showing how to return a struct by value:

From the C code:

...
    typedef struct
    { 
        int r, g, b, a; 
    } ALLEGRO_COLOR; 
...
Posted by colby

From #jruby,

09 dec 2009
[10:35am] headius: if you set up hudson and put it somewhere we can slave it, I could make mine the master
[10:35am] headius: this is ubuntu 8.10ish I believe
[10:35am] headius: so it's not super recent, but hey, it's java, man
[10:35am] Seb left the chat room.
[10:35am] VVSiz: windows and macos platforms would be the most useful right about now :)
[10:36am] VVSiz: first, I don't have macos at all, so I can't run tests/specs on it at all, and always have to guesss
[10:36am] colby_: Okay, I will work on the following, macosx 10.5 and 10.6, windows XP and opensolaris 10 oct 09 release for sparc.
[10:36am] VVSiz: sweet
[10:37am] VVSiz: "ant spec" and "ant test" -- are the two most important targets

10 dec 2009
[10:20am] colby_: How about: /hcro/hudson/osx/leopard for no?
[10:20am] colby_: er now
[10:20am] headius: ok
[10:20am] colby_: hcro being Hat Creek Radio Observatory
[10:21am] headius: nice, ok :)
[10:21am] headius: ok, I think it's up
[10:21am] headius: http://jruby.headius.com:8080/hudson/computer/darwin/
[10:22am] headius: has jnlp instructions there too
[10:29am] headius: enebo: http://www.digitaltrends.com/gaming/consoles-compared-sony-playstation-3...
[10:30am] colby_: Awesome