Author Topic: Custom Code Templates + list macro  (Read 1191 times)

Cinderspirit

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Custom Code Templates + list macro
« on: November 16, 2018, 04:57:03 am »
Right now I am writing up some Code Templates for generating C code which fits our coding style. I am almost done, but can't figure out how to solve one last issue.

In my "Class Body Impl" I want to call a Custom Template of Type Operation the same way it is done with the base Template "Operation". But when I issue "%list="Operation__test" @seperator="\n"% inside my "Class Body Impl" it won't be called at all. My guess is the list macro does some kind of context switch, when being issued to work on the base template "Operation". Is there a way to manually switch from working on the class to working on the operations?

My aim is to define a struct which holds a pointer to each public function in the class h-File and then define the functions in the c-File and fill a variable with them.

Like this:

H-File:

typedef struct
{
   void (*Init)(void)
} Test_st

extern Test_st Test

C-File:

void Init(void);

Test_st Test =
{
   Init
};

But for doing this I somehow need to call different Operation Templates, or pass parameters, which seems not possible while using %list%.

Help would be appreciated.