Libs-dev: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(5 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Libs-dev is a system libraries collection targeting different problematic programming areas. | Libs-dev is a system libraries collection targeting different problematic programming areas. | ||
Line 31: | Line 30: | ||
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. | 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= | =Libraries tests= | ||
There's a <tt>.test</tt> 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. | There's a <tt>.test</tt> 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/ru|KIV]] program | [[Kiv/ru|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= | =Coding style= | ||
All the public functions are contained in <tt><library name>.asm</tt> file, supporting public declarations in <tt><library name>.inc</tt> file. All other library-specific (private and | All the public functions are contained in <tt><library name>.asm</tt> file, supporting public declarations in <tt><library name>.inc</tt> file. All other library-specific (private and auxiliary) core functions and declarations are separated into <tt><library name>_p.asm</tt> and <tt><library name>_p.inc</tt> files. There could also be separate files with self-describing names providing additional functionality. | ||
Functions located in public source files use naming | Functions located in public source files use naming convention as in <tt><function namespace name>.<function name></tt>. Functions located in private source files use naming convention as in <tt><library name>._.<function name></tt>. 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. | Specific type of function description comments is being used allowing documentation to be generated automatically in the future. | ||
=See also= | |||
* [[Libraries|KolibriOS libraries explained]] | |||
[[Category:Coding]][[Category:Manuals]] | [[Category:Coding]][[Category:Manuals]] | ||
[[Category:Libraries]] |
Latest revision as of 21:56, 27 July 2010
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).
libio
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.
libini
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.
libimg
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).
libgfx
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>_p.inc 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.