cmd_hunk.h File Reference

This module permits to create hunks for the functions that must be executed through RPC commands. More...

#include "parser.h"
#include <boost/preprocessor/library.hpp>

Go to the source code of this file.


Detailed Description

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.

Version:
Id
cmd_hunk.h 840 2007-10-08 17:21:31Z marco

Author:
Giovanni Bajo <rasky@develer.com>
Preprocessor magic to create hunks for the commands executed from the parser

Definition in file cmd_hunk.h.