cmd_ctor.h
Go to the documentation of this file.00001
00040 #ifndef CMD_CTOR_H
00041 #define CMD_CTOR_H
00042
00043 #include <mware/parser.h>
00044
00045 #define REGISTER_FUNCTION parser_register_cmd
00046
00047 #define REGISTER_CMD(NAME) REGISTER_FUNCTION(&cmd_ ## NAME ## _template)
00048
00049 #define MAKE_TEMPLATE(NAME, ARGS, RES, FLAGS) \
00050 const struct CmdTemplate cmd_ ## NAME ## _template = \
00051 { \
00052 #NAME, ARGS, RES, cmd_ ## NAME, FLAGS \
00053 };
00054
00055 #define MAKE_CMD(NAME, ARGS, RES, BODY, FLAGS) \
00056 static ResultCode cmd_ ## NAME (parms *args) \
00057 { \
00058 return (ResultCode)BODY; \
00059 } \
00060 MAKE_TEMPLATE(NAME, ARGS, RES, FLAGS)
00061
00062 #endif // CMD_CTOR_H