"scalar", "struct", "union", "ref", "array", "ignored",
"invalid"};
-static gras_datadesc_type_t int_type = NULL;
+static gras_datadesc_type_t uint_type = NULL;
static gras_datadesc_type_t pointer_type = NULL;
static XBT_INLINE void
-gras_dd_send_int(gras_socket_t sock,int *i, int stable) {
+gras_dd_send_uint(gras_socket_t sock,unsigned int *i, int stable) {
- if (!int_type) {
- int_type = gras_datadesc_by_name("int");
- xbt_assert(int_type);
+ if (!uint_type) {
+ uint_type = gras_datadesc_by_name("unsigned int");
+ xbt_assert(uint_type);
}
- DEBUG1("send_int(%d)",*i);
- gras_trp_send(sock, (char*)i, int_type->size[GRAS_THISARCH], stable);
+ DEBUG1("send_uint(%u)",*i);
+ gras_trp_send(sock, (char*)i, uint_type->size[GRAS_THISARCH], stable);
}
static XBT_INLINE void
-gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
+gras_dd_recv_uint(gras_socket_t sock, int r_arch, unsigned int *i) {
- if (!int_type) {
- int_type = gras_datadesc_by_name("int");
- xbt_assert(int_type);
+ if (!uint_type) {
+ uint_type = gras_datadesc_by_name("unsigned int");
+ xbt_assert(uint_type);
}
- if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
- gras_trp_recv(sock, (char*)i, int_type->size[r_arch]);
+ if (uint_type->size[GRAS_THISARCH] >= uint_type->size[r_arch]) {
+ gras_trp_recv(sock, (char*)i, uint_type->size[r_arch]);
if (r_arch != GRAS_THISARCH)
- gras_dd_convert_elm(int_type,1,r_arch, i,i);
+ gras_dd_convert_elm(uint_type,1,r_arch, i,i);
} else {
- void *ptr = xbt_malloc(int_type->size[r_arch]);
+ void *ptr = xbt_malloc(uint_type->size[r_arch]);
- gras_trp_recv(sock, (char*)ptr, int_type->size[r_arch]);
+ gras_trp_recv(sock, (char*)ptr, uint_type->size[r_arch]);
if (r_arch != GRAS_THISARCH)
- gras_dd_convert_elm(int_type,1,r_arch, ptr,i);
+ gras_dd_convert_elm(uint_type,1,r_arch, ptr,i);
free(ptr);
}
- DEBUG1("recv_int(%d)",*i);
+ DEBUG1("recv_uint(%u)",*i);
}
/*
}
static int
-gras_datadesc_copy_rec(gras_cbps_t state,
+gras_datadesc_memcpy_rec(gras_cbps_t state,
xbt_dict_t refs,
gras_datadesc_type_t type,
char *src,
xbt_ex_t e;
- int cpt;
+ unsigned int cpt;
gras_datadesc_type_t sub_type; /* type on which we recurse */
int count = 0;
field->send(type,state,field_src);
DEBUG1("Copy field %s",field->name);
- count += gras_datadesc_copy_rec(state,refs,sub_type, field_src, field_dst, 0,
+ count += gras_datadesc_memcpy_rec(state,refs,sub_type, field_src, field_dst, 0,
detect_cycle || sub_type->cycle);
if (XBT_LOG_ISENABLED(gras_ddt_exchange,xbt_log_priority_verbose)) {
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
- int field_num;
+ unsigned int field_num;
union_data = type->category.union_data;
if (field->send)
field->send(type,state,src);
- count += gras_datadesc_copy_rec(state,refs, sub_type, src, dst,0,
+ count += gras_datadesc_memcpy_rec(state,refs, sub_type, src, dst,0,
detect_cycle || sub_type->cycle);
break;
detect_cycle);
}
- count += gras_datadesc_copy_rec(state,refs, sub_type,
+ count += gras_datadesc_memcpy_rec(state,refs, sub_type,
*o_ref,(char*)l_referenced, subsubcount,
detect_cycle || sub_type->cycle);
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
- long int array_count;
+ unsigned long int array_count;
char *src_ptr=src;
char *dst_ptr=dst;
long int elm_size;
VERB1("Array of %ld stuff, copy it in one after the other",array_count);
for (cpt=0; cpt<array_count; cpt++) {
VERB2("Copy the %dth stuff out of %ld",cpt,array_count);
- count += gras_datadesc_copy_rec(state,refs, sub_type, src_ptr, dst_ptr, 0,
+ count += gras_datadesc_memcpy_rec(state,refs, sub_type, src_ptr, dst_ptr, 0,
detect_cycle || sub_type->cycle);
src_ptr += elm_size;
dst_ptr += elm_size;
return count;
}
/**
- * gras_datadesc_copy:
+ * gras_datadesc_memcpy:
*
* Copy the data pointed by src and described by type
* to a new location, and store a pointer to it in dst.
*
*/
-int gras_datadesc_copy(gras_datadesc_type_t type,
+int gras_datadesc_memcpy(gras_datadesc_type_t type,
void *src, void *dst) {
xbt_ex_t e;
static gras_cbps_t state=NULL;
}
TRY {
- size = gras_datadesc_copy_rec(state,refs,type,(char*)src,(char*)dst,0,
- type->cycle);
+ size = gras_datadesc_memcpy_rec(state,refs,type,(char*)src,(char*)dst,0,
+ type->cycle);
} CLEANUP {
xbt_dict_reset(refs);
gras_cbps_reset(state);
int detect_cycle) {
xbt_ex_t e;
- int cpt;
+ unsigned int cpt;
gras_datadesc_type_t sub_type; /* type on which we recurse */
VERB2("Send a %s (%s)",
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
- int field_num;
+ unsigned int field_num;
union_data = type->category.union_data;
type->name, field_num, xbt_dynar_length(union_data.fields));
/* Send the field number */
- gras_dd_send_int(sock, &field_num, 0 /* not stable */);
+ gras_dd_send_uint(sock, &field_num, 0 /* not stable */);
/* Send the content */
field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
sub_type = ref_data.type;
if (sub_type == NULL) {
sub_type = (*ref_data.selector)(type,state,data);
- gras_dd_send_int(sock, (int*) &(sub_type->code),1 /*stable*/);
+ gras_dd_send_uint(sock, &(sub_type->code),1 /*stable*/);
}
/* Send the actual value of the pointer for cycle handling */
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
- int count;
+ unsigned int count;
char *ptr=data;
long int elm_size;
count = array_data.dynamic_size(type,state,data);
xbt_assert1(count >=0,
"Invalid (negative) array size for type %s",type->name);
- gras_dd_send_int(sock, &count, 0/*non-stable*/);
+ gras_dd_send_uint(sock, &count, 0/*non-stable*/);
}
/* send the content */
int subsize,
int detect_cycle) {
- int cpt;
+ unsigned int cpt;
gras_datadesc_type_t sub_type;
xbt_ex_t e;
case e_gras_datadesc_type_cat_union: {
gras_dd_cat_union_t union_data;
gras_dd_cat_field_t field=NULL;
- int field_num;
+ unsigned int field_num;
union_data = type->category.union_data;
"Please call gras_datadesc_declare_union_close on %s before receiving it",
type->name);
/* retrieve the field number */
- gras_dd_recv_int(sock, r_arch, &field_num);
+ gras_dd_recv_uint(sock, r_arch, &field_num);
if (field_num < 0)
THROW1(mismatch_error,0,
"Received union field for %s is negative", type->name);
/* Get the referenced type locally or from peer */
sub_type = ref_data.type;
if (sub_type == NULL) {
- int ref_code;
- gras_dd_recv_int(sock, r_arch, &ref_code);
+ unsigned int ref_code;
+ gras_dd_recv_uint(sock, r_arch, &ref_code);
sub_type = gras_datadesc_by_id(ref_code);
}
}
if (reference_is_to_recv) {
- int subsubcount = 0;
+ unsigned int subsubcount = 0;
void *l_referenced=NULL;
VERB2("Receiving a ref to '%s', remotely @%p",
subsubcount = array_data.fixed_size;
if (subsubcount == 0)
- gras_dd_recv_int(sock, r_arch, &subsubcount);
+ gras_dd_recv_uint(sock, r_arch, &subsubcount);
subsub_type = array_data.type;
case e_gras_datadesc_type_cat_array: {
gras_dd_cat_array_t array_data;
- int count;
+ unsigned int count;
char *ptr;
long int elm_size;
if (count == 0)
count = subsize;
if (count == 0)
- gras_dd_recv_int(sock, r_arch, &count);
+ gras_dd_recv_uint(sock, r_arch, &count);
if (count == 0)
THROW1(mismatch_error,0,
"Invalid (=0) array size for type %s",type->name);