#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
/**
* gras_if_RL:
*/
int gras_if_SG(void);
-END_DECL
+END_DECL()
#endif /* GRAS_COND_H */
#include <stddef.h> /* offsetof() */
#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++ */
-
-BEGIN_DECL
+#include "xbt/misc.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++ *\/ */
+
+BEGIN_DECL()
/* **************************************************************************
* Garbage collection support
void gras_init(int *argc,char **argv, const char *defaultlog);
void gras_exit(void);
-END_DECL
+END_DECL()
#endif /* GRAS_CORE_H */
#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
/**
* gras_datadesc_type_t:
unsigned long howmany,
/* OUT */ gras_datadesc_type_t *dst);
-END_DECL
+END_DECL()
#endif /* GRAS_DATADESC_H */
#include "gras/transport.h"
#include "gras/datadesc.h"
-BEGIN_DECL
+BEGIN_DECL()
/* msgtype declaration and retrival */
typedef struct s_gras_msgtype *gras_msgtype_t;
xbt_error_t gras_msg_handle(double timeOut);
-END_DECL
+END_DECL()
#endif /* GRAS_MSG_H */
#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
/* **************************************************************************
* Initializing the processes
#define gras_userdata_new(type) (gras_userdata_set(xbt_new0(type,1)),gras_userdata_get())
-END_DECL
+END_DECL()
#endif /* GRAS_PROCESS_H */
#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
/**
* gras_os_time:
const char *
gras_get_my_fqdn(void);
-END_DECL
+END_DECL()
#endif /* GRAS_VIRTU_H */
/********************************* Host **************************************/
-typedef struct simdata_host *simdata_host_t;
-typedef struct m_host {
- char *name; /* host name if any */
- simdata_host_t simdata; /* simulator data */
- void *data; /* user data */
-} s_m_host_t;
-/** \brief Host datatype
+/** @name Host datatype
\ingroup m_datatypes_management
A <em>location</em> (or <em>host</em>) is any possible place where
\see m_host_management
*/
-typedef s_m_host_t *m_host_t;
-
+/*@{*/
+typedef struct simdata_host *simdata_host_t;
+typedef struct m_host {
+ char *name; /**< host name if any */
+ simdata_host_t simdata; /**< simulator data */
+ void *data; /**< user data */
+} s_m_host_t, *m_host_t;
+/*@}*/
/********************************* Task **************************************/
-typedef struct simdata_task *simdata_task_t;
-typedef struct m_task {
- char *name; /* host name if any */
- simdata_task_t simdata; /* simulator data */
- void *data; /* user data */
-} s_m_task_t;
-
-/** \brief Task datatype
+/** @name Task datatype
\ingroup m_datatypes_management
A <em>task</em> may then be defined by a <em>computing
data</em>.
\see m_task_management
*/
-typedef s_m_task_t *m_task_t;
+/*@{*/
+typedef struct simdata_task *simdata_task_t;
+typedef struct m_task {
+ char *name; /* host name if any */
+ simdata_task_t simdata; /* simulator data */
+ void *data; /* user data */
+} s_m_task_t, *m_task_t;
/** \brief Default value for an uninitialized #m_task_t.
\ingroup m_datatypes_management
*/
#define MSG_TASK_UNINITIALIZED NULL
+/*@}*/
+
/******************************* Process *************************************/
-typedef struct simdata_process *simdata_process_t;
-typedef struct m_process {
- char *name; /* process name if any */
- simdata_process_t simdata; /* simulator data */
- void *data; /* user data */
-} s_m_process_t;
-/** \brief Agent datatype
+
+/** @name Agent datatype
\ingroup m_datatypes_management
+
An agent may be defined as a <em>code</em>, with some <em>private
data</em>, executing in a <em>location</em>.
\see m_process_management
*/
-typedef s_m_process_t *m_process_t;
-/** \brief Agent code datatype
- \ingroup m_datatypes_management
+/*@{*/
+typedef struct simdata_process *simdata_process_t;
+typedef struct m_process {
+ /** A name */
+ /** process name if any */
+ char *name;
+ simdata_process_t simdata; /* simulator data */
+ void *data; /* user data */
+} s_m_process_t, *m_process_t;
+
+/**
The code of an agent is a m_process_code_t, i.e. a function with no arguments
returning no value.
\see m_process_management
*/
typedef int(*m_process_code_t)(int argc,char *argv[]) ;
+/*@}*/
/********************************** Channel **********************************/
-/** \brief Channel datatype
+/** @name Channel datatype
\ingroup m_datatypes_management
+
A <em>channel</em> is a number and identifies a mailbox type (just as a
port number does).
\see m_channel_management
*/
+/*@{*/
typedef int m_channel_t;
+/*@}*/
/****************************** Error handling *******************************/
/** \brief Error handling
MSG_VERBOSE
} MSG_outputmode_t;
+/** \deprecated Network sharing mechanism
+ \ingroup m_datatypes_management*/
typedef enum {
MSG_STORE_AND_FORWARD = 1, /* 0 means uninitialized value */
MSG_TCP
} MSG_sharing_t;
-/************************ deprecated *****************************************/
-/* /\********************************* Link **************************************\/ */
-/* struct s_m_link { */
-/* char *name; /\* link name if any *\/ */
-/* void *simdata; /\* simulator data *\/ */
-/* void *data; /\* user data *\/ */
-/* }; */
-
-/* /\** \brief Link datatype */
-/* \ingroup m_datatypes_management */
-
-/* A <em>link</em> is an agglomeration of communicating resources */
-/* representing a set of physical network links. */
-
-/* \see m_link_management */
-/* *\/ */
-/* typedef struct s_m_link *m_link_t; */
-
+/** \deprecated Link datatype
+ * \ingroup m_datatypes_management
+ * The notion of <em>link</em> was present in the earliest versions of MSG.
+ * It was an agglomeration of communicating resources representing a set of
+ * physical network links. This abstraction a disappeared because in real-life,
+ * it is generally not possible to interact directly with a link...
+ */
+typedef struct m_link *m_link_t;
#endif
m_process_t MSG_process_create_with_arguments(const char *name,
m_process_code_t code, void *data,
m_host_t host, int argc, char **argv);
-void MSG_process_free(m_process_t process);
+void MSG_process_kill(m_process_t process);
MSG_error_t MSG_get_arguments(int *argc, char ***argv);
MSG_error_t MSG_set_arguments(m_process_t process,int argc, char *argv[]);
#include "xbt/dynar.h"
-BEGIN_DECL
+BEGIN_DECL()
/* For now, a config is only a special dynar. But don't rely on it, */
/* it may change in the future. */
const char *name,
/* OUT */ xbt_dynar_t *dynar);
-END_DECL
+END_DECL()
#endif /* _XBT_CONFIG_H_ */
#include "xbt/misc.h"
+/** \name Context types
+ * \ingroup XBT_context
+*/
+/*@{*/
typedef struct s_xbt_context *xbt_context_t;
+/**< A context */
typedef int(*xbt_context_function_t)(int argc, char *argv[]);
+/**< A context function */
+/*@}*/
void xbt_context_init(void);
void xbt_context_exit(void);
#include "xbt/misc.h" /* BEGIN_DECL */
#include "xbt/error.h"
-BEGIN_DECL
+BEGIN_DECL()
/*####[ Type definition ]####################################################*/
+/** \brief Dictionnary data type
+ \ingroup XBT_dict
+*/
typedef struct xbt_dict_ *xbt_dict_t;
/*####[ Simple dict functions ]#############################################*/
xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));\
xbt_dict_cursor_step(cursor) )
-END_DECL
+END_DECL()
#endif /* _XBT_DICT_H */
#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
+/** \brief Dictionnary data type
+ \ingroup XBT_dynar
+*/
typedef struct xbt_dynar_s *xbt_dynar_t;
xbt_dynar_t xbt_dynar_new(unsigned long elm_size,
void xbt_dynar_cursor_step (const xbt_dynar_t dynar, int *cursor);
int xbt_dynar_cursor_get (const xbt_dynar_t dynar, int *cursor, void *whereto);
+
/**
+ \brief Dynar iterator
+ \ingroup XBT_dynar
* xbt_dynar_foreach:
- * @_dynar: what to iterate over
- * @_cursor: an integer used as cursor
- * @_data:
- *
- * Iterates over the whole dynar. Example:
+ * \param _dynar what to iterate over
+ * \param _cursor an integer used as cursor
+ * \param _data
*
- * <programlisting>
- * xbt_dynar_t dyn;
- * int cpt;
- * string *str;
- * xbt_dynar_foreach (dyn,cpt,str) {
- * printf("Seen %s\n",str);
- * }</programlisting>
+ * Iterates over the whole dynar.
+ * \note An example of usage:
+ * \code
+xbt_dynar_t dyn;
+int cpt;
+string *str;
+xbt_dynar_foreach (dyn,cpt,str) {
+ printf("Seen %s\n",str);
+}
+\endcode
*/
#define xbt_dynar_foreach(_dynar,_cursor,_data) \
for (xbt_dynar_cursor_first(_dynar,&(_cursor)) ; \
void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
int *const cursor);
-END_DECL
+END_DECL()
#endif /* _XBT_DYNAR_H */
#include <execinfo.h> /* to print the backtrace */
#endif
-BEGIN_DECL
+BEGIN_DECL()
void xbt_abort(void) _XBT_GNUC_NORETURN;
+/**\brief Error types
+ \ingroup XBT_error
+*/
typedef enum {
- no_error=0, /* succes */
- mismatch_error=1, /* The provided ID does not match */
- system_error=2, /* a syscall did fail */
- network_error=3, /* error while sending/receiving data */
- timeout_error=4, /* not quick enough, dude */
- thread_error=5, /* error while [un]locking */
- unknown_error=6,
+ no_error=0, /**< succes */
+ mismatch_error=1, /**< The provided ID does not match */
+ system_error=2, /**< a syscall did fail */
+ network_error=3, /**< error while sending/receiving data */
+ timeout_error=4, /**< not quick enough, dude */
+ thread_error=5, /**< error while [un]locking */
+ unknown_error=6, /**< unknown error */
/* remote errors: result of a RMI/RPC.
no_error(=0) is the same for both */
remote_unknown_error
} xbt_error_t;
-/*@observer@*/ const char *xbt_error_name(xbt_error_t errcode);
+const char *xbt_error_name(xbt_error_t errcode);
#define TRY(a) do { \
if ((errcode=a) != no_error) { \
#define RAISE_IMPOSSIBLE RAISE0(unknown_error,"The Impossible did happen")
#define RAISE_UNIMPLEMENTED RAISE1(unknown_error,"Function %s unimplemented",__FUNCTION__)
+/**
+ * \name Asserts
+ * \ingroup XBT_error
+ * asserts and stuff
+ */
+/*@{*/
#ifdef NDEBUG
#define xbt_assert(cond)
#define xbt_assert0(cond,msg)
#define xbt_assert5(cond,msg,a,b,c,d,e) if (!(cond)) { CRITICAL5(msg,a,b,c,d,e); xbt_abort(); }
#define xbt_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) { CRITICAL6(msg,a,b,c,d,e,f); xbt_abort(); }
#endif
+/*@}*/
+/**
+ * \brief How to abort with an error message
+ * \ingroup XBT_error
+ */
void xbt_die(const char *msg) _XBT_GNUC_NORETURN;
#define DIE_IMPOSSIBLE xbt_assert0(0,"The Impossible did happen (yet again)")
#define xbt_assert_error(a) xbt_assert1(errcode == (a), "Error %s unexpected",xbt_error_name(errcode))
-END_DECL
+END_DECL()
#endif /* XBT_ERROR_H */
-
#ifndef _XBT_FIFO_H
#define _XBT_FIFO_H
-/* Bucket structure */
+/** \brief Bucket structure
+ * \ingroup XBT_fifo
+*/
typedef struct xbt_fifo_item *xbt_fifo_item_t;
-/* FIFO structure */
+/** \brief FIFO structure
+ * \ingroup XBT_fifo
+*/
typedef struct xbt_fifo *xbt_fifo_t;
/* API */
xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i);
xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i);
-
+/**
+ * \brief List iterator
+ * \ingroup XBT_fifo
+ * asserts and stuff
+ * \param f a list (#xbt_fifo_t)
+ * \param i a bucket (#xbt_fifo_item_t)
+ * \param type a type
+ * \param n an object of type \a type.
+ *
+ * Iterates over the whole list.
+ */
#define xbt_fifo_foreach(f,i,n,type) \
for(i=xbt_fifo_getFirstItem(f); \
((i)?(n=(type)(xbt_fifo_get_item_content(i))):(NULL)); \
#include "xbt/misc.h"
+/** \brief Heap data type
+ \ingroup XBT_heap
+*/
typedef struct xbt_heap *xbt_heap_t;
xbt_heap_t xbt_heap_new(int num, void_f_pvoid_t free_func);
#include "xbt/sysdep.h"
-/**
- * e_xbt_log_priority_t:
- * @xbt_log_priority_none: used internally (don't poke with)
- * @xbt_log_priority_debug: crufty output
- * @xbt_log_priority_verbose: verbose output for the user wanting more
- * @xbt_log_priority_info: output about the regular functionning
- * @xbt_log_priority_warning: minor issue encountered
- * @xbt_log_priority_error: issue encountered
- * @xbt_log_priority_critical: major issue encountered
- * @xbt_log_priority_infinite: value for XBT_LOG_STATIC_THRESHOLD to not log
- * @xbt_log_priority_uninitialized: used internally (don't poke with)
+/**\brief Log priorities
+ * \ingroup XBT_log
*
* The different existing priorities.
- */
+*/
typedef enum {
- xbt_log_priority_none = 0,
+ xbt_log_priority_none = 0, /**< used internally (don't poke with) */
xbt_log_priority_trace = 1,
- xbt_log_priority_debug = 2,
- xbt_log_priority_verbose = 3,
- xbt_log_priority_info = 4,
- xbt_log_priority_warning = 5,
- xbt_log_priority_error = 6,
- xbt_log_priority_critical = 7,
+ xbt_log_priority_debug = 2, /**< crufty output */
+ xbt_log_priority_verbose = 3, /**< verbose output for the user wanting more */
+ xbt_log_priority_info = 4, /**< output about the regular functionning */
+ xbt_log_priority_warning = 5, /**< minor issue encountered */
+ xbt_log_priority_error = 6, /**< issue encountered */
+ xbt_log_priority_critical = 7, /**< major issue encountered */
- xbt_log_priority_infinite = 8,
+ xbt_log_priority_infinite = 8, /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
- xbt_log_priority_uninitialized = -1
+ xbt_log_priority_uninitialized = -1 /**< used internally (don't poke with) */
} e_xbt_log_priority_t;
/**
- * NLOG:
+ * \define NLOG
*
- * All logging facilities are disabled at compilation time
+ * \note All logging facilities are disabled at compilation time
*/
#define XBT_LOG_ROOT_CAT root
/**
- * XBT_LOG_NEW_SUBCATEGORY:
- * @catName: name of new category
- * @parent: father of the new category in the tree
- * @desc: string describing the purpose of this category
+ * \ingroup XBT_log
+ * \param catName name of new category
+ * \param parent father of the new category in the tree
+ * \param desc string describing the purpose of this category
*
* Defines a new subcategory of the parent.
*/
}
/**
- * XBT_LOG_NEW_CATEGORY:
- * @catName: name of new category
- * @desc: string describing the purpose of this category
+ * \ingroup XBT_log
+ * \param catName name of new category
+ * \param desc string describing the purpose of this category
*
* Creates a new subcategory of the root category.
*/
#define XBT_LOG_NEW_CATEGORY(catName,desc) XBT_LOG_NEW_SUBCATEGORY(catName, XBT_LOG_ROOT_CAT, desc)
/**
- * XBT_LOG_DEFAULT_CATEGORY:
- * @cname: name of the cat
+ * \ingroup XBT_log
+ * \param cname name of the cat
*
* Indicates which category is the default one.
*/
#endif
/**
- * XBT_LOG_NEW_DEFAULT_CATEGORY:
- * @cname: name of the cat
- * @desc: string describing the purpose of this category
+ * \ingroup XBT_log
+ * \param cname name of the cat
+ * \param desc string describing the purpose of this category
*
* Creates a new subcategory of the root category and makes it the default
* (used by macros that don't explicitly specify a category).
XBT_LOG_DEFAULT_CATEGORY(cname)
/**
- * XBT_LOG_NEW_DEFAULT_SUBCATEGORY:
- * @cname: name of the cat
- * @parent: name of the parent
- * @desc: string describing the purpose of this category
+ * \ingroup XBT_log
+ * \param cname name of the cat
+ * \param parent name of the parent
+ * \param desc string describing the purpose of this category
*
* Creates a new subcategory of the parent category and makes it the default
* (used by macros that don't explicitly specify a category).
XBT_LOG_DEFAULT_CATEGORY(cname)
/**
- * XBT_LOG_EXTERNAL_CATEGORY:
- * @cname: name of the cat
+ * \ingroup XBT_log
+ * \param cname name of the cat
*
* Indicates that a category you'll use in this file (to get subcategories of it,
* for example) really lives in another file.
};
/**
- * xbt_log_threshold_set:
- * @cat: the category (not only its name, but the variable)
- * @thresholdPriority: the priority
+ * \ingroup XBT_log
+ * \param cat the category (not only its name, but the variable)
+ * \param thresholdPriority the priority
*
* Programatically alters a category's threshold priority (don't use).
*/
e_xbt_log_priority_t thresholdPriority);
/**
- * xbt_log_parent_set:
- * @cat: the category (not only its name, but the variable)
- * @parent: the parent cat
+ * \ingroup XBT_log
+ * \param cat the category (not only its name, but the variable)
+ * \param parent the parent cat
*
* Programatically alter a category's parent (don't use).
*/
xbt_log_category_t parent);
/**
- * xbt_log_appender_set:
- * @cat: the category (not only its name, but the variable)
- * @app: the appender
+ * \ingroup XBT_log
+ * \param cat the category (not only its name, but the variable)
+ * \param app the appender
*
* Programatically sets the category's appender (don't use).
*/
extern xbt_log_appender_t xbt_log_default_appender;
/**
- * XBT_LOG_ISENABLED:
- * @catName: name of the category
- * @priority: minimal priority to be enabled to return true
+ * \ingroup XBT_log
+ * \param catName name of the category
+ * \param priority minimal priority to be enabled to return true
*
* Returns true if the given priority is enabled for the category.
* If you have expensive expressions that are computed outside of the log
#define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
#define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
-/**
- * CCRITICAL6:
- * @c: the category to log into
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
- * Log something to the current default category under the warning priority.
- *
- * The macros CCRITICAL0 ... CCRITICAL5 naturally also exist, but are not listed here
- * for sake of clarity. They just differ in the number of arguments passed
- * along with the format string.
- */
-
#define CCRITICAL0(c, f) CLOG0(c, xbt_log_priority_critical, f)
#define CCRITICAL1(c, f,a1) CLOG1(c, xbt_log_priority_critical, f,a1)
#define CCRITICAL2(c, f,a1,a2) CLOG2(c, xbt_log_priority_critical, f,a1,a2)
# define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
#endif
-/**
- * DEBUG6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name DEBUG
+ * \ingroup XBT_log
* Log something to the current default category under the debug priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
-
+/*@{*/
#define DEBUG0(f) LOG0(xbt_log_priority_debug, f)
#define DEBUG1(f,a1) LOG1(xbt_log_priority_debug, f,a1)
#define DEBUG2(f,a1,a2) LOG2(xbt_log_priority_debug, f,a1,a2)
#define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
#define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
#define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
+/*@}*/
-/**
- * VERB6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name VERB
+ * \ingroup XBT_log
* Log something to the current default category under the verbose priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros VERB0 ... VERB5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
-
+/*@{*/
#define VERB0(f) LOG0(xbt_log_priority_verbose, f)
#define VERB1(f,a1) LOG1(xbt_log_priority_verbose, f,a1)
#define VERB2(f,a1,a2) LOG2(xbt_log_priority_verbose, f,a1,a2)
#define VERB4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
#define VERB5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
#define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
+/*@}*/
-/**
- * INFO6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name INFO
+ * \ingroup XBT_log
* Log something to the current default category under the info priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros INFO0 ... INFO5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
-
+/*@{*/
#define INFO0(f) LOG0(xbt_log_priority_info, f)
#define INFO1(f,a1) LOG1(xbt_log_priority_info, f,a1)
#define INFO2(f,a1,a2) LOG2(xbt_log_priority_info, f,a1,a2)
#define INFO4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
#define INFO5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
#define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
+/*@}*/
-/**
- * WARN6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name WARN
+ * \ingroup XBT_log
* Log something to the current default category under the warning priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros WARN0 ... WARN5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
-
+/*@{*/
#define WARN0(f) LOG0(xbt_log_priority_warning, f)
#define WARN1(f,a1) LOG1(xbt_log_priority_warning, f,a1)
#define WARN2(f,a1,a2) LOG2(xbt_log_priority_warning, f,a1,a2)
#define WARN4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
#define WARN5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
#define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
+/*@}*/
-/**
- * ERROR6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name ERROR
+ * \ingroup XBT_log
* Log something to the current default category under the error priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
-
+/*@{*/
#define ERROR0(f) LOG0(xbt_log_priority_error, f)
#define ERROR1(f,a1) LOG1(xbt_log_priority_error, f,a1)
#define ERROR2(f,a1,a2) LOG2(xbt_log_priority_error, f,a1,a2)
#define ERROR4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
#define ERROR5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
#define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
+/*@}*/
-/**
- * CRITICAL6:
- * @f: the format string
- * @a1: first argument of the format
- * @a2: second argument of the format
- * @a3: third argument of the format
- * @a4: fourth argument of the format
- * @a5: fifth argument of the format
- * @a6: sixth argument of the format
- *
+/** \name CRITICAL
+ * \ingroup XBT_log
* Log something to the current default category under the critical priority.
+ * \param f the format string
+ * \param a1 first argument of the format
+ * \param a2 second argument of the format
+ * \param a3 third argument of the format
+ * \param a4 fourth argument of the format
+ * \param a5 fifth argument of the format
+ * \param a6 sixth argument of the format
*
* The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here
* for sake of clarity. They just differ in the number of arguments passed
* along with the format string.
*/
+/*@{*/
#define CRITICAL0(f) LOG0(xbt_log_priority_critical, f)
#define CRITICAL1(f,a1) LOG1(xbt_log_priority_critical, f,a1)
#define CRITICAL2(f,a1,a2) LOG2(xbt_log_priority_critical, f,a1,a2)
#define CRITICAL4(f,a1,a2,a3,a4) LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
#define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
+/*@}*/
#define XBT_IN LOG1(xbt_log_priority_trace, ">> begin of %s", _XBT_GNUC_FUNCTION)
#define XBT_IN1(fmt,a) LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a)
/*! C++ users need love */
#ifndef BEGIN_DECL
# ifdef __cplusplus
-# define BEGIN_DECL extern "C" {
+# define BEGIN_DECL() extern "C" {
# else
-# define BEGIN_DECL
+# define BEGIN_DECL()
# endif
#endif
/*! C++ users need love */
#ifndef END_DECL
# ifdef __cplusplus
-# define END_DECL }
+# define END_DECL() }
# else
-# define END_DECL
+# define END_DECL()
# endif
#endif
/* End of cruft for C++ */
-BEGIN_DECL
+BEGIN_DECL()
/* Dunno where to place this: needed by config and amok */
typedef struct {
char *name;
int port;
} xbt_host_t;
-/* pointer to a function freeing something */
-typedef void (void_f_ppvoid_t)(void**);
-typedef void (void_f_pvoid_t) (void*);
+/** \name Free functions
+ * \ingroup XBT_dynar
+ * Pointer to a function freeing something
+*/
+/*@{*/
+typedef void (void_f_ppvoid_t)(void**); /**< Pointer to a function freeing something */
+typedef void (void_f_pvoid_t) (void*); /**< Pointer to a function freeing something */
+/*@}*/
-END_DECL
+END_DECL()
#endif /* XBT_MISC_H */
#include "xbt/misc.h" /* BEGIN_DECL */
-BEGIN_DECL
+BEGIN_DECL()
/*####[ Type definition ]####################################################*/
-typedef struct xbt_set_ *xbt_set_t;
+/** \name Set and set elements
+ \ingroup XBT_set
+ generic dictionary
+*/
+/*@{*/
+typedef struct xbt_set_ *xbt_set_t; /**< Set */
typedef struct xbt_set_elm_ {
unsigned int ID;
char *name;
unsigned int name_len;
-} s_xbt_set_elm_t,*xbt_set_elm_t;
+} s_xbt_set_elm_t,*xbt_set_elm_t; /**< Set element */
/*####[ Functions ]##########################################################*/
/* To traverse (simple) caches */
/* Don't add or remove entries to the cache while traversing !!! */
/*###########################################################################*/
-typedef struct xbt_set_cursor_ *xbt_set_cursor_t;
+typedef struct xbt_set_cursor_ *xbt_set_cursor_t; /**< Set cursor */
+/*@}*/
void xbt_set_cursor_first (xbt_set_t set,
xbt_set_cursor_t *cursor);
int xbt_set_cursor_get_or_free (xbt_set_cursor_t *cursor,
xbt_set_elm_t *elm);
+/**
+ \brief Set iterator
+ \ingroup XBT_set
+ * \param set what to iterate over
+ * \param cursor a #xbt_set_cursor_t used as cursor
+ * \param elm a #xbt_set_elm_t
+ *
+ * Iterates over the whole set.
+ */
#define xbt_set_foreach(set,cursor,elm) \
for ((cursor) = NULL, xbt_set_cursor_first((set),&(cursor)) ; \
xbt_set_cursor_get_or_free(&(cursor),(xbt_set_elm_t*)&(elm)); \
xbt_set_cursor_step(cursor) )
-END_DECL
+END_DECL()
#endif /* _XBT_SET_H */
/* This type should be added to a type that is to be used in such a swag */
/* Whenever a new object with this struct is created, all fields have
to be set to NULL */
+
+/** \name Swag types
+ \ingroup XBT_swag
+
+ Specific set.
+
+ These typedefs are public so that the compiler can
+ do his job but believe me, you don't want to try to play with
+ those structs directly. Use them as an abstract datatype.
+*/
+/*@{*/
typedef struct xbt_swag_hookup {
void *next;
void *prev;
-} s_xbt_swag_hookup_t, *xbt_swag_hookup_t;
+} s_xbt_swag_hookup_t;
+/**< This type should be added to a type that is to be used in a swag.
+ * For example like that :
+
+\code
+typedef struct foo {
+ s_xbt_swag_hookup_t set1_hookup;
+ s_xbt_swag_hookup_t set2_hookup;
+
+ double value;
+} s_foo_t, *foo_t;
+...
+{
+ s_foo_t elem;
+ xbt_swag_t set1=NULL;
+ xbt_swag_t set2=NULL;
+
+ set1 = xbt_swag_new(xbt_swag_offset(elem, set1_hookup));
+ set2 = xbt_swag_new(xbt_swag_offset(elem, set2_hookup));
+
+}
+\endcode
+*/
+typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t;
+
typedef struct xbt_swag {
void *head;
size_t offset;
int count;
} s_xbt_swag_t, *xbt_swag_t;
+/**< A typical swag */
+/*@}*/
xbt_swag_t xbt_swag_new(size_t offset);
void xbt_swag_free(xbt_swag_t swag);
#define xbt_swag_getNext(obj,offset) (((xbt_swag_hookup_t)(((char *) (obj)) + (offset)))->prev)
#define xbt_swag_getPrev(obj,offset) (((xbt_swag_hookup_t)(((char *) (obj)) + (offset)))->next)
+/**
+ * \ingroup XBT_swag
+ * \brief Offset computation
+ * \arg var a variable of type <tt>struct</tt> something
+ * \arg field a field of <tt>struct</tt> something
+ * \return the offset of \a field in <tt>struct</tt> something.
+ *
+ * It is very similar to offsetof except that is done at runtime and that
+ * you have to declare a variable. Why defining such a macro then ?
+ * Because it is portable...
+ */
#define xbt_swag_offset(var,field) ((char *)&( (var).field ) - (char *)&(var))
+/**
+ \name Swag iterator
+ \ingroup XBT_swag
+ *
+ * Iterates over the whole swag.
+ */
+/*@{*/
#define xbt_swag_foreach(obj,swag) \
for((obj)=xbt_swag_getFirst((swag)); \
(obj)!=NULL; \
(obj)=xbt_swag_getNext((obj),(swag)->offset))
+/**< A simple swag iterator
+ * \param obj the indice of the loop
+ * \param swag what to iterate over
+ \warning you cannot modify the \a swag while using this loop */
#define xbt_swag_foreach_safe(obj,obj_next,swag) \
for((obj)=xbt_swag_getFirst((swag)), \
((obj)?(obj_next=xbt_swag_getNext((obj),(swag)->offset)): \
(obj)=obj_next, \
((obj)?(obj_next=xbt_swag_getNext((obj),(swag)->offset)): \
(obj_next=NULL)) )
+/**< A safe swag iterator
+ * \param obj the indice of the loop
+ * \param obj_next the object that is right after (if any) \a obj in the swag
+ * \param swag what to iterate over
+
+ You can safely modify the \a swag while using this loop.
+ Well, safely... Err. You can remove \a obj without having any
+ trouble at least. */
+/*@}*/
#endif /* _XBT_SWAG_H */
#include <stdlib.h>
#include "xbt/misc.h"
-BEGIN_DECL
+BEGIN_DECL()
#if 0
#define __CALLOC_OP(n, s) calloc((n), (s))
#define __REALLOC_OP(n, s) realloc((n), (s))
# define _XBT_INLINE
#endif
-END_DECL
+END_DECL()
#include "xbt/error.h" /* needed for xbt_die */
/** \defgroup XBT_context User-level context library
* \ingroup XBT_API
* \brief This section describes how to use high-level functions
- * (as opposed to <c>setjump/longjmp</c>) to schedule non-preemptible
+ * (as opposed to <tt>setjump/longjmp</tt>) to schedule non-preemptible
* threads.
*/
/** \defgroup XBT_dict A generic dictionnary
* provide the same kind of functionnality as dynamic arrays but in time O(1).
* However these functions use malloc/free a way too much often.
*/
+ /** \defgroup XBT_set A generic set datatype
+ * \ingroup XBT_API
+ * \brief A data container consisting in \ref XBT_dict and \ref XBT_dynar
+ */
/** \defgroup XBT_swag A specific set datatype
* \ingroup XBT_API
* \brief Warning, this module is done to be efficient and performs tons of
/** \defgroup SURF_API API of SURF
* \ingroup SimGrid_API
+ * \brief (Not documented yet).
+ *
+
+ * SURF provides the core functionnalities to simulate a virtual
+ * platform. It is very low-level and is not intended to be used as
+ * such but rather to serve as a basis for higher-level simulators.
+ * We're still working on it and the structure is a little bit complex.
+ * So we'll document it only when we'll be completely satisfied of
+ * the way it is organized.
+ *
+ * It is where platform models are encoded. If you need a model that is not
+ * encoded yet, please tell me (<arnaud.legrand@imag.fr>) and we'll see if
+ * it is feasible or not (hopefully it should be but who knows).
*/
-
/** \defgroup MSG_API API of MSG
* \ingroup SimGrid_API
*/
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(deployment, msg,
"Logging specific to MSG (environment)");
-extern char *yytext;
-
-
static int parse_argc = -1 ;
static char **parse_argv = NULL;
static m_process_code_t parse_code = NULL;
}
/** \ingroup msg_easier_life
- * \brief Registers a ::m_process_code_t code in a global table.
+ * \brief Registers a #m_process_code_t code in a global table.
*
* Registers a code function in a global table.
- * This table is then used by ::MSG_launch_application.
+ * This table is then used by #MSG_launch_application.
* \param name the reference name of the function.
* \param code the function
*/
}
/** \ingroup msg_easier_life
- * \brief Registers a ::m_process_t code in a global table.
+ * \brief Registers a #m_process_t code in a global table.
*
* Registers a code function in a global table.
- * This table is then used by ::MSG_launch_application.
+ * This table is then used by #MSG_launch_application.
* \param name the reference name of the function.
*/
m_process_code_t MSG_get_registered_function(const char *name)
/** \ingroup msg_easier_life
* \brief Get the arguments of the current process.
- * \deprecated{Not useful since m_process_code_t is int (*)(int argc, char *argv[])}
+ * \deprecated{Not useful since #m_process_code_t is int (*)(int argc, char *argv[])}
*
* This functions returns the values set for the current process
- * using ::MSG_set_arguments or ::MSG_launch_application.
+ * using #MSG_set_arguments or #MSG_launch_application.
* \param argc the number of arguments
* \param argv the arguments table
*/
*
* Creates a new platform, including hosts, links and the
* routing_table.
- * \param file a filename of a description of a platform. This file is a simple text
- * file in which you can use C-style comments and C-style strings.
- * Here is a simple description of the format:
- \verbatim
-<CPU>
-host_name "power in MFlops" "availability" "availability file" ON/OFF "failure file"
-host_name "power in MFlops" "availability" "availability file" ON/OFF "failure file"
-...
-</LINKS>
-link_name "bandwidth in Mbytes" "bandwidth file" "latency in ms" "latency file"
-link_name "bandwidth in Mbytes" "bandwidth file" "latency in ms" "latency file"
-...
-ROUTES
-src_name dst_name (link_name link_name link_name ... )
-src_name dst_name (link_name link_name link_name ... )
-...
-\endverbatim
- * Have a look in the directory examples/msg/ to have a better idea of what
- * it looks like.
+ * \param file a filename of a xml description of a platform. This file
+ * follows this DTD :
+ *
+ * \include surfxml.dtd
+ *
+ * Here is a small example of such a platform
+ *
+ * \include small_platform.xml
+ *
+ * Have a look in the directory examples/msg/ to have a big example.
*/
void MSG_create_environment(const char *file) {
xbt_dict_cursor_t cursor = NULL;
while((p=xbt_fifo_shift(msg_global->process_list))) {
- MSG_process_free(p);
+ MSG_process_kill(p);
}
xbt_context_exit();
/** \ingroup msg_gos_functions
* \brief This function is now deprecated and useless. Please stop using it.
*/
-
MSG_error_t MSG_process_start(m_process_t process)
{
xbt_assert0(0,"This function is now deprecated and useless. Please stop using it.");
else MSG_RETURN(MSG_TRANSFER_FAILURE);
}
+/** \ingroup msg_gos_functions
+ * \brief Does exactly the same as MSG_task_put but with a bounded transmition
+ * rate.
+ *
+ * \sa MSG_task_put
+ */
MSG_error_t MSG_task_put_bounded(m_task_t task,
m_host_t dest, m_channel_t channel,
long double max_rate)
{
return PROCESS_GET_ERRNO();
}
-
return MSG_process_get_host(MSG_process_self());
}
-/**
+/*
* Real function for destroy a host.
* MSG_host_destroy is just a front_end that also removes it from
* msg_global->host
"Logging specific to MSG (process)");
/******************************** Process ************************************/
+/** \ingroup m_process_management
+ * \brief Creates and runs a new #m_process_t.
+ *
+ * Does exactly the same as #MSG_process_create_with_arguments but without
+ providing standard arguments (\a argc, \a argv).
+ * \sa MSG_process_create_with_arguments
+ */
+m_process_t MSG_process_create(const char *name,
+ m_process_code_t code, void *data,
+ m_host_t host)
+{
+ return MSG_process_create_with_arguments(name, code, data, host, -1, NULL);
+}
+
+static void MSG_process_cleanup(void *arg)
+{
+ xbt_fifo_remove(msg_global->process_list, arg);
+ xbt_fifo_remove(msg_global->process_to_run, arg);
+ xbt_fifo_remove(((m_process_t) arg)->simdata->host->simdata->process_list, arg);
+ xbt_free(((m_process_t) arg)->name);
+ xbt_free(((m_process_t) arg)->simdata);
+ xbt_free(arg);
+}
+
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
object. It is for user-level information and can be NULL. It can
be retrieved with the function \ref MSG_process_get_data.
* \param host the location where the new agent is executed.
+ * \param argc first argument passed to \a code
+ * \param argv second argument passed to \a code
* \see m_process_t
* \return The new corresponding object.
*/
-m_process_t MSG_process_create(const char *name,
- m_process_code_t code, void *data,
- m_host_t host)
-{
- return MSG_process_create_with_arguments(name, code, data, host, -1, NULL);
-}
-
-static void MSG_process_cleanup(void *arg)
-{
- xbt_fifo_remove(msg_global->process_list, arg);
- xbt_fifo_remove(msg_global->process_to_run, arg);
- xbt_fifo_remove(((m_process_t) arg)->simdata->host->simdata->process_list, arg);
- xbt_free(((m_process_t) arg)->name);
- xbt_free(((m_process_t) arg)->simdata);
- xbt_free(arg);
-}
-
m_process_t MSG_process_create_with_arguments(const char *name,
m_process_code_t code, void *data,
m_host_t host, int argc, char **argv)
return process;
}
-void MSG_process_free(m_process_t process)
+/** \ingroup m_process_management
+ * \param process poor victim
+ *
+ * This function simply kills a \a process... scarry isn't it ? :)
+ */
+void MSG_process_kill(m_process_t process)
{
xbt_fifo_remove(msg_global->process_list,process);
xbt_context_free(process->simdata->context);
return (((simdata_process_t) process->simdata)->PID);
}
-
/** \ingroup m_process_management
* \brief Returns the process ID of the parent of \a process.
*
return (process->simdata->suspended);
}
-
-
-
-
MSG_error_t __MSG_process_block(void)
{
m_process_t process = MSG_process_self();
cpu->resource = (surf_resource_t) surf_cpu_resource;
cpu->name = name;
cpu->power_scale = power_scale;
+ xbt_assert0(cpu->power_scale>0,"Power has to be >0");
cpu->power_current = power_initial;
if (power_trace)
cpu->power_event =
workstation->id = nb_workstation++;
workstation->power_scale = power_scale;
+ xbt_assert0(workstation->power_scale>0,"Power has to be >0");
+
workstation->power_current = power_initial;
if (power_trace)
workstation->power_event =
/**
* xbt_cfg_new:
*
- * @whereto:
+ * \return
*
* Initialise an config set
*/
/**
* xbt_cfg_cpy:
*
- * @whereto: the config set to be created
- * @tocopy: the source data
+ * \arg whereto the config set to be created
+ * \arg tocopy the source data
*
*/
/**
* xbt_cfg_dump:
- * @name: The name to give to this config set
- * @indent: what to write at the begining of each line (right number of spaces)
- * @cfg: the config set
+ * \arg name The name to give to this config set
+ * \arg indent what to write at the begining of each line (right number of spaces)
+ * \arg cfg the config set
*
* Dumps a config set for debuging purpose
*/
/**
* xbt_cfgelm_free:
*
- * @data: the data to be freed (typed as void* to be usable as free funct in dict)
+ * \arg data the data to be freed (typed as void* to be usable as free funct in dict)
*
* free an config element
*/
/**
* xbt_cfg_register:
- * @cfg: the config set
- * @type: the type of the config element
- * @min: the minimum
- * @max: the maximum
+ * \arg cfg the config set
+ * \arg type the type of the config element
+ * \arg min the minimum
+ * \arg max the maximum
*
* register an element within a config set
*/
/**
* xbt_cfg_unregister:
*
- * @cfg: the config set
- * @name: the name of the elem to be freed
+ * \arg cfg the config set
+ * \arg name the name of the elem to be freed
*
* unregister an element from a config set.
* Note that it removes both the DTD and the actual content.
/**
* xbt_cfg_register_str:
*
- * @cfg: the config set
- * @entry: a string describing the element to register
+ * \arg cfg the config set
+ * \arg entry a string describing the element to register
*
* Parse a string and register the stuff described.
*/
/**
* xbt_cfg_check:
*
- * @cfg: the config set
+ * \arg cfg the config set
*
* Check the config set
*/
/**
* xbt_cfg_get_type:
*
- * @cfg: the config set
- * @name: the name of the element
- * @type: the result
+ * \arg cfg the config set
+ * \arg name the name of the element
+ * \arg type the result
*
* Give the type of the config element
*/
/*----[ Setting ]---------------------------------------------------------*/
/**
* xbt_cfg_set_vargs():
- * @cfg: config set to fill
- * @varargs: NULL-terminated list of pairs {(const char*)key, value}
+ * \arg cfg config set to fill
+ * \arg varargs NULL-terminated list of pairs {(const char*)key, value}
*
* Add some values to the config set.
- * @warning: if the list isn't NULL terminated, it will segfault.
+ * \warning if the list isn't NULL terminated, it will segfault.
*/
xbt_error_t
xbt_cfg_set_vargs(xbt_cfg_t cfg, va_list pa) {
/**
* xbt_cfg_set():
- * @cfg: config set to fill
- * @varargs: NULL-terminated list of pairs {(const char*)key, value}
+ * \arg cfg config set to fill
+ * \arg varargs NULL-terminated list of pairs {(const char*)key, value}
*
* Add some values to the config set.
- * @warning: if the list isn't NULL terminated, it will segfault.
+ * \warning if the list isn't NULL terminated, it will segfault.
*/
xbt_error_t xbt_cfg_set(xbt_cfg_t cfg, ...) {
va_list pa;
/**
* xbt_cfg_set_parse():
- * @cfg: config set to fill
- * @options: a string containing the content to add to the config set. This
+ * \arg cfg config set to fill
+ * \arg options a string containing the content to add to the config set. This
* is a '\t',' ' or '\n' separated list of cells. Each individual cell is
* like "[name]:[value]" where [name] is the name of an already registred
* cell, and [value] conforms to the data type under which this cell was
/**
* xbt_cfg_set_int:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the value of the cell
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the value of the cell
*
- * Set the value of the cell @name in @cfg with the provided value.
+ * Set the value of the cell #name in #cfg with the provided value.
*/
xbt_error_t
xbt_cfg_set_int(xbt_cfg_t cfg,const char*name, int val) {
/**
* xbt_cfg_set_double:
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the doule to set
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the doule to set
*
- * Set the value of the cell @name in @cfg with the provided value.
+ * Set the value of the cell #name in #cfg with the provided value.
*/
xbt_error_t
/**
* xbt_cfg_set_string:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the value to be added
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the value to be added
*
- * Set the value of the cell @name in @cfg with the provided value.
+ * Set the value of the cell #name in #cfg with the provided value.
*/
xbt_error_t
/**
* xbt_cfg_set_host:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @host: the host
- * @port: the port number
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg host the host
+ * \arg port the port number
*
- * Set the value of the cell @name in @cfg with the provided value
- * on the given @host to the given @port
+ * Set the value of the cell #name in #cfg with the provided value
+ * on the given #host to the given #port
*/
xbt_error_t
/**
* xbt_cfg_rm_int:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the value to be removed
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the value to be removed
*
- * Remove the provided @val from the cell @name in @cfg.
+ * Remove the provided #val from the cell #name in #cfg.
*/
xbt_error_t xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
/**
* xbt_cfg_rm_double:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the value to be removed
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the value to be removed
*
- * Remove the provided @val from the cell @name in @cfg.
+ * Remove the provided #val from the cell #name in #cfg.
*/
xbt_error_t xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
/**
* xbt_cfg_rm_string:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the value of the string which will be removed
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the value of the string which will be removed
*
- * Remove the provided @val from the cell @name in @cfg.
+ * Remove the provided #val from the cell #name in #cfg.
*/
xbt_error_t
xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
/**
* xbt_cfg_rm_host:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @host: the hostname
- * @port: the port number
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg host the hostname
+ * \arg port the port number
*
- * Remove the provided @host:@port from the cell @name in @cfg.
+ * Remove the provided #host:#port from the cell #name in #cfg.
*/
xbt_error_t
/**
* xbt_cfg_empty:
*
- * @cfg: the config set
- * @name: the name of the cell
+ * \arg cfg the config set
+ * \arg name the name of the cell
*
* rm evenything
*/
/**
* xbt_cfg_get_int:
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the wanted value
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the wanted value
*
* Returns the first value from the config set under the given name.
* If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar()
* instead.
*
- * @warning the returned value is the actual content of the config set
+ * \warning the returned value is the actual content of the config set
*/
xbt_error_t
xbt_cfg_get_int (xbt_cfg_t cfg,
/**
* xbt_cfg_get_double:
- * @cfg: the config set
- * @name: the name of the cell
- * @val: the wanted value
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg val the wanted value
*
* Returns the first value from the config set under the given name.
* If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar()
* instead.
*
- * @warning the returned value is the actual content of the config set
+ * \warning the returned value is the actual content of the config set
*/
xbt_error_t
/**
* xbt_cfg_get_string:
*
- * @th: the config set
- * @name: the name of the cell
- * @val: the wanted value
+ * \arg th the config set
+ * \arg name the name of the cell
+ * \arg val the wanted value
*
* Returns the first value from the config set under the given name.
* If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar()
* instead.
*
- * @warning the returned value is the actual content of the config set
+ * \warning the returned value is the actual content of the config set
*/
xbt_error_t xbt_cfg_get_string(xbt_cfg_t cfg,
/**
* xbt_cfg_get_host:
*
- * @cfg: the config set
- * @name: the name of the cell
- * @host: the host
- * @port: the port number
+ * \arg cfg the config set
+ * \arg name the name of the cell
+ * \arg host the host
+ * \arg port the port number
*
* Returns the first value from the config set under the given name.
* If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar()
* instead.
*
- * @warning the returned value is the actual content of the config set
+ * \warning the returned value is the actual content of the config set
*/
xbt_error_t xbt_cfg_get_host (xbt_cfg_t cfg,
/**
* xbt_cfg_get_dynar:
- * @cfg: where to search in
- * @name: what to search for
- * @dynar: result
+ * \arg cfg where to search in
+ * \arg name what to search for
+ * \arg dynar result
*
* Get the data stored in the config bag.
*
- * @warning the returned value is the actual content of the config set
+ * \warning the returned value is the actual content of the config set
*/
xbt_error_t xbt_cfg_get_dynar (xbt_cfg_t cfg,
const char *name,
return;
}
+/** \name Functions
+ * \ingroup XBT_context
+ */
+/*@{*/
+/** Context module initialization
+ *
+ * \warning It has to be called before using any other function of this module.
+ */
void xbt_context_init(void)
{
if(!current_context) {
}
}
+/** Garbage collection
+ *
+ * Should be called some time to time to free the memory allocated for contexts
+ * that have finished executing their main functions.
+ */
void xbt_context_empty_trash(void)
{
xbt_context_t context=NULL;
return NULL;
}
+/**
+ * \param context the context to start
+ *
+ * Calling this function prepares \a context to be run. It will
+ however run effectively only when calling #xbt_context_schedule
+ */
void xbt_context_start(xbt_context_t context)
{
/* xbt_fifo_insert(msg_global->process, process); */
return;
}
+/**
+ * \param code a main function
+ * \param startup_func a function to call when running the context for
+ * the first time and just before the main function \a code
+ * \param startup_arg the argument passed to the previous function (\a startup_func)
+ * \param cleanup_func a function to call when running the context, just after
+ the termination of the main function \a code
+ * \param cleanup_arg the argument passed to the previous function (\a cleanup_func)
+ * \param argc first argument of function \a code
+ * \param argv seconde argument of function \a code
+ */
xbt_context_t xbt_context_new(xbt_context_function_t code,
void_f_pvoid_t startup_func, void *startup_arg,
void_f_pvoid_t cleanup_func, void *cleanup_arg,
}
+/**
+ * Calling this function makes the current context yield. The context
+ * that scheduled it returns from xbt_context_schedule as if nothing
+ * had happened.
+ */
void xbt_context_yield(void)
{
__xbt_context_yield(current_context);
}
+
+/**
+ * \param context the winner
+ *
+ * Calling this function blocks the current context and schedule \a context.
+ * When \a context will call xbt_context_yield, it will return
+ * to this function as if nothing had happened.
+ */
void xbt_context_schedule(xbt_context_t context)
{
xbt_assert0((current_context==init_context),
__xbt_context_yield(context);
}
+/**
+ * This function kill all existing context and free all the memory
+ * that has been allocated in this module.
+ */
void xbt_context_exit(void) {
xbt_context_t context=NULL;
init_context = current_context = NULL ;
}
+/**
+ * \param context poor victim
+ *
+ * This function simply kills \a context... scarry isn't it ?
+ */
void xbt_context_free(xbt_context_t context)
{
int i ;
return;
}
+/*@}*/
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt,
"Dictionaries provide the same functionnalities than hash tables");
-
/*####[ Private prototypes ]#################################################*/
-
/*####[ Code ]###############################################################*/
/**
- * xbt_dict_new:
+ * \ingroup XBT_dict
*
- * @whereto: pointer to the destination
+ * \return pointer to the destination
*
* Creates and initialize a new dictionnary
*/
return res;
}
/**
- * xbt_dict_free:
- * @dict: the dictionnary to be freed
+ * \ingroup XBT_dict
+ * \param dict the dictionnary to be freed
*
* Frees a cache structure with all its childs.
*/
}
/**
- * xbt_dict_set_ext:
+ * \ingroup XBT_dict
*
- * @dict: the container
- * @key: the key to set the new data
- * @data: the data to add in the dict
+ * \param dict the container
+ * \param key the key to set the new data
+ * \param key_len the size of the #key
+ * \param data the data to add in the dict
+ * \param free_ctn function to call with (#key as argument) when
+ * #key is removed from the dictionnary
*
- * set the @data in the structure under the @key, which can be any kind
- * of data, as long as its length is provided in @key_len.
+ * set the #data in the structure under the #key, which can be any kind
+ * of data, as long as its length is provided in #key_len.
*/
void
xbt_dict_set_ext(xbt_dict_t dict,
}
/**
- * xbt_dict_set:
+ * \ingroup XBT_dict
*
- * @head: the head of the dict
- * @key: the key to set the new data
- * @data: the data to add in the dict
+ * \param dict the head of the dict
+ * \param key the key to set the new data
+ * \param data the data to add in the dict
+ * \param free_ctn function to call with (#key as argument) when
+ * #key is removed from the dictionnary
*
- * set the @data in the structure under the @key, which is a
+ * set the #data in the structure under the #key, which is a
* null terminated string.
*/
void
}
/**
- * xbt_dict_get_ext:
+ * \ingroup XBT_dict
*
- * @dict: the dealer of data
- * @key: the key to find data
- * @data: the data that we are looking for
- * @Returns: xbt_error
+ * \param dict the dealer of data
+ * \param key the key to find data
+ * \param key_len the size of the #key
+ * \param data the data that we are looking for
+ * \return xbt_error
*
- * Search the given @key. mismatch_error when not found.
+ * Search the given #key. mismatch_error when not found.
*/
xbt_error_t
xbt_dict_get_ext(xbt_dict_t dict,
}
/**
- * xbt_dict_get:
+ * \ingroup XBT_dict
*
- * @dict: the dealer of data
- * @key: the key to find data
- * @data: the data that we are looking for
- * @Returns: xbt_error
+ * \param dict the dealer of data
+ * \param key the key to find data
+ * \param data the data that we are looking for
+ * \return xbt_error
*
- * Search the given @key. mismatch_error when not found.
+ * Search the given #key. mismatch_error when not found.
*/
xbt_error_t
xbt_dict_get(xbt_dict_t dict,
/**
- * xbt_dict_remove_ext:
+ * \ingroup XBT_dict
*
- * @dict: the trash can
- * @key: the key of the data to be removed
- * @Returns: xbt_error_t
+ * \param dict the trash can
+ * \param key the key of the data to be removed
+ * \param key_len the size of the #key
+ * \return xbt_error_t
*
- * Remove the entry associated with the given @key
+ * Remove the entry associated with the given #key
*/
xbt_error_t
xbt_dict_remove_ext(xbt_dict_t dict,
}
/**
- * xbt_dict_remove:
+ * \ingroup XBT_dict
*
- * @head: the head of the dict
- * @key: the key of the data to be removed
- * @Returns: xbt_error_t
+ * \param dict the head of the dict
+ * \param key the key of the data to be removed
+ * \return xbt_error_t
*
- * Remove the entry associated with the given @key
+ * Remove the entry associated with the given #key
*/
xbt_error_t
xbt_dict_remove(xbt_dict_t dict,
/**
- * xbt_dict_dump:
+ * \ingroup XBT_dict
*
- * @dict: the exibitionist
- * @output: a function to dump each data in the tree
- * @Returns: xbt_error_t
+ * \param dict the exibitionist
+ * \param output a function to dump each data in the tree
+ * \return xbt_error_t
*
- * Ouputs the content of the structure. (for debuging purpose). @ouput is a
+ * Ouputs the content of the structure. (for debuging purpose). #ouput is a
* function to output the data. If NULL, data won't be displayed.
*/
printf("Dict %p:\n", (void*)dict);
xbt_dictelm_dump(dict ? dict->head: NULL, output);
}
-
}
/**
- * xbt_dynar_new:
- * @elm_size: size of each element in the dynar
- * @free_func: function to call each time we want to get rid of an element (or NULL if nothing to do).
+ * \ingroup XBT_dynar
+ * \param elmsize size of each element in the dynar
+ * \param free_f function to call each time we want to get rid of an element (or NULL if nothing to do).
*
* Creates a new dynar. If a free_func is provided, the elements have to be
* pointer of pointer. That is to say that dynars can contain either base
}
/**
- * xbt_dynar_free_container:
- * @dynar: poor victim
+ * \ingroup XBT_dynar
+ * \param dynar poor victim
*
* kilkil a dynar BUT NOT its content. Ie, the array is freed, but not what
* its contain points to.
}
/**
- * xbt_dynar_reset:
- * @dynar: who to squeeze
+ * \ingroup XBT_dynar
+ * \param dynar who to squeeze
*
* Frees the content and set the size to 0
*/
}
/**
- * xbt_dynar_free:
- * @dynar: poor victim
+ * \ingroup XBT_dynar
+ * \param dynar poor victim
*
* kilkil a dynar and its content
*/
}
/**
- * xbt_dynar_length:
- * @dynar: the dynar we want to mesure
+ * \ingroup XBT_dynar
+ * \param dynar the dynar we want to mesure
*
* Returns the count of elements in a dynar
*/
}
/**
- * xbt_dynar_get_cpy:
- * @dynar: information dealer
- * @idx: index of the slot we want to retrive
- * @dst: where to pu the result to.
+ * \ingroup XBT_dynar
+ * \param dynar information dealer
+ * \param idx index of the slot we want to retrive
+ * \param[out] dst where to put the result to.
*
* Retrieve a copy of the Nth element of a dynar.
*/
}
/**
- * xbt_dynar_get_ptr:
- * @dynar: information dealer
- * @idx: index of the slot we want to retrive
- * @dst: where to pu the result to.
+ * \ingroup XBT_dynar
+ * \param dynar information dealer
+ * \param idx index of the slot we want to retrieve
+ * \return the #idx-th element of #dynar.
*
* Retrieve the Nth element of a dynar. Warning, the returned value is the actual content of
* the dynar. Make a copy before fooling with it.
}
/**
- * xbt_dynar_set:
- * @dynar:
- * @idx:
- * @src: What will be feeded to the dynar
+ * \ingroup XBT_dynar
+ * \param dynar information dealer
+ * \param idx index of the slot we want to modify
+ * \param src What will be feeded to the dynar
*
* Set the Nth element of a dynar, expanding the dynar if needed, BUT NOT freeing
* the previous value at this position. If you want to free the previous content,
}
/**
- * xbt_dynar_replace:
- * @dynar:
- * @idx:
- * @object:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param idx
+ * \param object
*
* Set the Nth element of a dynar, expanding the dynar if needed, AND DO
* free the previous value at this position. If you don't want to free the
}
/**
- * xbt_dynar_insert_at_ptr:
+ * \ingroup XBT_dynar
*
* Make room for a new element in the dynar, and return a pointer to
* its position. You can then use regular affectation to set its value
}
/**
- * xbt_dynar_insert_at:
- * @dynar:
- * @idx:
- * @src: What will be feeded to the dynar
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param idx
+ * \param src What will be feeded to the dynar
*
* Set the Nth element of a dynar, expanding the dynar if needed, and
* moving the previously existing value and all subsequent ones to one
}
/**
- * xbt_dynar_remove_at:
- * @dynar:
- * @idx:
- * @object:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param idx
+ * \param object
*
* Get the Nth element of a dynar, removing it from the dynar and moving
* all subsequent values to one position left in the dynar.
}
/**
- * xbt_dynar_push_ptr:
+ * \ingroup XBT_dynar
*
* Make room at the end of the dynar for a new element, and return a pointer to it
*/
}
/**
- * xbt_dynar_push:
- * @dynar:
- * @src:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param src
*
* Add an element at the end of the dynar
*/
}
/**
- * xbt_dynar_pop_ptr:
- * @dynar:
- * @dst:
+ * \param dynar
+ * \param dst
*
* Make the last element of the dynar as unused and return a pointer to it.
*/
}
/**
- * xbt_dynar_pop:
- * @dynar:
- * @dst:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param[out] dst
*
* Get and remove the last element of the dynar
*/
}
/**
- * xbt_dynar_unshift:
- * @dynar:
- * @src:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param src
*
* Add an element at the begining of the dynar (rather long, Use
* xbt_dynar_push() when possible)
}
/**
- * xbt_dynar_shift:
- * @dynar:
- * @dst:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param[out] dst
*
* Get and remove the first element of the dynar (rather long, Use
* xbt_dynar_pop() when possible)
}
/**
- * xbt_dynar_map:
- * @dynar:
- * @operator:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param operator
*
* Apply a function to each member of a dynar (this function may change the
* value of the element itself, but should not mess with the dynar).
}
/**
- * xbt_dynar_cursor_first:
+ * \ingroup XBT_dynar
*
* Put the cursor at the begining of the dynar. (actually, one step before
* the begining, so that you can iterate over the dynar with a for loop).
}
/**
- * xbt_dynar_cursor_step:
+ * \ingroup XBT_dynar
*
* Move the cursor to the next value (and return true), or return false.
*/
}
/**
- * xbt_dynar_cursor_get:
+ * \ingroup XBT_dynar
*
* Get the current value of the cursor
*/
}
/**
- * xbt_dynar_cursor_rm:
- * @dynar:
- * @cursor:
+ * \ingroup XBT_dynar
+ * \param dynar
+ * \param cursor
*
* Remove (free) the entry pointed by the cursor, for use in the middle of a foreach
*/
#include "xbt/error.h"
/**
- * xbt_error_name:
- * @errcode:
- * @Returns: the printable name of an error code
+ * \brief Usefull to do nice error repporting messages.
+ * \ingroup XBT_error
+ * \param errcode
+ * \return the printable name of an error code
*
- * usefull to do nice error repporting messages
*/
-
const char *xbt_error_name(xbt_error_t errcode) {
switch (errcode) {
XBT_LOG_EXTERNAL_CATEGORY(xbt);
XBT_LOG_DEFAULT_CATEGORY(xbt);
+/**
+ * \ingroup XBT_error
+ * \param msg
+ *
+ * Things are so messed up that the only thing to do now, is to stop the program.
+ */
void xbt_die (const char *msg) {
CRITICAL1("%s",msg);
xbt_abort();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(fifo,xbt,"FIFO");
-/*
- * xbt_fifo_new()
+/** \name Functions
+ * \ingroup XBT_fifo
+ */
+/*@{*/
+
+/** Constructor
+ * \return a new fifo
*/
xbt_fifo_t xbt_fifo_new(void)
{
return fifo;
}
-/*
- * xbt_fifo_free()
+/** Destructor
+ * \param l poor victim
+ *
+ * Free the fifo structure. None of the objects that was in the fifo is however modified.
*/
void xbt_fifo_free(xbt_fifo_t l)
{
return;
}
-/*
- * xbt_fifo_push()
- * at the tail
+/* Push
+ * \param l list
+ * \param t element
+ * \return the bucket that was just added
+ *
+ * Add an object at the tail of the list
*/
xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t l, void *t)
{
return new;
}
-/*
- * xbt_fifo_pop()
- * from the tail
+/** Pop
+ * \param l list
+ * \returns the object stored at the tail of the list.
+ *
+ * Removes and returns the object stored at the tail of the list.
+ * Returns NULL if the list is empty.
*/
void *xbt_fifo_pop(xbt_fifo_t l)
{
return content;
}
-/*
- * xbt_fifo_unshift()
- * at the head
+/**
+ * \param l list
+ * \param t element
+ * \return the bucket that was just added
+ *
+ * Add an object at the head of the list
*/
xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t l, void *t)
{
return new;
}
-/*
- * xbt_fifo_shift()
- * from the head
+/** Shift
+ * \param l list
+ * \returns the object stored at the head of the list.
+ *
+ * Removes and returns the object stored at the head of the list.
+ * Returns NULL if the list is empty.
*/
void *xbt_fifo_shift(xbt_fifo_t l)
{
return content;
}
-/*
- * xbt_fifo_push_item()
- * at the tail
+/** Push a bucket
+ * \param l list
+ * \param new bucket
+ *
+ * Hook up this bucket at the tail of the list
*/
void xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t new)
{
l->tail = new;
}
-/*
- * xbt_fifo_pop_item()
- * from the tail
+/** Pop bucket
+ * \param l
+ * \returns the bucket that was at the tail of the list.
+ *
+ * Returns NULL if the list was empty.
*/
xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t l)
{
return item;
}
-/*
- * xbt_fifo_unshift_item()
- * at the head
+/** Push a bucket
+ * \param l list
+ * \param new bucket
+ *
+ * Hook up this bucket at the head of the list
*/
void xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t new)
{
return;
}
-/*
- * xbt_fifo_shift_item()
- * from the head
+/** Shift bucket
+ * \param l
+ * \returns the bucket that was at the head of the list.
+ *
+ * Returns NULL if the list was empty.
*/
xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t l)
{
return item;
}
-/*
- * xbt_fifo_remove()
- * removes an xbt_fifo_item_t using its content from the xbt_fifo
+/**
+ * \param l
+ * \param t an objet
+ *
+ * removes the first occurence of \a t from \a l.
+ * \warning it will not remove duplicates
*/
void xbt_fifo_remove(xbt_fifo_t l, void *t)
{
return;
}
-/*
- * xbt_fifo_remove_item()
- * removes a given xbt_fifo_item_t from the xbt_fifo
+/**
+ * \param l a list
+ * \param current a bucket
+ *
+ * removes a the bucket \a current from the list \a l
*/
void xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t current)
{
(l->count)--;
}
-/*
- * xbt_fifo_is_in()
+/**
+ * \param f a list
+ * \param content an object
+ * \return 1 if \a content is in \a f.
*/
int xbt_fifo_is_in(xbt_fifo_t f, void *content)
{
return 0;
}
-/*
- * xbt_fifo_to_array()
+/**
+ * \param f a list
+ * \return a table with the objects stored in \a f.
*/
void **xbt_fifo_to_array(xbt_fifo_t f)
{
return array;
}
-/*
- * xbt_fifo_Copy()
+/**
+ * \param f a list
+ * \return a copy of \a f.
*/
xbt_fifo_t xbt_fifo_copy(xbt_fifo_t f)
{
return copy;
}
-/*
- * xbt_fifo_newitem()
+/** Constructor
+ * \return a new bucket
*/
xbt_fifo_item_t xbt_fifo_newitem(void)
{
return xbt_new0(struct xbt_fifo_item,1);
}
+/**
+ * \param i a bucket
+ * \param v an object
+ *
+ * stores \a v in \a i.
+ */
void xbt_fifo_set_item_content(xbt_fifo_item_t i , void *v)
{
xbt_fifo_setItemcontent(i,v);
}
+/**
+ * \param i a bucket
+ * \return the object stored \a i.
+ */
void *xbt_fifo_get_item_content(xbt_fifo_item_t i)
{
return xbt_fifo_getItemcontent(i);
}
-/*
- * xbt_fifo_freeitem()
+/** Destructor
+ * \param b poor victim
+ *
+ * Free the bucket but does not modifies the object (if any) that was stored in it.
*/
void xbt_fifo_freeitem(xbt_fifo_item_t b)
{
return;
}
+/**
+ * \param f a list
+ * \return the number of buckets in \a f.
+ */
int xbt_fifo_size(xbt_fifo_t f)
{
return f->count;
}
+/**
+ * \param l a list
+ * \return the head of \a l.
+ */
xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
{
return l->head;
}
+/**
+ * \param i a bucket
+ * \return the bucket that comes next
+ */
xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
{
if(i) return i->next;
return NULL;
}
+/**
+ * \param i a bucket
+ * \return the bucket that is just before \a i.
+ */
xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i)
{
if(i) return i->prev;
return NULL;
}
+/*@}*/
#include "heap_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(heap, xbt, "Heap");
+/** \name Functions
+ * \ingroup XBT_heap
+ */
+/*@{*/
/**
- * xbt_heap_new:
- * @init_size: initial size of the heap
- * @free_func: function to call on each element when you want to free
+ * \param init_size initial size of the heap
+ * \param free_func function to call on each element when you want to free
* the whole heap (or NULL if nothing to do).
*
* Creates a new heap.
}
/**
- * xbt_heap_free:
- * @H: poor victim
+ * \param H poor victim
*
* kilkil a heap and its content
*/
}
/**
- * xbt_heap_size:
- * @H: the heap we're working on
- *
- * returns the number of elements in the heap
+ * \param H the heap we're working on
+ * \return the number of elements in the heap
*/
int xbt_heap_size(xbt_heap_t H)
{
}
/**
- * xbt_heap_push:
- * @H: the heap we're working on
- * @content: the object you want to add to the heap
- * @key: the key associated to this object
+ * \param H the heap we're working on
+ * \param content the object you want to add to the heap
+ * \param key the key associated to this object
*
* Add an element int the heap. The element with the smallest key is
* automatically moved at the top of the heap.
}
/**
- * xbt_heap_pop:
- * @H: the heap we're working on
+ * \param H the heap we're working on
+ * \return the element with the smallest key
*
* Extracts from the heap and returns the element with the smallest
* key. The element with the next smallest key is automatically moved
}
/**
- * xbt_heap_maxkey:
- * @H: the heap we're working on
+ * \param H the heap we're working on
*
- * Returns the smallest key in the heap without modifying the heap.
+ * \return the smallest key in the heap without modifying the heap.
*/
double xbt_heap_maxkey(xbt_heap_t H)
{
}
/**
- * xbt_heap_maxcontent:
- * @H: the heap we're working on
+ * \param H the heap we're working on
*
- * Returns the value associated to the smallest key in the heap
+ * \return the value associated to the smallest key in the heap
* without modifying the heap.
*/
void *xbt_heap_maxcontent(xbt_heap_t H)
return CONTENT(H, 0);
}
-/**
- * xbt_heap_maxcontent:
- * @H: the heap we're working on
+/* <<<< private >>>>
+ * \param H the heap we're working on
*
* Restores the heap property once an element has been deleted.
*/
}
}
-/**
- * xbt_heap_maxcontent:
- * @H: the heap we're working on
- * @i: an item position in the heap
+/* <<<< private >>>>
+ * \param H the heap we're working on
+ * \param i an item position in the heap
*
* Moves up an item at position i to its correct position. Works only
* when called from xbt_heap_push. Do not use otherwise.
}
return;
}
+/*@}*/
}
/**
- * xbt_log_control_set:
- * @cs: What to parse
+ * \ingroup XBT_log
+ * \param control_string What to parse
*
* Typically passed a command-line argument. The string has the syntax:
*
* thresh value is an integer priority level. Sets the category's
* threshold priority.
*
- * @warning
+ * \warning
* This routine may only be called once and that must be before any other
* logging command! Typically, this is done from main().
*/
/*####[ Memory ]############################################################*/
/**
- * xbt_set_new:
- * @dst: where to
+ * \ingroup XBT_set
+ * \return a new set
*
* Creates a new set.
*/
}
/**
- * xbt_set_free:
- * @set:
+ * \ingroup XBT_set
+ * \param set
*
* Frees a set.
*/
}
/**
- * xbt_set_add:
- * @set: set to populate
- * @elm: element to add.
- * @free_ctn: How to add the data
+ * \ingroup XBT_set
+ * \param set set to populate
+ * \param elm element to add.
+ * \param free_func How to add the data
*
* Add an element to a set.
*
}
/**
- * xbt_set_get_by_name:
- * @set:
- * @name: Name of the searched cell
- * @dst: where to put the found data into
+ * \ingroup XBT_set
+ * \param set
+ * \param name Name of the searched cell
+ * \param dst where to put the found data into
*
* get a data stored in the cell by providing its name.
*/
return errcode;
}
/**
- * xbt_set_get_by_name_ext:
- * @set:
- * @name: Name of the searched cell
- * @name_len: length of the name, when strlen cannot be trusted
- * @dst: where to put the found data into
+ * \ingroup XBT_set
+ * \param set
+ * \param name Name of the searched cell
+ * \param name_len length of the name, when strlen cannot be trusted
+ * \param dst where to put the found data into
*
* get a data stored in the cell by providing its name (and the length
* of the name, when strlen cannot be trusted because you don't use a char*
}
/**
- * xbt_set_get_by_code:
- * @set:
- * @id: what you're looking for
- * @dst: where to put the found data into
+ * \ingroup XBT_set
+ * \param set
+ * \param id what you're looking for
+ * \param dst where to put the found data into
*
* get a data stored in the cell by providing its id.
* @warning, if the ID does not exists, you're getting into trouble
} s_xbt_set_cursor_t;
/**
- * xbt_set_cursor_first:
- * @set: on what to let the cursor iterate
- * @cursor: dest address
+ * \ingroup XBT_set
+ * \param set on what to let the cursor iterate
+ * \param cursor dest address
*
* Create the cursor if it does not exists. Rewind it in any case.
*/
}
/**
- * xbt_set_cursor_step:
- * @cursor: the cursor
+ * \ingroup XBT_set
+ * \param cursor the cursor
*
* Move to the next element.
*/
}
/**
- * xbt_set_cursor_get_or_free:
- * @cursor: the cursor
- * @Returns: true if it's ok, false if there is no more data
+ * \ingroup XBT_set
+ * \param curs the cursor
+ * \param elm an element
+ * \return true if it's ok, false if there is no more data
*
* Get current data
*/
#define PREV(obj,offset) xbt_swag_getPrev(obj,offset)
#define NEXT(obj,offset) xbt_swag_getNext(obj,offset)
-/*
- Usage : xbt_swag_new(&obj.setA-&obj);
+/** \name Functions
+ * \ingroup XBT_swag
*/
+/*@{*/
+/** Creates a new swag.
+ * \param offset where the hookup is located in the structure
+ * \see xbt_swag_offset
+ *
+ * Usage : xbt_swag_new(&obj.setA-&obj);
+ */
xbt_swag_t xbt_swag_new(size_t offset)
{
xbt_swag_t swag = xbt_new0(s_xbt_swag_t, 1);
return swag;
}
-
+/**
+ * \param swag poor victim
+ *
+ * kilkil a swag but not it's content. If you do not understand why
+ * xbt_swag_free should not free its content, don't use swags.
+ */
void xbt_swag_free(xbt_swag_t swag)
{
xbt_free(swag);
}
+/** Creates a new swag.
+ * \param swag the swag to initialize
+ * \param offset where the hookup is located in the structure
+ * \see xbt_swag_offset
+ *
+ * Usage : xbt_swag_init(swag,&obj.setA-&obj);
+ */
void xbt_swag_init(xbt_swag_t swag, size_t offset)
{
swag->offset = offset;
}
+
+/**
+ * \param obj the objet to insert in the swag
+ * \param swag a swag
+ *
+ * insert \a obj in \a swag
+ */
void xbt_swag_insert(void *obj, xbt_swag_t swag)
{
swag->tail = obj;
}
+/**
+ * \param obj the objet to insert in the swag
+ * \param swag a swag
+ *
+ * insert (at the head... you probably had a very good reason to do
+ * that, I hope you know what you're doing) \a obj in \a swag
+ */
void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
{
swag->head = obj;
}
+/**
+ * \param obj the objet to insert in the swag
+ * \param swag a swag
+ *
+ * insert (at the tail... you probably had a very good reason to do
+ * that, I hope you know what you're doing) \a obj in \a swag
+ */
void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
{
swag->tail = obj;
}
+/**
+ * \param obj the objet to remove from the swag
+ * \param swag a swag
+ * \return \a obj if it was in the \a swag and NULL otherwise
+ *
+ * removes \a obj from \a swag
+ */
void *xbt_swag_remove(void *obj, xbt_swag_t swag)
{
size_t offset = swag->offset;
return obj;
}
+/**
+ * \param swag a swag
+ * \return an object from the \a swag
+ */
void *xbt_swag_extract(xbt_swag_t swag)
{
size_t offset = swag->offset;
return obj;
}
-
+/**
+ * \param swag a swag
+ * \return the number of objects in \a swag
+ */
int xbt_swag_size(xbt_swag_t swag)
{
return (swag->count);
}
+/**
+ * \param obj an object
+ * \param swag a swag
+ * \return 1 if \a obj is in the \a swag and 0 otherwise
+ */
int xbt_swag_belongs(void *obj, xbt_swag_t swag)
{
return ((NEXT(obj, swag->offset)) || (PREV(obj, swag->offset))
|| (swag->head == obj));
}
+/*@}*/