Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Current state. See changelog, sorry, I'm out of time
[simgrid.git] / include / gras / datadesc.h
index e2827df..d3e5796 100644 (file)
 #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:
  * 
@@ -50,6 +31,7 @@ typedef struct s_gras_cbps gras_cbps_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 ****
@@ -60,55 +42,64 @@ gras_datadesc_type_t *gras_datadesc_by_name(const char *name);
  **** 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 *
@@ -124,7 +115,14 @@ void
 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
@@ -169,6 +167,7 @@ gras_datadesc_parse(const char *name,
                    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) ?      \