X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/206f5fd3ccc5de9c9e90ec5d8933cab8fd3bf070..b01b2a3a3042334245c03df9ec70b62e197fecf0:/src/gras/DataDesc/datadesc_private.h diff --git a/src/gras/DataDesc/datadesc_private.h b/src/gras/DataDesc/datadesc_private.h index f21bcc238c..6206440054 100644 --- a/src/gras/DataDesc/datadesc_private.h +++ b/src/gras/DataDesc/datadesc_private.h @@ -13,8 +13,21 @@ #ifndef GRAS_DATADESC_PRIVATE_H #define GRAS_DATADESC_PRIVATE_H -#include "gras_private.h" -#include "gras/DataDesc/datadesc_interface.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "xbt/dynar.h" +#include "xbt/dict.h" +#include "xbt/set.h" + +#include "gras_config.h" /* GRAS_THISARCH */ + +#include "gras/transport.h" /* socket handling */ + +#include "gras_modinter.h" /* module init/exit */ +#include "gras/datadesc.h" /* rest of module public interface */ + +#include "gras/DataDesc/datadesc_interface.h" /* semi-public API */ /** * aligned: @@ -23,13 +36,13 @@ */ #define aligned(v, a) (((v) + (a - 1)) & ~(a - 1)) -extern gras_set_t *gras_datadesc_set_local; +extern xbt_set_t gras_datadesc_set_local; void gras_ddt_freev(void *ddt); /******************************************* * Descriptions of all known architectures * *******************************************/ -#define gras_arch_count 4 +#define gras_arch_count 6 typedef enum { gras_ddt_scalar_char = 0, gras_ddt_scalar_short = 1, @@ -49,11 +62,10 @@ typedef struct { int endian; - int sizeof_scalars[9]; /* char,short,int,long,long_long, - pdata,pfunc, - float,double */ - - int struct_boundary; + int sizeofs[9]; /* char,short,int,long,long_long, + pdata,pfunc, + float,double */ + int boundaries[9]; /* idem */ } gras_arch_desc_t; extern const gras_arch_desc_t gras_arches[gras_arch_count]; @@ -96,12 +108,12 @@ typedef struct s_gras_dd_cat_field { char *name; long int offset[gras_arch_count]; - gras_datadesc_type_t *type; + gras_datadesc_type_t type; gras_datadesc_type_cb_void_t pre; gras_datadesc_type_cb_void_t post; -} gras_dd_cat_field_t; +} s_gras_dd_cat_field_t,*gras_dd_cat_field_t; void gras_dd_cat_field_free(void *f); @@ -130,7 +142,7 @@ typedef struct s_gras_dd_cat_scalar { * Specific fields of a struct */ typedef struct s_gras_dd_cat_struct { - gras_dynar_t *fields; /* elm type = gras_dd_cat_field_t */ + xbt_dynar_t fields; /* elm type = gras_dd_cat_field_t */ int closed; /* gras_datadesc_declare_struct_close() was called */ } gras_dd_cat_struct_t; @@ -141,7 +153,7 @@ typedef struct s_gras_dd_cat_struct { */ typedef struct s_gras_dd_cat_union { gras_datadesc_type_cb_int_t selector; - gras_dynar_t *fields; /* elm type = gras_dd_cat_field_t */ + xbt_dynar_t fields; /* elm type = gras_dd_cat_field_t */ int closed; /* gras_datadesc_declare_union_close() was called */ } gras_dd_cat_union_t; @@ -151,7 +163,7 @@ typedef struct s_gras_dd_cat_union { * Specific fields of a reference */ typedef struct s_gras_dd_cat_ref { - gras_datadesc_type_t *type; + gras_datadesc_type_t type; /* callback used to return the referenced type number */ gras_datadesc_selector_t selector; @@ -164,10 +176,10 @@ typedef struct s_gras_dd_cat_ref { * Specific fields of an array */ typedef struct s_gras_dd_cat_array { - gras_datadesc_type_t *type; + gras_datadesc_type_t type; - /* element_count < 0 means dynamically defined */ - long int fixed_size; + /* element_count == 0 means dynamically defined */ + unsigned long int fixed_size; /* callback used to return the dynamic length */ gras_datadesc_type_cb_int_t dynamic_size; @@ -209,49 +221,48 @@ union u_gras_datadesc_category { * * Type descriptor. */ -struct s_gras_datadesc_type { +typedef struct s_gras_datadesc_type { /* headers for the data set */ unsigned int code; char *name; unsigned int name_len; /* payload */ - long int size[gras_arch_count]; + unsigned long int size[gras_arch_count]; - long int alignment[gras_arch_count]; - long int aligned_size[gras_arch_count]; + unsigned long int alignment[gras_arch_count]; + unsigned long int aligned_size[gras_arch_count]; enum e_gras_datadesc_type_category category_code; union u_gras_datadesc_category category; gras_datadesc_type_cb_void_t send; gras_datadesc_type_cb_void_t recv; -}; + + int cycle; /* true if the datatype may contain cycle */ +} s_gras_datadesc_type_t; /*************************** * constructor/desctructor * ***************************/ void gras_datadesc_free(gras_datadesc_type_t *type); -gras_error_t -gras_datadesc_scalar(const char *name, - gras_ddt_scalar_type_t type, - enum e_gras_dd_scalar_encoding encoding, - gras_datadesc_type_t **dst); +gras_datadesc_type_t + gras_datadesc_scalar(const char *name, + gras_ddt_scalar_type_t type, + enum e_gras_dd_scalar_encoding encoding); /**************************************************** * Callback persistant state constructor/destructor * ****************************************************/ -gras_error_t -gras_cbps_new(gras_cbps_t **dst); -void -gras_cbps_free(gras_cbps_t **state); +gras_cbps_t gras_cbps_new(void); +void gras_cbps_free(gras_cbps_t *state); /*************** * Convertions * ***************/ -gras_error_t -gras_dd_convert_elm(gras_datadesc_type_t *type, int count, +xbt_error_t +gras_dd_convert_elm(gras_datadesc_type_t type, int count, int r_arch, void *src, void *dst);