#612 Improve nedit macro built-in function registration

Tony Balinski

This is not so much a bug as a complaint, with a patch as a solution.

The file macro.c is too big and does not readily allow for macro built-in functions and variables to be defined in other files, where they might be more logically grouped. (In particular, I would rather see all rangeset manipulating stuff in a separate rangeset_macro.c file, or such-like.)

The fundamental problem is that the built-ins must be registered so that their names can be found when parsing the actual macro texts, and that this registration is pretty well locked into macro.c. Also, it uses a set of rather nasty tables that match names to function pointers in a maintenance intensive way.

Attached is a patch that replaces these clunky tables with easier to maintain ones (using name,function-ptr pairs), and exposes the necessary registration functions for other files to define their own macro built-ins (by including macro.h). This might even extend further to allow run-time loading in future... who knows?

(Entered as a bug as per suggestion, see http://www.nedit.org/pipermail/develop/2008-January/013851.html
for more)


  • Tony Balinski
    Tony Balinski

    new macro function registration code