From: Joel VanderWerf Date: 2007-05-03T03:25:12+09:00 Subject: Re: C DSL anyone? Brad Phelan wrote: > Just curious, > > is anybody working on a C language DSL that could generate C code. I'm > kinda interested in how it may be possible to use RSpec to unit test C > code in a nice way. Here's one: http://raa.ruby-lang.org/project/cgenerator/ http://rb-cgen.darwinports.com/ There's an example at: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170530 IMO, cgen's shadow class mechanism is what differentiates cgen from RubyInline. (Shadow classes give you an easy way of defining and inheriting T_DATA structs as if they were just part of your ruby classes, using the shadow_attr_accessor methods.) RubyInline is probably more sophisticated in many ways (compiler options, storing intermediate code securely, availability as a gem). I've been using cgen since 2001 for boosting the performance of numerical integration and simulations. I've also used it to wrap some libraries that I didn't want to bother with swig for. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407