REGISTER_ACTIONS - REGISTER_FLAGS - REGISTER_ATTRIBUTES

Every action file must register its actions in the HID. The action file will have an

    #include "hid.h"

which define the REGISTER_* macros. Then somewhere in the file you add:

    REGISTER_ACTIONS(exampledo_action_list)

This will be expanded by the preprocessor into:

    void register_exampledo_action_list()
    { hid_register_actions(exampledo_action_list,1); }

During the build process the files core_lists.h and gtk_lists.h are created. These files contain nothing more than a collection of REGISTER_* instructions it found in its source files.
So core_lists.h and gtk_lists.h will contain:

    REGISTER_ACTION(exampledo_action_list)

In the file main.c around the main functions we find the instruction:

    #include "dolists.h"

And soon after that we find

    #include "core_lists.h"

Because dolists.h redefines the REGISTER_* macros, the macros in core_lists.h

    REGISTER_ACTIONS(exampledo_action_list)

will be expanded by the preprocessor into:

    external void register_exampledo_action_list();
    register_exampledo_action_list();

And therefore it will call all functions to register the actions at the beginning of the main function.

### Options

REGISTER_ACTIONS | These actions can be called though the user command window (start with “:” in the PCB program.

REGISTER_FLAGS

These flags initiate a functions when set or unset.
E.g. in file flags.c we find

    HID_Flag flags_flag_list[] = {
      {"style",                FlagCurrentStyle, NULL},
      {"grid",                 FlagGrid,         NULL},

The “grid” flags is associated with the menu flag: View→enable visible grid and makes the connection to the `FlagGrid()` function.
If you select View→enable visible grid the function `FlagGrid` will be called.

REGISTER_ATTRIBUTES | In main.c there is a call to this macro: `REGISTER_ATTRIBUTES (main_attribute_list)` The main_attribute_list defines the command-line options. Most of the HID also use this macro, to add their command line options as well.