The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


                obj_t => 'SomeType',
                node => 'NodeFieldName',  # struct SomeType { rbtree_node_t NodeFieldName; }
                cmp => 'CompareFunc'      # int CompareFunc(SomeType *a, SomeType *b);
                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.