Search code examples
ceclipsesyntaxoperating-systemoutline-view

Show OS tasks on Eclipse's outline


I've got some C code that runs on JenOS, a proprietary OS used on some NXP microcontrollers to manage ZigBee communication. This OS has a specific syntax to define tasks, that reads as follows:

OS_TASK(APP_ZPR_Light_Task)
{
    ...
}

Where OS_TASK is defined as:

#define OS_TASK(a)        void os_v##a(void)

Obviously, these are not recognized as standard C functions, and thus are not displayed in the outline tab of Eclipse. Is there a way to include those in the outline without having to hack the source (I don't want to go there for obvious reasons)?


Solution

  • I don't know a way to change the pattern which Eclipse uses to recognize functions, so I suggest a workaround: Define the functions using your own pattern like:

    void os_vAPP_ZPR_Light_Task(void) /*TASK*/
    

    Now you can write a small utility which filters the file and replaces this line with the pattern which JenOS expects before you pass it to the original build tools.

    Or maybe you can look at the Makefile; there should be a step where a tool analyzes the C sources for OS_TASK(...). Maybe you can hook in there to feed it the data in a different form.