#include <sys/types.h> /* size_t */
#include <stdarg.h>
-
-/*! C++ users need love */
-#ifndef BEGIN_DECL
-# ifdef __cplusplus
-# define BEGIN_DECL extern "C" {
-# else
-# define BEGIN_DECL
-# endif
-#endif
-
-/*! C++ users need love */
-#ifndef END_DECL
-# ifdef __cplusplus
-# define END_DECL }
-# else
-# define END_DECL
-# endif
-#endif
-/* End of cruft for C++ */
+#include "xbt/misc.h" /* BEGIN_DECL */
BEGIN_DECL
-
/**
* gras_datadesc_type_t:
*
/* callbacks prototypes */
typedef void (*gras_datadesc_type_cb_void_t)(gras_cbps_t *vars, void *data);
typedef int (*gras_datadesc_type_cb_int_t)(gras_cbps_t *vars, void *data);
+typedef gras_datadesc_type_t *(*gras_datadesc_selector_t)(gras_cbps_t *vars, void *data);
/***********************************************
**** Search and retrieve declared datatype ****
**** Declare datadescription yourself ****
******************************************/
-gras_error_t
-gras_datadesc_struct(const char *name,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_struct_append(gras_datadesc_type_t *struct_type,
- const char *name,
- gras_datadesc_type_t *field_type);
+gras_datadesc_type_t *
+ gras_datadesc_struct(const char *name);
+
void
-gras_datadesc_struct_close(gras_datadesc_type_t *struct_type);
-gras_error_t
-gras_datadesc_union(const char *name,
- gras_datadesc_type_cb_int_t selector,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_union_append(gras_datadesc_type_t *union_type,
- const char *name,
- gras_datadesc_type_t *field_type);
+ gras_datadesc_struct_append(gras_datadesc_type_t *struct_type,
+ const char *name,
+ gras_datadesc_type_t *field_type);
void
-gras_datadesc_union_close(gras_datadesc_type_t *union_type);
-gras_error_t
-gras_datadesc_ref(const char *name,
- gras_datadesc_type_t *referenced_type,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_ref_generic(const char *name,
- gras_datadesc_type_cb_int_t discriminant,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_array_fixed(const char *name,
- gras_datadesc_type_t *element_type,
- long int fixed_size,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_array_dyn(const char *name,
- gras_datadesc_type_t *element_type,
- gras_datadesc_type_cb_int_t dynamic_size,
- gras_datadesc_type_t **dst);
-gras_error_t
-gras_datadesc_ref_pop_arr(gras_datadesc_type_t *element_type,
- gras_datadesc_type_t **dst);
+ gras_datadesc_struct_close(gras_datadesc_type_t *struct_type);
+
+gras_datadesc_type_t *
+ gras_datadesc_union(const char *name,
+ gras_datadesc_type_cb_int_t selector);
+void
+ gras_datadesc_union_append(gras_datadesc_type_t *union_type,
+ const char *name,
+ gras_datadesc_type_t *field_type);
+void
+ gras_datadesc_union_close(gras_datadesc_type_t *union_type);
+
+gras_datadesc_type_t *
+ gras_datadesc_ref(const char *name,
+ gras_datadesc_type_t *referenced_type);
+gras_datadesc_type_t *
+ gras_datadesc_ref_generic(const char *name,
+ gras_datadesc_selector_t selector);
+
+gras_datadesc_type_t *
+ gras_datadesc_array_fixed(const char *name,
+ gras_datadesc_type_t *element_type,
+ long int fixed_size);
+gras_datadesc_type_t *
+ gras_datadesc_array_dyn(const char *name,
+ gras_datadesc_type_t *element_type,
+ gras_datadesc_type_cb_int_t dynamic_size);
+
+gras_datadesc_type_t *
+ gras_datadesc_ref_pop_arr(gras_datadesc_type_t *element_type);
/*********************************
* Change stuff within datadescs *
*********************************/
+void gras_datadesc_cycle_set(gras_datadesc_type_t *type);
+void gras_datadesc_cycle_unset(gras_datadesc_type_t *type);
+
void gras_datadesc_cb_send (gras_datadesc_type_t *type,
gras_datadesc_type_cb_void_t pre);
void gras_datadesc_cb_recv(gras_datadesc_type_t *type,
gras_datadesc_type_cb_void_t post);
+void gras_datadesc_cb_field_send (gras_datadesc_type_t *type,
+ const char *field_name,
+ gras_datadesc_type_cb_void_t pre);
+void gras_datadesc_cb_field_recv(gras_datadesc_type_t *type,
+ const char *field_name,
+ gras_datadesc_type_cb_void_t post);
+void gras_datadesc_cb_field_push (gras_datadesc_type_t *type,
+ const char *field_name);
/******************************
* Get stuff within datadescs *
gras_cbps_i_push(gras_cbps_t *ps, int val);
int
gras_cbps_i_pop(gras_cbps_t *ps);
+
int gras_datadesc_cb_pop(gras_cbps_t *vars, void *data);
+void gras_datadesc_cb_push_int(gras_cbps_t *vars, void *data);
+void gras_datadesc_cb_push_uint(gras_cbps_t *vars, void *data);
+void gras_datadesc_cb_push_lint(gras_cbps_t *vars, void *data);
+void gras_datadesc_cb_push_ulint(gras_cbps_t *vars, void *data);
+
+
/* complex one: complete variable environment support */
gras_error_t
const char *Cdefinition);
#define GRAS_DEFINE_TYPE(name,def) \
static const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
+#define GRAS_ANNOTE(key,val)
#define gras_datadesc_by_symbol(name) \
(gras_datadesc_by_name(#name) ? \