Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Document the new mkfile buildin command
[simgrid.git] / tools / tesh2 / include / unit.h
index 8f7ddbe..7b92ab7 100644 (file)
-#ifndef __UNIT_H       
-#define __UNIT_H
-
-#include <com.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-unit_t
-unit_new(runner_t runner, unit_t root, unit_t owner, fstream_t fstream);
-
-int
-unit_free(void** unitptr);
-
-
-int
-unit_reset(unit_t unit);
-
-void
-unit_run(unit_t unit, xbt_os_mutex_t mutex);
-
-void
-unit_interrupt(unit_t unit);
-
-void
-unit_verbose(unit_t unit);
-
-void
-unit_handle_failure(unit_t unit);
-
-void 
-unit_handle_line(unit_t unit, context_t context, xbt_os_mutex_t mutex, const char * filepos, char *line);
-
-void 
-unit_pushline(unit_t unit, context_t context, xbt_os_mutex_t mutex, const char* filepos, char kind, char *line);
-
-void
-unit_handle_include(unit_t unit, context_t context, xbt_os_mutex_t mutex, const char* file_name, const char* description);
-
-void
-unit_parse(unit_t unit, context_t context, xbt_os_mutex_t mutex, const char* file_name, FILE* stream);
-
-void
-unit_handle_suite(unit_t unit, context_t context, xbt_os_mutex_t mutex, const char* description);
-
-void 
-display_title(const char* description);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* !__UNIT_H */
+/*\r
+ * include/unit.h - type representing the tesh unit concept.\r
+ *\r
+ * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved. \r
+ *\r
+ * This program is free software; you can redistribute it and/or modify it \r
+ * under the terms of the license (GNU LGPL) which comes with this package.\r
+ *\r
+ * Purpose:\r
+ *             This file contains all the declarations of the functions related with\r
+ *             the tesh unit concept.\r
+ *\r
+ */\r
\r
+#ifndef __UNIT_H       \r
+#define __UNIT_H\r
+\r
+#include <com.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*! \brief unit_new - create a new unit.\r
+ *\r
+ * \param runner       The runner which runs the unit.\r
+ * \param owner                The unit which owns the unit if it is an included unit.\r
+ * \param fstream      The file stream object used to parse the unit.\r
+ *\r
+ * \return                     If successful the function returns the newly created\r
+ *                                     unit. Otherwise the function returns NULL and sets the\r
+ *                                     global variable errno with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if one of the parameters is invalid.\r
+ *                                     [ENOMEM] if the system has not enough space to allocate\r
+ *                                              the unit.\r
+ */\r
+unit_t\r
+unit_new(runner_t runner, unit_t root, unit_t owner, fstream_t fstream);\r
+\r
+/*! \brief unit_free - destroy a tesh unit.\r
+ *\r
+ * \param ptr          A pointer to the unit to destroy.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the pointer to the unit to destroy is invalid.\r
+ */\r
+int\r
+unit_free(unit_t* ptr);\r
+\r
+/*! \brief unit_run - run a tesh unit.\r
+ *\r
+ * \param unit         The unit to run.\r
+ * \param mutex                A mutex used to synchronize the access of the runner properties.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ *                                              if the mutex specified as parameter is invalid.\r
+ *\r
+ * remarks :           If the runner is interrupted during a call of this function,\r
+ *                                     the unit is not launched but its flag interrupted is signaled.\r
+ */\r
+int\r
+unit_run(unit_t unit, xbt_os_mutex_t mutex);\r
+\r
+\r
+/*! \brief unit_interrupt - interrupt a tesh unit.\r
+ *\r
+ * \param unit         The unit to interrupt.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ *                                     [EALREADY] if the unit is already interrupted.\r
+ *\r
+ * remarks :           If the runner is interrupted during a call of this function,\r
+ *                                     the unit is not launched but its flag interrupted is signaled.\r
+ */\r
+int\r
+unit_interrupt(unit_t unit);\r
+\r
+/*! \brief unit_summuarize - summarize the run of tesh unit.\r
+ *\r
+ * \param unit         The unit to summarize the run.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise the \r
+ *                                     function returns -1 and sets the global variable errno \r
+ *                                     with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the unit specified as parameter is invalid.\r
+ */\r
+int\r
+unit_summuarize(unit_t unit);\r
+\r
+int\r
+unit_reset(unit_t unit);\r
+\r
+void\r
+unit_set_error(unit_t unit, int errcode, int kind, const char* line);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* !__UNIT_H */\r