lunes, 13 de junio de 2011

Portable drawing libraries

A drawing device needs some Plan 9 libraries: draw(2), memdraw(2) and memlayer(2). These libraries have been ported to Unix as part of p9p, Inferno and drawterm. Another option, used by 9vx, is to use the original Plan 9 libraries.

The C code in Plan 9 is not ANSI C, so it cannot be compiled without modification with standard compilers (although gcc has support for the extended features of Plan 9 in its latest versions). Therefore, the .c files in 9vx are not exactly the same ones that are found in /sys/src. However, the changes are few enough to be easily applied as a set of .ed files.

If you try to autogen the .c files in 9vx from current Plan 9 sources (for example, from sysfromiso) you won't get too far. Unfortunately, those scripts have not been kept up to date with the latest changes in sources. Another problem is that some of the last bugfixes have not been included in the Plan 9 distribution (yet?).

As part of the experiments performed to find a version of the drawing libraries suitable for the wsys device a repository with portable versions of libdraw, libmemdraw and libmemlayer has been set up in bitbucket. The .ed files and the autogen scripts have been updated to work with the latest versions (from the beginning of June) and other new bugfixes are applied as additional ed patches (only memdraw32bit, actually). Make, and not mk(1), is used to build the libraries.

The libdrawp repository (private for the moment) will be made public soon, just in case somebody is interested. It just needs a README and the LPL license.

However, these libraries will not be used in the wsys device. The libraries in Inferno are not going anywhere any time soon (they are needed for the native implementations and in other host environments), they are ANSI C, the build process uses mk(1) and include some bugfixes not present in Plan 9. That's what we are using for the wsys device. I don't think I'm going to bother maintaining libdrawp in the future, but it was another interesting experiment.

No hay comentarios:

Publicar un comentario