/*
 *  This file is automatically generated by gen_interface.pl from evpath.h.
 *
 *  DO NOT EDIT
 *
 */
#include "config.h"
#include "ffs.h"
#include "atl.h"
#include "evpath.h"
#include "stdio.h"
#ifdef LT_LIBPREFIX
#include "ltdl.h"
#else
#ifdef _MSC_VER
#include <windows.h>
#define RTLD_GLOBAL 1
#define RTLD_LAZY 2
extern void* dlopen(const char* filename, int flags);
extern int dlclose(void* handle);
extern void* dlsym(void* handle, const char* name);
extern const char* dlerror(void);

#else
#include <dlfcn.h>
#endif

#define lt_dlopen(x) dlopen(x, 0)
#define lt_dlsym(x, y) dlsym(x, y)
#define lt_dlhandle void*
#define lt_dlinit() 0
#define lt_dlerror()  ""
#endif
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "cm_internal.h"
#ifdef  __cplusplus
extern "C" {
#endif
#if defined (__INTEL_COMPILER)
//  Allow unused
#  pragma warning (disable: 869)
#endif

typedef struct _EV_void_response {
    int condition_var;
} EV_void_response;

FMField  EV_void_response_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EV_void_response*, condition_var)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EV_void_response_formats[] = {
    {"EV_void_response", EV_void_response_flds, sizeof(EV_void_response), NULL},
    {NULL, NULL, 0, NULL}
};

typedef struct _EV_int_response {
    int condition_var;
    int  ret;
} EV_int_response;

FMField  EV_int_response_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EV_int_response*, condition_var)},
    {"ret", "integer", sizeof(EVstone), FMOffset(EV_int_response*,ret)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EV_int_response_formats[] = {
    {"EV_int_response", EV_int_response_flds, sizeof(EV_int_response), NULL},
    {NULL, NULL, 0, NULL}
};

typedef struct _EV_string_response {
    int condition_var;
    char *ret;
} EV_string_response;

FMField  EV_string_response_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EV_string_response*, condition_var)},
    {"ret", "string", sizeof(char*), FMOffset(EV_string_response*,ret)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EV_string_response_formats[] = {
    {"EV_string_response", EV_string_response_flds, sizeof(EV_string_response), NULL},
    {NULL, NULL, 0, NULL}
};

typedef struct _EV_EVevent_list_response {
    int condition_var;
    int ret_len;
    EVevent_list ret;
} EV_EVevent_list_response;

FMField  EV_EVevent_list_response_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EV_EVevent_list_response*, condition_var)},
    {"ret_len", "integer", sizeof(int), FMOffset(EV_EVevent_list_response*,ret_len)},
    {"ret", "EVevent_list[ret_len]", sizeof(struct buf_entry), FMOffset(EV_EVevent_list_response*,ret)},
    {NULL, NULL, 0, 0}
};

