driver: avoid magic in DRIVER_T_OUT_INIT
Provide a single type DRIVER_T_MESSAGE that describes a message-type
for a given body. Use this in the type-definitions, rather than hiding
the initialization-accessor C_DVAR_T_INIT in the macro. Also clearly
mark the type as a message type.
#include "peer.h"
#include "socket.h"
-#define DRIVER_T_OUT_INIT(type) C_DVAR_T_INIT( \
+/*
+ * This macro defines a c-dvar type for DBus Messages. It evaluates to:
+ *
+ * ((yyyyuua(yv))X)
+ *
+ * ..where 'X' is provided via @_body. That is, it evaluates to the combination
+ * of DBus Header and DBus Body for a given body-type.
+ */
+#define DRIVER_T_MESSAGE(_body) \
C_DVAR_T_TUPLE2( \
C_DVAR_T_TUPLE7( \
C_DVAR_T_y, \
) \
) \
), \
- type \
- ) \
+ _body \
)
static const CDVarType driver_type_in_s[] = {
@@ -73,52 +80,64 @@ static const CDVarType driver_type_in_asu[] = {
)
};
static const CDVarType driver_type_out_unit[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE0
)
+ )
};
static const CDVarType driver_type_out_s[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_s
-
+ )
)
)
};
static const CDVarType driver_type_out_b[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_b
)
)
+ )
};
static const CDVarType driver_type_out_u[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_u
)
)
+ )
};
static const CDVarType driver_type_out_as[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_ARRAY(
C_DVAR_T_s
)
)
)
+ )
};
static const CDVarType driver_type_out_ab[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_ARRAY(
C_DVAR_T_b
)
)
)
+ )
};
static const CDVarType driver_type_out_apsv[] = {
- DRIVER_T_OUT_INIT(
+ C_DVAR_T_INIT(
+ DRIVER_T_MESSAGE(
C_DVAR_T_TUPLE1(
C_DVAR_T_ARRAY(
C_DVAR_T_PAIR(
@@ -128,6 +147,7 @@ static const CDVarType driver_type_out_apsv[] = {
)
)
)
+ )
};
typedef struct DriverMethod DriverMethod;
