/* datadesc - data description in order to send/recv it in GRAS */
-/* Authors: Olivier Aumage, Martin Quinson */
-/* Copyright (C) 2003, 2004 the GRAS posse. */
+/* Copyright (c) 2003 Olivier Aumage. */
+/* Copyright (c) 2003, 2004 Martin Quinson. */
+/* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
- under the terms of the license (GNU LGPL) which comes with this package. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
#include "gras/DataDesc/datadesc_private.h"
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(datadesc,gras,"Data description");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(datadesc,gras,"Data description");
/* FIXME: make this host-dependent using a trick such as UserData*/
-gras_set_t *gras_datadesc_set_local=NULL;
+/*@null@*/xbt_set_t gras_datadesc_set_local=NULL;
/* callback for array size when sending strings */
static int
-_strlen_cb(gras_cbps_t *vars, void *data) {
+_strlen_cb(/*@unused@*/gras_datadesc_type_t type,/*@unused@*/gras_cbps_t vars, void *data) {
- return 1+(long int)strlen(data);
+ return 1+(int)strlen(data);
}
**/
void
gras_datadesc_init(void) {
- gras_error_t errcode;
- gras_datadesc_type_t *ddt; /* What to add */
+ gras_datadesc_type_t ddt; /* What to add */
/* only initialize once */
if (gras_datadesc_set_local != NULL)
VERB0("Initializing DataDesc");
- gras_set_new(&gras_datadesc_set_local);
+ gras_datadesc_set_local = xbt_set_new();
ddt = gras_datadesc_scalar("signed char",
gras_ddt_scalar_char,
void
gras_datadesc_exit(void) {
VERB0("Exiting DataDesc");
- gras_set_free(&gras_datadesc_set_local);
- gras_datadesc_set_local = NULL;
+ xbt_set_free(&gras_datadesc_set_local);
DEBUG0("Exited DataDesc");
}
-/**
- * gras_datadesc_get_name:
- *
- * Returns the name of a datadescription (to ease the debug)
- */
+/** This is mainly to debug */
char *
-gras_datadesc_get_name(gras_datadesc_type_t *ddt) {
+gras_datadesc_get_name(gras_datadesc_type_t ddt) {
return ddt->name;
}
-/**
- * gras_datadesc_get_id:
- *
- * Returns the name of a datadescription (to ease the debug)
- */
+/** This is mainly to debug */
int
-gras_datadesc_get_id(gras_datadesc_type_t *ddt) {
+gras_datadesc_get_id(gras_datadesc_type_t ddt) {
return ddt->code;
}
* Returns the size occuped by data of this type (on the current arch).
*
*/
-int gras_datadesc_size(gras_datadesc_type_t *type) {
+int gras_datadesc_size(gras_datadesc_type_t type) {
return type->size[GRAS_THISARCH];
}
*
* For debugging purpose
*/
-void gras_datadesc_type_dump(const gras_datadesc_type_t *ddt){
+void gras_datadesc_type_dump(const gras_datadesc_type_t ddt){
int cpt;
printf("DataDesc dump:");
}
printf ("]\n");
if (ddt->category_code == e_gras_datadesc_type_cat_struct) {
- gras_dd_cat_struct_t struct_data;
- gras_dd_cat_field_t *field;
+ gras_dd_cat_struct_t struct_data;
+ gras_dd_cat_field_t field;
struct_data = ddt->category.struct_data;
- gras_dynar_foreach(struct_data.fields, cpt, field) {
+ xbt_dynar_foreach(struct_data.fields, cpt, field) {
printf(">>> Dump field #%d (%s) (offset=%ld)\n",
cpt,field->name,field->offset[GRAS_THISARCH]);
gras_datadesc_type_dump(field->type);