FMField  EVevent_list_flds[] = {
    {"length", "integer", sizeof(int), FMOffset(EVevent_list,length)},
    {"event_buffer", "char[length]", sizeof(char), FMOffset(EVevent_list, buffer)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EV_EVevent_list_response_formats[] = {
    {"EV_EVevent_response", EV_EVevent_list_response_flds, sizeof(EV_EVevent_list_response), NULL},
    {"EVevent_list", EVevent_list_flds, sizeof(struct buf_entry), NULL},
    {NULL, NULL, 0, NULL}
};

int
count_EVevent_list(EVevent_list list)
{
    int count = 0;
    while (list && list[count].buffer != NULL) {
        count++;
    }
    count++;
    return count;
}

EVevent_list
copy_EVevent_list(EVevent_list list)
{
    EVevent_list ret;
    int i, size = count_EVevent_list(list);
    ret = (EVevent_list) malloc(sizeof(ret[0]) * size);
    for (i=0; i < size-1; i++) {
        ret[i].length = list[i].length;
        ret[i].buffer = malloc(list[i].length);
        memcpy(ret[i].buffer, list[i].buffer, list[i].length);
    }
    ret[i].length = 0;
    ret[i].buffer = NULL;
    return ret;
}

EVSimpleHandlerFunc
REVPlookup_handler(char *name)
{
    EVSimpleHandlerFunc f = NULL;
    if (strncmp("0x", name, 2) == 0) {
        /* hex constant */
        void *p;
        sscanf(name, "0x%p", &p);
        f = (EVSimpleHandlerFunc)p;
        return f;
    } 
#if !NO_DYNAMIC_LINKING
    static lt_dlhandle h = NULL;
    static void *dh = NULL;
    if (h == NULL) {
        (void) lt_dlinit();
        h = lt_dlopen(NULL);
    }
    f = (EVSimpleHandlerFunc) lt_dlsym(h, name);
    if (f == NULL) {
        if (dh == NULL) {
            dh = dlopen(NULL, 0);
        }
        printf("Querying dlopen()\n");
        f = (EVSimpleHandlerFunc)dlsym(dh, name);
    }
    if (f == NULL) {
        if (dh == NULL) {
            dh = dlopen(NULL, RTLD_GLOBAL|RTLD_LAZY);
        }
        f = (EVSimpleHandlerFunc)dlsym(dh, name);
    }
#endif
    if (f == NULL) {
        printf("Dynamic symbol lookup for \"%s\" failed.\n\tEither the symbol is invalid, or symbol lookup is not enabled.\n", name);
        printf("Make sure that the symbol is declared \"extern\" (not \"static\")\n");
        printf("Try linking the program with either \"-rdynamic\" (GCC) or \"-dlopen self\" (libtool)\n");
    }
    return f;
}

static char *
get_format_name(CManager cm, FMStructDescList structs)
{
    int id_len, i;
    FMFormat format = EVregister_format_set(cm, structs);
    char *tmp = get_server_ID_FMformat(format, &id_len);
    char *str_tmp = malloc(id_len * 2 + 1);
    for (i=0; i < id_len; i++) {
        sprintf(&str_tmp[i*2], "%02x", ((unsigned char*)tmp)[i]);
    }
    return str_tmp;
}

extern FMStructDescList
REVPlookup_format_structs(CManager cm, char *format_name)
{
    FMFormat format;
    int slen = (int)strlen(format_name);
    int i;
    unsigned char *id = malloc(slen/2);
    for (i=0; i < slen/2; i++) {
        int x;
        char tmp[3] = {0, 0, 0};
        tmp[0] = format_name[2*i];
        tmp[1] = format_name[2*i + 1];
        sscanf(tmp, "%x", &x);
        id[i] = (unsigned char) x;
    }
    format = FMformat_from_ID(cm->evp->fmc, (char*)id);
    free(id);
    return format_list_of_FMFormat(format);
}


typedef struct _EVaction_add_split_target_request {
    int condition_var;
    EVstone stone;
    EVaction action;
    EVstone target_stone;
} EVaction_add_split_target_request;

typedef struct _EVaction_add_split_target_response {
    int condition_var;
    int ret;
} EVaction_add_split_target_response;

FMField  EVaction_add_split_target_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVaction_add_split_target_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_add_split_target_request*,stone)},
    {"action", "integer", sizeof(EVaction), FMOffset(EVaction_add_split_target_request*,action)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_add_split_target_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVaction_add_split_target_req_formats[] = {
    {"EV_EVaction_add_split_target_request", EVaction_add_split_target_req_flds, sizeof(EVaction_add_split_target_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVaction_add_split_target_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVaction_add_split_target_req_formats);
    request.stone = stone;
    request.action = action;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVaction_add_split_target_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVaction_add_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVaction_add_split_target(conn, stone, action, target_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVaction_add_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVaction_add_split_target_request *request = (EVaction_add_split_target_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVaction_add_split_target(cm, request->stone, request->action, request->target_stone);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVaction_remove_split_target_request {
    int condition_var;
    EVstone stone;
    EVaction action;
    EVstone target_stone;
} EVaction_remove_split_target_request;

typedef struct _EVaction_remove_split_target_response {
    int condition_var;
} EVaction_remove_split_target_response;

FMField  EVaction_remove_split_target_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVaction_remove_split_target_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_remove_split_target_request*,stone)},
    {"action", "integer", sizeof(EVaction), FMOffset(EVaction_remove_split_target_request*,action)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_remove_split_target_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVaction_remove_split_target_req_formats[] = {
    {"EV_EVaction_remove_split_target_request", EVaction_remove_split_target_req_flds, sizeof(EVaction_remove_split_target_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EVaction_remove_split_target_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVaction_remove_split_target_req_formats);
    request.stone = stone;
    request.action = action;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVaction_remove_split_target_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVaction_remove_split_target(CMConnection conn, EVstone stone, EVaction action, EVstone target_stone)
{
    CManager_lock(conn->cm);
    INT_REVaction_remove_split_target(conn, stone, action, target_stone);
    CManager_unlock(conn->cm);
    return;
}

static void
REVaction_remove_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVaction_remove_split_target_request *request = (EVaction_remove_split_target_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVaction_remove_split_target(cm, request->stone, request->action, request->target_stone);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVaction_set_output_request {
    int condition_var;
    EVstone stone;
    EVaction action;
    int output_index;
    EVstone target_stone;
} EVaction_set_output_request;

typedef struct _EVaction_set_output_response {
    int condition_var;
    int ret;
} EVaction_set_output_response;

FMField  EVaction_set_output_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVaction_set_output_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVaction_set_output_request*,stone)},
    {"action", "integer", sizeof(EVaction), FMOffset(EVaction_set_output_request*,action)},
    {"output_index", "integer", sizeof(int), FMOffset(EVaction_set_output_request*,output_index)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVaction_set_output_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVaction_set_output_req_formats[] = {
    {"EV_EVaction_set_output_request", EVaction_set_output_req_flds, sizeof(EVaction_set_output_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVaction_set_output_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVaction_set_output_req_formats);
    request.stone = stone;
    request.action = action;
    request.output_index = output_index;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVaction_set_output_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVaction_set_output(CMConnection conn, EVstone stone, EVaction action, int output_index, EVstone target_stone)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVaction_set_output(conn, stone, action, output_index, target_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVaction_set_output_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVaction_set_output_request *request = (EVaction_set_output_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVaction_set_output(cm, request->stone, request->action, request->output_index, request->target_stone);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EValloc_stone_request {
    int condition_var;
} EValloc_stone_request;

typedef struct _EValloc_stone_response {
    int condition_var;
    EVstone ret;
} EValloc_stone_response;

FMField  EValloc_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EValloc_stone_request*, condition_var)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EValloc_stone_req_formats[] = {
    {"EV_EValloc_stone_request", EValloc_stone_req_flds, sizeof(EValloc_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REValloc_stone(CMConnection conn)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EValloc_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EValloc_stone_req_formats);
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EValloc_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REValloc_stone(CMConnection conn)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REValloc_stone(conn);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REValloc_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EValloc_stone_request *request = (EValloc_stone_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EValloc_stone(cm);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_bridge_action_request {
    int condition_var;
    EVstone stone;
    char* contact_list;
    EVstone remote_stone;
} EVassoc_bridge_action_request;

typedef struct _EVassoc_bridge_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_bridge_action_response;

FMField  EVassoc_bridge_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_bridge_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_bridge_action_request*,stone)},
    {"contact_list", "string", sizeof(attr_list), FMOffset(EVassoc_bridge_action_request*,contact_list)},
    {"remote_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_bridge_action_request*,remote_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_bridge_action_req_formats[] = {
    {"EV_EVassoc_bridge_action_request", EVassoc_bridge_action_req_flds, sizeof(EVassoc_bridge_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_bridge_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_bridge_action_req_formats);
    request.stone = stone;
    request.contact_list = attr_list_to_string(contact_list);
    request.remote_stone = remote_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_bridge_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    free(request.contact_list);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_bridge_action(CMConnection conn, EVstone stone, attr_list contact_list, EVstone remote_stone)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_bridge_action(conn, stone, contact_list, remote_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_bridge_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_bridge_action_request *request = (EVassoc_bridge_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    attr_list contact_list = attr_list_from_string(request->contact_list);
    ret = EVassoc_bridge_action(cm, request->stone, contact_list, request->remote_stone);
free_attr_list(contact_list);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_filter_action_request {
    int condition_var;
    EVstone stone;
    char* incoming_format_list;
    char* handler;
    EVstone out_stone;
} EVassoc_filter_action_request;

typedef struct _EVassoc_filter_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_filter_action_response;

FMField  EVassoc_filter_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_filter_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_filter_action_request*,stone)},
    {"incoming_format_list", "string", sizeof(FMStructDescList), FMOffset(EVassoc_filter_action_request*,incoming_format_list)},
    {"handler", "string", sizeof(char*), FMOffset(EVassoc_filter_action_request*,handler)},
    {"out_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_filter_action_request*,out_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_filter_action_req_formats[] = {
    {"EV_EVassoc_filter_action_request", EVassoc_filter_action_req_flds, sizeof(EVassoc_filter_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_filter_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_filter_action_req_formats);
    request.stone = stone;
    request.incoming_format_list = get_format_name(conn->cm, incoming_format_list);
    request.handler = handler;
    request.out_stone = out_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_filter_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_filter_action(CMConnection conn, EVstone stone, FMStructDescList incoming_format_list, char *handler, EVstone out_stone)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_filter_action(conn, stone, incoming_format_list, handler, out_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_filter_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_filter_action_request *request = (EVassoc_filter_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    FMStructDescList incoming_format_list = REVPlookup_format_structs(conn->cm, request->incoming_format_list);
    EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler);
    ret = EVassoc_filter_action(cm, request->stone, incoming_format_list, handler, request->out_stone, NULL);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_immediate_action_request {
    int condition_var;
    EVstone stone;
    char* action_spec;
} EVassoc_immediate_action_request;

typedef struct _EVassoc_immediate_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_immediate_action_response;

FMField  EVassoc_immediate_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_immediate_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_immediate_action_request*,stone)},
    {"action_spec", "string", sizeof(char*), FMOffset(EVassoc_immediate_action_request*,action_spec)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_immediate_action_req_formats[] = {
    {"EV_EVassoc_immediate_action_request", EVassoc_immediate_action_req_flds, sizeof(EVassoc_immediate_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_immediate_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_immediate_action_req_formats);
    request.stone = stone;
    request.action_spec = action_spec;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_immediate_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_immediate_action(CMConnection conn, EVstone stone, char *action_spec)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_immediate_action(conn, stone, action_spec);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_immediate_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_immediate_action_request *request = (EVassoc_immediate_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVassoc_immediate_action(cm, request->stone, request->action_spec, NULL);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_multi_action_request {
    int condition_var;
    EVstone stone;
    char* action_spec;
} EVassoc_multi_action_request;

typedef struct _EVassoc_multi_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_multi_action_response;

FMField  EVassoc_multi_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_multi_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_multi_action_request*,stone)},
    {"action_spec", "string", sizeof(char*), FMOffset(EVassoc_multi_action_request*,action_spec)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_multi_action_req_formats[] = {
    {"EV_EVassoc_multi_action_request", EVassoc_multi_action_req_flds, sizeof(EVassoc_multi_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_multi_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_multi_action_req_formats);
    request.stone = stone;
    request.action_spec = action_spec;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_multi_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_multi_action(CMConnection conn, EVstone stone, char *action_spec)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_multi_action(conn, stone, action_spec);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_multi_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_multi_action_request *request = (EVassoc_multi_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVassoc_multi_action(cm, request->stone, request->action_spec, NULL);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_split_action_request {
    int condition_var;
    EVstone stone;
    int target_list_len;
    int * target_list;
} EVassoc_split_action_request;

typedef struct _EVassoc_split_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_split_action_response;

FMField  EVassoc_split_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_split_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_split_action_request*,stone)},
    {"target_list", "integer", sizeof(EVstone*), FMOffset(EVassoc_split_action_request*,target_list)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_split_action_req_formats[] = {
    {"EV_EVassoc_split_action_request", EVassoc_split_action_req_flds, sizeof(EVassoc_split_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_split_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_split_action_req_formats);
    request.stone = stone;
    request.target_list = target_list;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_split_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_split_action(CMConnection conn, EVstone stone, EVstone *target_list)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_split_action(conn, stone, target_list);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_split_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_split_action_request *request = (EVassoc_split_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVassoc_split_action(cm, request->stone, request->target_list);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_store_action_request {
    int condition_var;
    EVstone stone_num;
    EVstone out_stone;
    int store_limit;
} EVassoc_store_action_request;

typedef struct _EVassoc_store_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_store_action_response;

FMField  EVassoc_store_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_store_action_request*, condition_var)},
    {"stone_num", "integer", sizeof(EVstone), FMOffset(EVassoc_store_action_request*,stone_num)},
    {"out_stone", "integer", sizeof(EVstone), FMOffset(EVassoc_store_action_request*,out_stone)},
    {"store_limit", "integer", sizeof(int), FMOffset(EVassoc_store_action_request*,store_limit)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_store_action_req_formats[] = {
    {"EV_EVassoc_store_action_request", EVassoc_store_action_req_flds, sizeof(EVassoc_store_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_store_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_store_action_req_formats);
    request.stone_num = stone_num;
    request.out_stone = out_stone;
    request.store_limit = store_limit;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_store_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_store_action(CMConnection conn, EVstone stone_num, EVstone out_stone, int store_limit)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_store_action(conn, stone_num, out_stone, store_limit);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_store_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_store_action_request *request = (EVassoc_store_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVassoc_store_action(cm, request->stone_num, request->out_stone, request->store_limit);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVassoc_terminal_action_request {
    int condition_var;
    EVstone stone;
    char* format_list;
    char* handler;
} EVassoc_terminal_action_request;

typedef struct _EVassoc_terminal_action_response {
    int condition_var;
    EVaction ret;
} EVassoc_terminal_action_response;

FMField  EVassoc_terminal_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVassoc_terminal_action_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVassoc_terminal_action_request*,stone)},
    {"format_list", "string", sizeof(FMStructDescList), FMOffset(EVassoc_terminal_action_request*,format_list)},
    {"handler", "string", sizeof(char*), FMOffset(EVassoc_terminal_action_request*,handler)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVassoc_terminal_action_req_formats[] = {
    {"EV_EVassoc_terminal_action_request", EVassoc_terminal_action_req_flds, sizeof(EVassoc_terminal_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVaction
INT_REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVassoc_terminal_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVassoc_terminal_action_req_formats);
    request.stone = stone;
    request.format_list = get_format_name(conn->cm, format_list);
    request.handler = handler;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVassoc_terminal_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVaction) response.ret;
}

extern EVaction
REVassoc_terminal_action(CMConnection conn, EVstone stone, FMStructDescList format_list, char *handler)
{
    EVaction ret;
    CManager_lock(conn->cm);
    ret = INT_REVassoc_terminal_action(conn, stone, format_list, handler);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVassoc_terminal_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVassoc_terminal_action_request *request = (EVassoc_terminal_action_request *) data;
    EVaction ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    FMStructDescList format_list = REVPlookup_format_structs(conn->cm, request->format_list);
    EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler);
    ret = EVassoc_terminal_action(cm, request->stone, format_list, handler, NULL);
    response.ret = (int) ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVclear_stored_request {
    int condition_var;
    EVstone stone_num;
    EVaction action_num;
} EVclear_stored_request;

typedef struct _EVclear_stored_response {
    int condition_var;
} EVclear_stored_response;

FMField  EVclear_stored_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVclear_stored_request*, condition_var)},
    {"stone_num", "integer", sizeof(EVstone), FMOffset(EVclear_stored_request*,stone_num)},
    {"action_num", "integer", sizeof(EVaction), FMOffset(EVclear_stored_request*,action_num)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVclear_stored_req_formats[] = {
    {"EV_EVclear_stored_request", EVclear_stored_req_flds, sizeof(EVclear_stored_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num)
{
    int cond;
    CMFormat f;
    EVclear_stored_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVclear_stored_req_formats);
    request.stone_num = stone_num;
    request.action_num = action_num;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVclear_stored_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVclear_stored(CMConnection conn, EVstone stone_num, EVaction action_num)
{
    CManager_lock(conn->cm);
    INT_REVclear_stored(conn, stone_num, action_num);
    CManager_unlock(conn->cm);
    return;
}

static void
REVclear_stored_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVclear_stored_request *request = (EVclear_stored_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVclear_stored(cm, request->stone_num, request->action_num);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_auto_stone_request {
    int condition_var;
    int period_sec;
    int period_usec;
    char* action_spec;
    EVstone out_stone;
} EVcreate_auto_stone_request;

typedef struct _EVcreate_auto_stone_response {
    int condition_var;
    EVstone ret;
} EVcreate_auto_stone_response;

FMField  EVcreate_auto_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*, condition_var)},
    {"period_sec", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*,period_sec)},
    {"period_usec", "integer", sizeof(int), FMOffset(EVcreate_auto_stone_request*,period_usec)},
    {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_auto_stone_request*,action_spec)},
    {"out_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_auto_stone_request*,out_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_auto_stone_req_formats[] = {
    {"EV_EVcreate_auto_stone_request", EVcreate_auto_stone_req_flds, sizeof(EVcreate_auto_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_auto_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_auto_stone_req_formats);
    request.period_sec = period_sec;
    request.period_usec = period_usec;
    request.action_spec = action_spec;
    request.out_stone = out_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_auto_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_auto_stone(CMConnection conn, int period_sec, int period_usec, char *action_spec, EVstone out_stone)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_auto_stone(conn, period_sec, period_usec, action_spec, out_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_auto_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_auto_stone_request *request = (EVcreate_auto_stone_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVcreate_auto_stone(cm, request->period_sec, request->period_usec, request->action_spec, request->out_stone);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_bridge_action_request {
    int condition_var;
    char* contact_list;
    EVstone remote_stone;
} EVcreate_bridge_action_request;

typedef struct _EVcreate_bridge_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_bridge_action_response;

FMField  EVcreate_bridge_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_bridge_action_request*, condition_var)},
    {"contact_list", "string", sizeof(attr_list), FMOffset(EVcreate_bridge_action_request*,contact_list)},
    {"remote_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_bridge_action_request*,remote_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_bridge_action_req_formats[] = {
    {"EV_EVcreate_bridge_action_request", EVcreate_bridge_action_req_flds, sizeof(EVcreate_bridge_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_bridge_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_bridge_action_req_formats);
    request.contact_list = attr_list_to_string(contact_list);
    request.remote_stone = remote_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_bridge_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    free(request.contact_list);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_bridge_action(CMConnection conn, attr_list contact_list, EVstone remote_stone)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_bridge_action(conn, contact_list, remote_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_bridge_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_bridge_action_request *request = (EVcreate_bridge_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    attr_list contact_list = attr_list_from_string(request->contact_list);
    ret = EVcreate_bridge_action(cm, contact_list, request->remote_stone);
free_attr_list(contact_list);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_immediate_action_request {
    int condition_var;
    char* action_spec;
    int target_list_len;
    int * target_list;
} EVcreate_immediate_action_request;

typedef struct _EVcreate_immediate_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_immediate_action_response;

FMField  EVcreate_immediate_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_immediate_action_request*, condition_var)},
    {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_immediate_action_request*,action_spec)},
    {"target_list", "integer", sizeof(EVstone*), FMOffset(EVcreate_immediate_action_request*,target_list)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_immediate_action_req_formats[] = {
    {"EV_EVcreate_immediate_action_request", EVcreate_immediate_action_req_flds, sizeof(EVcreate_immediate_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_immediate_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_immediate_action_req_formats);
    request.action_spec = action_spec;
    request.target_list = target_list;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_immediate_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_immediate_action(CMConnection conn, char *action_spec, EVstone *target_list)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_immediate_action(conn, action_spec, target_list);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_immediate_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_immediate_action_request *request = (EVcreate_immediate_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVcreate_immediate_action(cm, request->action_spec, request->target_list);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_split_action_request {
    int condition_var;
    int target_list_len;
    int * target_list;
} EVcreate_split_action_request;

typedef struct _EVcreate_split_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_split_action_response;

FMField  EVcreate_split_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_split_action_request*, condition_var)},
    {"target_list", "integer", sizeof(EVstone*), FMOffset(EVcreate_split_action_request*,target_list)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_split_action_req_formats[] = {
    {"EV_EVcreate_split_action_request", EVcreate_split_action_req_flds, sizeof(EVcreate_split_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_split_action(CMConnection conn, EVstone *target_list)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_split_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_split_action_req_formats);
    request.target_list = target_list;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_split_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_split_action(CMConnection conn, EVstone *target_list)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_split_action(conn, target_list);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_split_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_split_action_request *request = (EVcreate_split_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVcreate_split_action(cm, request->target_list);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_stone_action_request {
    int condition_var;
    char* action_spec;
} EVcreate_stone_action_request;

typedef struct _EVcreate_stone_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_stone_action_response;

FMField  EVcreate_stone_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_stone_action_request*, condition_var)},
    {"action_spec", "string", sizeof(char*), FMOffset(EVcreate_stone_action_request*,action_spec)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_stone_action_req_formats[] = {
    {"EV_EVcreate_stone_action_request", EVcreate_stone_action_req_flds, sizeof(EVcreate_stone_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_stone_action(CMConnection conn, char *action_spec)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_stone_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_stone_action_req_formats);
    request.action_spec = action_spec;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_stone_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_stone_action(CMConnection conn, char *action_spec)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_stone_action(conn, action_spec);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_stone_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_stone_action_request *request = (EVcreate_stone_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVcreate_stone_action(cm, request->action_spec);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_store_action_request {
    int condition_var;
    EVstone out_stone;
    int store_limit;
} EVcreate_store_action_request;

typedef struct _EVcreate_store_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_store_action_response;

FMField  EVcreate_store_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_store_action_request*, condition_var)},
    {"out_stone", "integer", sizeof(EVstone), FMOffset(EVcreate_store_action_request*,out_stone)},
    {"store_limit", "integer", sizeof(int), FMOffset(EVcreate_store_action_request*,store_limit)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_store_action_req_formats[] = {
    {"EV_EVcreate_store_action_request", EVcreate_store_action_req_flds, sizeof(EVcreate_store_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_store_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_store_action_req_formats);
    request.out_stone = out_stone;
    request.store_limit = store_limit;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_store_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_store_action(CMConnection conn, EVstone out_stone, int store_limit)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_store_action(conn, out_stone, store_limit);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_store_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_store_action_request *request = (EVcreate_store_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVcreate_store_action(cm, request->out_stone, request->store_limit);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVcreate_terminal_action_request {
    int condition_var;
    char* format_list;
    char* handler;
} EVcreate_terminal_action_request;

typedef struct _EVcreate_terminal_action_response {
    int condition_var;
    EVstone ret;
} EVcreate_terminal_action_response;

FMField  EVcreate_terminal_action_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVcreate_terminal_action_request*, condition_var)},
    {"format_list", "string", sizeof(FMStructDescList), FMOffset(EVcreate_terminal_action_request*,format_list)},
    {"handler", "string", sizeof(char*), FMOffset(EVcreate_terminal_action_request*,handler)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVcreate_terminal_action_req_formats[] = {
    {"EV_EVcreate_terminal_action_request", EVcreate_terminal_action_req_flds, sizeof(EVcreate_terminal_action_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern EVstone
INT_REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVcreate_terminal_action_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVcreate_terminal_action_req_formats);
    request.format_list = get_format_name(conn->cm, format_list);
    request.handler = handler;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVcreate_terminal_action_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return (EVstone) response.ret;
}

extern EVstone
REVcreate_terminal_action(CMConnection conn, FMStructDescList format_list, char *handler)
{
    EVstone ret;
    CManager_lock(conn->cm);
    ret = INT_REVcreate_terminal_action(conn, format_list, handler);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVcreate_terminal_action_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVcreate_terminal_action_request *request = (EVcreate_terminal_action_request *) data;
    EVstone ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    FMStructDescList format_list = REVPlookup_format_structs(conn->cm, request->format_list);
    EVSimpleHandlerFunc handler = REVPlookup_handler(request->handler);
    ret = EVcreate_terminal_action(cm, format_list, handler, NULL);
    response.ret = (int)ret;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVdestroy_stone_request {
    int condition_var;
    EVstone stone_id;
} EVdestroy_stone_request;

typedef struct _EVdestroy_stone_response {
    int condition_var;
    int ret;
} EVdestroy_stone_response;

FMField  EVdestroy_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVdestroy_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVdestroy_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVdestroy_stone_req_formats[] = {
    {"EV_EVdestroy_stone_request", EVdestroy_stone_req_flds, sizeof(EVdestroy_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVdestroy_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVdestroy_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVdestroy_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVdestroy_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVdestroy_stone(CMConnection conn, EVstone stone_id)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVdestroy_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVdestroy_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVdestroy_stone_request *request = (EVdestroy_stone_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVdestroy_stone(cm, request->stone_id);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVdrain_stone_request {
    int condition_var;
    EVstone stone_id;
} EVdrain_stone_request;

typedef struct _EVdrain_stone_response {
    int condition_var;
    int ret;
} EVdrain_stone_response;

FMField  EVdrain_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVdrain_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVdrain_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVdrain_stone_req_formats[] = {
    {"EV_EVdrain_stone_request", EVdrain_stone_req_flds, sizeof(EVdrain_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVdrain_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVdrain_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVdrain_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVdrain_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVdrain_stone(CMConnection conn, EVstone stone_id)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVdrain_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVdrain_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVdrain_stone_request *request = (EVdrain_stone_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVdrain_stone(cm, request->stone_id);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVenable_auto_stone_request {
    int condition_var;
    EVstone stone_num;
    int period_sec;
    int period_usec;
} EVenable_auto_stone_request;

typedef struct _EVenable_auto_stone_response {
    int condition_var;
} EVenable_auto_stone_response;

FMField  EVenable_auto_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*, condition_var)},
    {"stone_num", "integer", sizeof(EVstone), FMOffset(EVenable_auto_stone_request*,stone_num)},
    {"period_sec", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*,period_sec)},
    {"period_usec", "integer", sizeof(int), FMOffset(EVenable_auto_stone_request*,period_usec)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVenable_auto_stone_req_formats[] = {
    {"EV_EVenable_auto_stone_request", EVenable_auto_stone_req_flds, sizeof(EVenable_auto_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec)
{
    int cond;
    CMFormat f;
    EVenable_auto_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVenable_auto_stone_req_formats);
    request.stone_num = stone_num;
    request.period_sec = period_sec;
    request.period_usec = period_usec;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVenable_auto_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVenable_auto_stone(CMConnection conn, EVstone stone_num, int period_sec, int period_usec)
{
    CManager_lock(conn->cm);
    INT_REVenable_auto_stone(conn, stone_num, period_sec, period_usec);
    CManager_unlock(conn->cm);
    return;
}

static void
REVenable_auto_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVenable_auto_stone_request *request = (EVenable_auto_stone_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVenable_auto_stone(cm, request->stone_num, request->period_sec, request->period_usec);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVextract_attr_list_request {
    int condition_var;
    EVstone stone_id;
} EVextract_attr_list_request;

typedef struct _EVextract_attr_list_response {
    int condition_var;
    char* ret;
} EVextract_attr_list_response;

FMField  EVextract_attr_list_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVextract_attr_list_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVextract_attr_list_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVextract_attr_list_req_formats[] = {
    {"EV_EVextract_attr_list_request", EVextract_attr_list_req_flds, sizeof(EVextract_attr_list_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern attr_list
INT_REVextract_attr_list(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EV_string_response response;
    EVextract_attr_list_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVextract_attr_list_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVextract_attr_list_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return attr_list_from_string(response.ret);
}

extern attr_list
REVextract_attr_list(CMConnection conn, EVstone stone_id)
{
    attr_list ret;
    CManager_lock(conn->cm);
    ret = INT_REVextract_attr_list(conn, stone_id);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVextract_attr_list_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_string_response response;
    EVextract_attr_list_request *request = (EVextract_attr_list_request *) data;
    attr_list ret;
    CMFormat f = CMlookup_format(conn->cm, EV_string_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_string_response_formats);
    }
    ret = EVextract_attr_list(cm, request->stone_id);
    response.ret = attr_list_to_string(ret);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
    atl_free(response.ret);
}

typedef struct _EVfree_stone_request {
    int condition_var;
    EVstone stone;
} EVfree_stone_request;

typedef struct _EVfree_stone_response {
    int condition_var;
} EVfree_stone_response;

FMField  EVfree_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVfree_stone_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVfree_stone_request*,stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVfree_stone_req_formats[] = {
    {"EV_EVfree_stone_request", EVfree_stone_req_flds, sizeof(EVfree_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVfree_stone(CMConnection conn, EVstone stone)
{
    int cond;
    CMFormat f;
    EVfree_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVfree_stone_req_formats);
    request.stone = stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVfree_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVfree_stone(CMConnection conn, EVstone stone)
{
    CManager_lock(conn->cm);
    INT_REVfree_stone(conn, stone);
    CManager_unlock(conn->cm);
    return;
}

static void
REVfree_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVfree_stone_request *request = (EVfree_stone_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVfree_stone(cm, request->stone);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVfreeze_stone_request {
    int condition_var;
    EVstone stone_id;
} EVfreeze_stone_request;

typedef struct _EVfreeze_stone_response {
    int condition_var;
    int ret;
} EVfreeze_stone_response;

FMField  EVfreeze_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVfreeze_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVfreeze_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVfreeze_stone_req_formats[] = {
    {"EV_EVfreeze_stone_request", EVfreeze_stone_req_flds, sizeof(EVfreeze_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVfreeze_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVfreeze_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVfreeze_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVfreeze_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVfreeze_stone(CMConnection conn, EVstone stone_id)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVfreeze_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVfreeze_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVfreeze_stone_request *request = (EVfreeze_stone_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVfreeze_stone(cm, request->stone_id);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVset_attr_list_request {
    int condition_var;
    EVstone stone_id;
    char* list;
} EVset_attr_list_request;

typedef struct _EVset_attr_list_response {
    int condition_var;
} EVset_attr_list_response;

FMField  EVset_attr_list_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVset_attr_list_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVset_attr_list_request*,stone_id)},
    {"list", "string", sizeof(attr_list), FMOffset(EVset_attr_list_request*,list)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVset_attr_list_req_formats[] = {
    {"EV_EVset_attr_list_request", EVset_attr_list_req_flds, sizeof(EVset_attr_list_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list)
{
    int cond;
    CMFormat f;
    EVset_attr_list_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVset_attr_list_req_formats);
    request.stone_id = stone_id;
    request.list = attr_list_to_string(list);
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVset_attr_list_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    free(request.list);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVset_attr_list(CMConnection conn, EVstone stone_id, attr_list list)
{
    CManager_lock(conn->cm);
    INT_REVset_attr_list(conn, stone_id, list);
    CManager_unlock(conn->cm);
    return;
}

static void
REVset_attr_list_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVset_attr_list_request *request = (EVset_attr_list_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    attr_list list = attr_list_from_string(request->list);
    EVset_attr_list(cm, request->stone_id, list);
free_attr_list(list);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVstall_stone_request {
    int condition_var;
    EVstone stone_id;
} EVstall_stone_request;

typedef struct _EVstall_stone_response {
    int condition_var;
} EVstall_stone_response;

FMField  EVstall_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVstall_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVstall_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVstall_stone_req_formats[] = {
    {"EV_EVstall_stone_request", EVstall_stone_req_flds, sizeof(EVstall_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVstall_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EVstall_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVstall_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVstall_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVstall_stone(CMConnection conn, EVstone stone_id)
{
    CManager_lock(conn->cm);
    INT_REVstall_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return;
}

static void
REVstall_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVstall_stone_request *request = (EVstall_stone_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVstall_stone(cm, request->stone_id);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVstone_add_split_target_request {
    int condition_var;
    EVstone stone;
    EVstone target_stone;
} EVstone_add_split_target_request;

typedef struct _EVstone_add_split_target_response {
    int condition_var;
} EVstone_add_split_target_response;

FMField  EVstone_add_split_target_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVstone_add_split_target_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_add_split_target_request*,stone)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_add_split_target_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVstone_add_split_target_req_formats[] = {
    {"EV_EVstone_add_split_target_request", EVstone_add_split_target_req_flds, sizeof(EVstone_add_split_target_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EVstone_add_split_target_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVstone_add_split_target_req_formats);
    request.stone = stone;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVstone_add_split_target_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVstone_add_split_target(CMConnection conn, EVstone stone, EVstone target_stone)
{
    CManager_lock(conn->cm);
    INT_REVstone_add_split_target(conn, stone, target_stone);
    CManager_unlock(conn->cm);
    return;
}

static void
REVstone_add_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVstone_add_split_target_request *request = (EVstone_add_split_target_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVstone_add_split_target(cm, request->stone, request->target_stone);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVstone_remove_split_target_request {
    int condition_var;
    EVstone stone;
    EVstone target_stone;
} EVstone_remove_split_target_request;

typedef struct _EVstone_remove_split_target_response {
    int condition_var;
} EVstone_remove_split_target_response;

FMField  EVstone_remove_split_target_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVstone_remove_split_target_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_remove_split_target_request*,stone)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_remove_split_target_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVstone_remove_split_target_req_formats[] = {
    {"EV_EVstone_remove_split_target_request", EVstone_remove_split_target_req_flds, sizeof(EVstone_remove_split_target_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EVstone_remove_split_target_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVstone_remove_split_target_req_formats);
    request.stone = stone;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVstone_remove_split_target_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVstone_remove_split_target(CMConnection conn, EVstone stone, EVstone target_stone)
{
    CManager_lock(conn->cm);
    INT_REVstone_remove_split_target(conn, stone, target_stone);
    CManager_unlock(conn->cm);
    return;
}

static void
REVstone_remove_split_target_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVstone_remove_split_target_request *request = (EVstone_remove_split_target_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVstone_remove_split_target(cm, request->stone, request->target_stone);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVstone_set_output_request {
    int condition_var;
    EVstone stone;
    int output_index;
    EVstone target_stone;
} EVstone_set_output_request;

typedef struct _EVstone_set_output_response {
    int condition_var;
    int ret;
} EVstone_set_output_response;

FMField  EVstone_set_output_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVstone_set_output_request*, condition_var)},
    {"stone", "integer", sizeof(EVstone), FMOffset(EVstone_set_output_request*,stone)},
    {"output_index", "integer", sizeof(int), FMOffset(EVstone_set_output_request*,output_index)},
    {"target_stone", "integer", sizeof(EVstone), FMOffset(EVstone_set_output_request*,target_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVstone_set_output_req_formats[] = {
    {"EV_EVstone_set_output_request", EVstone_set_output_req_flds, sizeof(EVstone_set_output_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVstone_set_output_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVstone_set_output_req_formats);
    request.stone = stone;
    request.output_index = output_index;
    request.target_stone = target_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVstone_set_output_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVstone_set_output(CMConnection conn, EVstone stone, int output_index, EVstone target_stone)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVstone_set_output(conn, stone, output_index, target_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVstone_set_output_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVstone_set_output_request *request = (EVstone_set_output_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVstone_set_output(cm, request->stone, request->output_index, request->target_stone);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVtransfer_events_request {
    int condition_var;
    EVstone src_stone;
    EVstone dest_stone;
} EVtransfer_events_request;

typedef struct _EVtransfer_events_response {
    int condition_var;
    int ret;
} EVtransfer_events_response;

FMField  EVtransfer_events_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVtransfer_events_request*, condition_var)},
    {"src_stone", "integer", sizeof(EVstone), FMOffset(EVtransfer_events_request*,src_stone)},
    {"dest_stone", "integer", sizeof(EVstone), FMOffset(EVtransfer_events_request*,dest_stone)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVtransfer_events_req_formats[] = {
    {"EV_EVtransfer_events_request", EVtransfer_events_req_flds, sizeof(EVtransfer_events_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVtransfer_events_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVtransfer_events_req_formats);
    request.src_stone = src_stone;
    request.dest_stone = dest_stone;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVtransfer_events_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVtransfer_events(CMConnection conn, EVstone src_stone, EVstone dest_stone)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVtransfer_events(conn, src_stone, dest_stone);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVtransfer_events_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVtransfer_events_request *request = (EVtransfer_events_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVtransfer_events(cm, request->src_stone, request->dest_stone);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVunfreeze_stone_request {
    int condition_var;
    EVstone stone_id;
} EVunfreeze_stone_request;

typedef struct _EVunfreeze_stone_response {
    int condition_var;
    int ret;
} EVunfreeze_stone_response;

FMField  EVunfreeze_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVunfreeze_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVunfreeze_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVunfreeze_stone_req_formats[] = {
    {"EV_EVunfreeze_stone_request", EVunfreeze_stone_req_flds, sizeof(EVunfreeze_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern int
INT_REVunfreeze_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EV_int_response response;
    EVunfreeze_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVunfreeze_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVunfreeze_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, &response);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
    return response.ret;
}

extern int
REVunfreeze_stone(CMConnection conn, EVstone stone_id)
{
    int ret;
    CManager_lock(conn->cm);
    ret = INT_REVunfreeze_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return ret;
}

static void
REVunfreeze_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_int_response response;
    EVunfreeze_stone_request *request = (EVunfreeze_stone_request *) data;
    int ret;
    CMFormat f = CMlookup_format(conn->cm, EV_int_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_int_response_formats);
    }
    ret = EVunfreeze_stone(cm, request->stone_id);
    response.ret = ret;;
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}

typedef struct _EVunstall_stone_request {
    int condition_var;
    EVstone stone_id;
} EVunstall_stone_request;

typedef struct _EVunstall_stone_response {
    int condition_var;
} EVunstall_stone_response;

FMField  EVunstall_stone_req_flds[] = {
    {"condition_var", "integer", sizeof(int), FMOffset(EVunstall_stone_request*, condition_var)},
    {"stone_id", "integer", sizeof(EVstone), FMOffset(EVunstall_stone_request*,stone_id)},
    {NULL, NULL, 0, 0}
};

FMStructDescRec  EVunstall_stone_req_formats[] = {
    {"EV_EVunstall_stone_request", EVunstall_stone_req_flds, sizeof(EVunstall_stone_request), NULL},
    {NULL, NULL, 0, NULL}
};

extern void
INT_REVunstall_stone(CMConnection conn, EVstone stone_id)
{
    int cond;
    CMFormat f;
    EVunstall_stone_request request;
    memset(&request, 0, sizeof(request));
    cond = INT_CMCondition_get(conn->cm, conn);
    f = INT_CMlookup_format(conn->cm, EVunstall_stone_req_formats);
    request.stone_id = stone_id;
    request.condition_var = cond;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EVunstall_stone_req_formats);
    }
    INT_CMCondition_set_client_data(conn->cm, cond, NULL);
    INT_CMwrite(conn, f, &request);
    INT_CMCondition_wait(conn->cm, cond);
}

extern void
REVunstall_stone(CMConnection conn, EVstone stone_id)
{
    CManager_lock(conn->cm);
    INT_REVunstall_stone(conn, stone_id);
    CManager_unlock(conn->cm);
    return;
}

static void
REVunstall_stone_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list message_attrs)
{
    EV_void_response response;
    EVunstall_stone_request *request = (EVunstall_stone_request *) data;
    CMFormat f = CMlookup_format(conn->cm, EV_void_response_formats);
    (void) message_attrs;
    (void) client_data;
    if (f == NULL) {
        f = INT_CMregister_format(conn->cm, EV_void_response_formats);
    }
    EVunstall_stone(cm, request->stone_id);
    response.condition_var = request->condition_var;
    CMwrite(conn, f, &response);
}
static void
REV_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs)
{
    EV_void_response *response = (EV_void_response*) data;
    void **response_ptr = CMCondition_get_client_data(cm, response->condition_var);
    if (NULL != response_ptr) {
        *response_ptr = data;
    }
    CMCondition_signal(cm, response->condition_var);
}

static void
REV_int_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs)
{
    EV_void_response *response = (EV_void_response*) data;
    void **response_ptr = CMCondition_get_client_data(cm, response->condition_var);
    if (NULL != response_ptr) {
        memcpy(response_ptr, data, sizeof(EV_int_response));
    }
    CMCondition_signal(cm, response->condition_var);
}

static void
REV_string_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs)
{
    EV_string_response *response = (EV_string_response*) data;
    EV_string_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var);
    if (NULL != stub_ptr) {
        memcpy(stub_ptr, data, sizeof(EV_string_response));
        stub_ptr->ret = strdup(response->ret);
    }
    CMCondition_signal(cm, response->condition_var);
}

static void
REV_EVevent_list_response_handler(CManager cm, CMConnection conn, void *data,void *client_data,attr_list attrs)
{
    EV_EVevent_list_response *response = (EV_EVevent_list_response*) data;
    EV_EVevent_list_response *stub_ptr = CMCondition_get_client_data(cm, response->condition_var);
    if (NULL != stub_ptr) {
        memcpy(stub_ptr, data, sizeof(EV_EVevent_list_response));
        stub_ptr->ret = copy_EVevent_list(response->ret);
    }
    CMCondition_signal(cm, response->condition_var);
}

extern void
REVPinit(CManager cm)
{
    CMFormat tmp_format;

    tmp_format = INT_CMregister_format(cm, EVaction_add_split_target_req_formats);
    INT_CMregister_handler(tmp_format, REVaction_add_split_target_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVaction_remove_split_target_req_formats);
    INT_CMregister_handler(tmp_format, REVaction_remove_split_target_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVaction_set_output_req_formats);
    INT_CMregister_handler(tmp_format, REVaction_set_output_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EValloc_stone_req_formats);
    INT_CMregister_handler(tmp_format, REValloc_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_bridge_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_bridge_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_filter_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_filter_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_immediate_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_immediate_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_multi_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_multi_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_split_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_split_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_store_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_store_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVassoc_terminal_action_req_formats);
    INT_CMregister_handler(tmp_format, REVassoc_terminal_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVclear_stored_req_formats);
    INT_CMregister_handler(tmp_format, REVclear_stored_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_auto_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_auto_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_bridge_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_bridge_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_immediate_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_immediate_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_split_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_split_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_stone_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_stone_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_store_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_store_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVcreate_terminal_action_req_formats);
    INT_CMregister_handler(tmp_format, REVcreate_terminal_action_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVdestroy_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVdestroy_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVdrain_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVdrain_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVenable_auto_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVenable_auto_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVextract_attr_list_req_formats);
    INT_CMregister_handler(tmp_format, REVextract_attr_list_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVfree_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVfree_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVfreeze_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVfreeze_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVset_attr_list_req_formats);
    INT_CMregister_handler(tmp_format, REVset_attr_list_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVstall_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVstall_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVstone_add_split_target_req_formats);
    INT_CMregister_handler(tmp_format, REVstone_add_split_target_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVstone_remove_split_target_req_formats);
    INT_CMregister_handler(tmp_format, REVstone_remove_split_target_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVstone_set_output_req_formats);
    INT_CMregister_handler(tmp_format, REVstone_set_output_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVtransfer_events_req_formats);
    INT_CMregister_handler(tmp_format, REVtransfer_events_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVunfreeze_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVunfreeze_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EVunstall_stone_req_formats);
    INT_CMregister_handler(tmp_format, REVunstall_stone_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EV_int_response_formats);
    INT_CMregister_handler(tmp_format, REV_int_response_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EV_void_response_formats);
    INT_CMregister_handler(tmp_format, REV_response_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EV_string_response_formats);
    INT_CMregister_handler(tmp_format, REV_string_response_handler, cm->evp);

    tmp_format = INT_CMregister_format(cm, EV_EVevent_list_response_formats);
    INT_CMregister_handler(tmp_format, REV_EVevent_list_response_handler, cm->evp);
}
