BeRTOS
|
Preprocessor magic to create hunks for the commands executed from the parser. More...
Go to the source code of this file.
Preprocessor magic to create hunks for the commands executed from the parser.
This module permits to create hunks for the functions that must be executed through RPC commands. For instance, given this code:
ResultCode cmd_add(long a, long b, long* result); DECLARE_COMMAND_HUNK(add, (long)(long)(NIL), (long)(NIL)); // ^ parameters ^ return values
The macro is expanded to:
ResultCode cmd_add_hunk(params argv[], params results[]) { return cmd_add(argv[0].l, argv[1].l, &results[0].l); } const struct CmdTemplate cmd_add_template = { "add", "dd", "d", cmd_add_hunk };
which is all the boilerplate needed to make the function ready for the RPC. The implementation uses the Boost Preprocessor Library (part of the Boost library, available at http://www.boost.org). The version we developed the code with is 1.31.
Definition in file cmd_hunk.h.