Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add the new integrated files version (use xbt data structures instead my own data...
[simgrid.git] / tools / tesh2 / include / context.h
diff --git a/tools/tesh2/include/context.h b/tools/tesh2/include/context.h
new file mode 100644 (file)
index 0000000..a20fb83
--- /dev/null
@@ -0,0 +1,97 @@
+/*\r
+ * include/contex.h - type representing the context execution of a command.\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 context type.\r
+ *\r
+ */\r
\r
+#ifndef _CONTEXT_H\r
+#define _CONTEXT_H\r
+\r
+#include <com.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*! \brief create_new - create a new context.\r
+ *\r
+ * \return                     If successful the function returns the newly created\r
+ *                                     command. Otherwise the function returns NULL and sets the\r
+ *                                     global variable errno with the appropiate error code.\r
+ *                                     [ENOMEM] if the system has not enough space to allocate\r
+ *                                              the context.\r
+ */\r
+context_t\r
+context_new(void);\r
+\r
+/*! \brief context_free - destroy a context object.\r
+ *\r
+ * \param ptr          A pointer to the context object to destroy.\r
+ *\r
+ * \return                     If successful the function returns the 0. Otherwise \r
+ *                                     the function returns -1 and sets the global variable \r
+ *                                     errno with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the context object pointed to by the ptr parameter is invalid.\r
+ *                                     \r
+ */\r
+int\r
+context_free(context_t* ptr);\r
+\r
+/*! \brief context_dup - duplicate a context object.\r
+ *\r
+ * \param context      The context to duplicate.\r
+ *\r
+ * \return                     If successful the function returns the duplicate. Otherwise \r
+ *                                     the function returns NULL and sets the global variable \r
+ *                                     errno with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the parameter is invalid.\r
+ *                                     [ENOMEM] if there is not enough memory to allocate the duplicate.\r
+ *                                     \r
+ */\r
+context_t\r
+context_dup(context_t context);\r
+\r
+\r
+/*! \brief context_reset - reset a context object.\r
+ *\r
+ * \param context      The context to reset.\r
+ *\r
+ * \return                     If successful the function returns 0. Otherwise \r
+ *                                     the function returns -1 and sets the global variable \r
+ *                                     errno with the appropiate error code.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if the parameter is invalid.\r
+ *                                     \r
+ */\r
+int\r
+context_reset(context_t context);\r
+\r
+void\r
+context_clear(context_t context);\r
+\r
+void\r
+context_input_write(context_t context, const char* buffer);\r
+\r
+void\r
+context_ouput_read(context_t context, const char* buffer);\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern }\r
+#endif\r
+\r
+#endif /* !_CONTEXT_H */\r