Wednesday, September 25, 2013

Rudiments - 0.43 is out

As recently promised, Rudiments 0.43 is out.

This release of rudiments features some significant changes under the hood and a few visible ones.  Most of the changes center around fixing compatibility issues with older platforms and compilers.  Some are in the spirit of general code cleanup and decluttering.  Some were to make the code simpler and smaller.

The most earth shattering changes were the consolidation of the daemonprocess class into the process class, the renaming of the mutex class to threadmutex and the renaming of *clientsocket and *serversocket to *socketclient and *socketserver.  The daemonprocess class has long been quirky and needed an overhaul.  The mutex rename was to avoid namespace collisions and the socket class renames were to comply with a general client/server class naming scheme I've been meaning to do for years.

Some method names were changed to avoid namespace collisions as well.  There are surprisingly many platforms that use macros (#defines) to alias one function to another and it doesn't matter if you use C++ namespaces or not, on those platforms, you'll get collisions.  Terrible!

Speaking of namespaces, I'd long had goofy macros to use a rudiments namespace if the compiler supported them and not use them if the compiler didn't.  After fixing all the other name-related collisions, I eventually realized that the rudiments namespace wasn't necessary at all and removed it altogether.  This also helped with older platform compatibility.

Rudiments aims for compatibility.  Apps built on it might not be so compatible but Rudiments itself ought to be.  At least that's one of my goals for it.

Other semi-earth-shattering changes include the addition of printf-like methods in the charstring, filedescriptor and variablebuffer classes and inclusion of the proper header files high in the chain to make sure NULL is defined (correctly even, on older platforms).  Another goal that I've had for a long time is to be able to write programs that don't include any system header files.  Everything I need should be wrapped in Rudiments and platform-agnostic.  Ideally.  Well, I'm a lot closer.  I don't have to include stddef.h for NULL or stdio.h for any of the printf functions.  Yeah, I know it's C++ and by rights I ought to be using cout but that's a-whole-nother story.  At any rate, most of my programs, including most of SQL Relay, don't need to include any system headers.  Not all the way there yet, but getting much closer.

The rest of the changes are obscure, platform-specific fixes or workarounds.  You ought to see the hack I put in for platforms that don't provide a vsnprintf.  Terrible.  Definitely going to rewrite that someday.

Full ChangeLog:

  • added a workaround for platforms that don't support blocking/non-blocking modes for sockets
  • added *printf wrappers to charstring, filedescriptor and stringbuffer classes
  • added test/include for sys/signal.h for platforms that need it
  • added support for uadmin with int vs. char 3rd argument
  • added snooze and retry if fork fails with EAGAIN
  • moved safePrint and printBits methods into the filedescriptor class
  • added a test and handling for fsetxattr with non-const third parameter
  • "hid openssl" by abstracting SSL types and moving includes into .cpp files
  • fixed erroneous end-of-buffer address when creating a variablebufferis with initial contents
  • added option to disable string cache in xmldom class
  • added "data" member to xmldomnode class for attaching app-specific data
  • improved codetree speed
  • fixed a "char" on ARM issue
  • fixed a longstanding issue where variablebuffers could get extended too much sometimes
  • renamed system class to sys to avoid collisions
  • added -Werror to configure-time tests for older systems where g++ doesn't return an error for an implicitly defined function
  • removed the rudiments namespace for compatibility with older compilers
  • replaced a bunch of unsigned long and long with [u]int(32|64)_t
  • removed the timezonefile class
  • renamed mutex class to threadmutex to avoid collisions
  • wrapped setsid() function
  • refactored and simplified dictionary and linkedlist classes
  • if thread detection fails it just disables threads now rather than erroring out
  • thread support is displayed in configure summary
  • refactored xmldomnnode::print() methods, added one to write to a filedescriptor
  • renamed memorypool methods malloc, calloc and free to allocate, allocateAndClear and deallocate to avoid collisions on platforms that define malloc and calloc using macros
  • fixed lots of cases where const char *'s were being deleted
  • renamed *serversocket to *socketserver
  • renamed *clientsocket to *socketclient
  • added 64-bit build support for Windows
  • refactored daemonprocess class and moved its methods into the process class