||2002-09-02 22:02:37 GMT
||2004-06-11 23:53:43 GMT
(Projects of this owner)
Framework for dynamically generating C extensions from Ruby. Supports automatic management of C structs as ruby objects that:
* have accessible, type-safe attributes
* can be serialized via Marshal and YAML
* are GC-aware
* are fully inheritable and extensible with new attributes.
Who needs it?
If you're starting a C extension from scratch, or if you need to dynamically generate and load C code on the fly, you may be interested. For wrapping an existing library, you should consider SWIG as well. SWIG has the advantage of being able to parse headers and generate something as a starting point. CGenerator has the advantage of automatically handling serialization and memory management, but it can handle only a limited (but extensible) range of C data types.
The most important change is that all shadow classes can now load and dump YAML strings (and they do so without generating any more C code--the dump/load code for attributes is generic enough to work with YAML as well as Marshal).
- CShadow.define_c_function for convenience.
- Improved sorting of component classes to reduce nondeterminism in code
generation, and to thereby reduce time to rebuild.
- Reorgnized CShadow base classes so that methods are provided by
extending with a module, CShadowClassMethods, instead of being
defined individually in each base class. This means that they can be
overridden and called with super. It's also cleaner and probably
- Included examples/yaml.rb, which was mistakenly left out of 0.11
- CShadow#inspect added. Shows both shadow attrs and instance vars.
- CShadow classes are YAML friendly--see docs on cshadow and
- Library#literal_symbol to streamline use of rb_hash_aref etc.
- Improved granularity for efficient separate compilation.
- Improved indentation in CFunctions.
- CShadow: added a new statement accumulators to
_dump_data_method and _load_data_method, called
'pre_code' and 'post_code', replacing 'extra_code'.
- Library#extconf should now return a string or array of strings,
which will be used as the contents of extconf.rb.