RBGen->new(%options) ->write_api('foo.h') ->write_impl('foo.c') ->write_wrapper( 'sometype-rb.h', obj_t => 'SomeType', node => 'NodeFieldName', # struct SomeType { rbtree_node_t NodeFieldName; } cmp => 'CompareFunc' # int CompareFunc(SomeType *a, SomeType *b); ) ->write_wrapper( 'sometype-rb.h', obj_t => SomeType', node => 'NodeField2', key_t => 'const char*', key => 'KeyField', cmp => 'strcmp' );
This module writes customizable Red/Black Tree algorithms as C source code. While these sorts of things could be done with C header macros, I've decided that is really a massive waste of time and wrote it as a perl script instead.
To install Tree::RB::XS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::RB::XS
CPAN shell
perl -MCPAN -e shell install Tree::RB::XS
For more information on module installation, please visit the detailed CPAN module installation guide.