RPG Next Gen
Wiki RSS Feed Weblog
Business picture

libtree

This project offers various tree implementations starting with the red black tree implementation.

Base

The base for the project are provided by the libtree project on github which is a C implementation for various tree data structures. The code can be compiled on IBM i with the ILE C compiler with almost no changes to the code.

The keyword inline is not supported by the ILE C compiler. We need to define inline to __inline (which is implementation specific and works with the ILE C compiler).

RPG

This project contains prototypes for the C functions. On top of that the project has wrapper modules for the red black tree C implementation to make it easier to use the C functions. The wrapper modules support integer and strings as keys. The values are added untyped (via pointer).

String Module

The string module supports strings as keys. The value of the entry can be anything as it is passed as a pointer. The module provides two procedures for key comparison.

  • tree_rb_string_compare
  • tree_rb_string_compare_ignore_case

As the name already points out, the ignore case variant of the comparison procedure evaluates "My Key" and "my key" as equal.

Example

Take a look in the example section to see how to use the procedures.

Documentation

The documentation for the wrapper modules can be found at iledocs.sf.net.

License

This library is licensed under the GNU Lesser General Public License.

Requirements

The includes packages from the download section are needed to compile.

Download

For source packages take a look at the download area.