From KolibriOS wiki
Jump to: navigation, search

Libs-dev is a system libraries collection targeting different problematic programming areas.

Libraries description

Libs-dev now consists of four common-use libraries: libio (input-output programming), libini (INI-like files support), libimg (graphics files manipulation) and libgfx (drawing convenience API).


Main article: Libs-dev/libio

Library provides routines to perform basic file I/O like opening, closing, reading, writing, truncating files, getting and setting file pointer position. There're also routines to enumerate files inside specific directory with names matching shell pattern.

It should usually be used by programs which need to perform low-level file operations.


Main article: Libs-dev/libini

Library provides routines to work with INI files which are key-value based text files with possibility to be edited by user by hand in any external editor.

It should usually be used by programs which need to save and load their settings in platform-independent way.


Main article: Libs-dev/libimg

Library provides routines to work with graphics files and containers. It's made extensible and could transparently decode images in different formats identifying them by file signatures and other guessing techniques.

It should usually be used by programs which need to display pictures in their UI (for example, icons on tool buttons).


Main article: Libs-dev/libgfx

Library provides routines to draw different graphics primitives like dots, lines, rectangles, bars, circles etc. It uses canvas abstraction to be able to perform buffered off-screen drawing.

It should usually be used by programs which need to draw any graphics on screen (which are almost all the programs to date since Kolibri is a pure GUI OS).

Libraries tests

There's a .test directory containing different libraries tests. They are designed to be independent and should generate (or contain pre-generated) test data which leads to same results disregarding the order tests are executed in.

KIV program was initially based on one of such tests (002) using libio and libimg libraries to show their capabilities in a small GUI application able to display picture at path supplied by command-line parameter.

Coding style

All the public functions are contained in <library name>.asm file, supporting public declarations in <library name>.inc file. All other library-specific (private and auxiliary) core functions and declarations are separated into <library name>_p.asm and <library name> files. There could also be separate files with self-describing names providing additional functionality.

Functions located in public source files use naming convention as in <function namespace name>.<function name>. Functions located in private source files use naming convention as in <library name>._.<function name>. This allows to separate libraries code when linking statically.

Specific type of function description comments is being used allowing documentation to be generated automatically in the future.

See also