Loud ramblings of a Software Artisan

Friday 31 March 2006

New system call

The kernel developers have decided to add a really important system call. Here is detail of the man page that describe the corresponding libc call:

int is_computer_on(void)

It will return 1 of the computer is on. Otherwise the result is undetermined. Return -1 in case of error and set errno appropriately. Possible errno values are:

ENOPARSE impossible to parse the hardware status subsystem data. Happen usuall when your system is on crack

ENOFOOL can't be fooled by the value returned

EAGAIN sorry the system is busy doing something more important

This system call conforms to the AFOS 2006 release 1 specification.

Kernel developers expect helping developers of power management software such as gnome-power-manager. The kernel symbol is marked as GPL only to prevent proprietary device driver to link against it.

Off course ressemblance with an existing system call of a now defunct operating system would be pure coincidence.

STL

STL, Standard Template Library is probably the most frightening component of C++. It is not required to use it for C++ programing, but it actually provides lot of base algorithms and containers.

When AbiWord started around 1998, the state of C++ compilers was not that great. Since AbiWord was supposed to be cross-platform, it was decided of a limited set of C++ features allowed to be used: no template, no exceptions, no multiple inheritence. That made the STL inappropriate, so base classes where written: vectors, hash tables, etc. Actually some containers like hash tables are in triplicate, including one that it barely used.

In 2004, after having lot of issues with our vector class using void* as a container type when storing integer values on 64-bits platform we decided to go with some templated classes. In fact I just templated one of the hash classes, the vector class and the stack class. Only simple template, no template function, in order to avoid possible pain with non conformant compilers, even if at the moment we only build using either gcc, or for Windows, Visual C++.

Now, I'm work on wrapping UT_Vector around a std::vector, and I will do so for some other classes. The idea is to switch to the STL (Standard C++ Library) and avoid the burdain of maintaining our libraries. At the moment everything compiles fine, but with a few glitches at run time. I'll post some benches once I have done some, including memory usage and binary size.