The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

SYNOPSIS

  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'
        );

DESCRIPTION

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.