Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change the directory to the directory defined by the variable teshexample_dir. If...
[simgrid.git] / tools / tesh2 / include / context.h
1 /*\r
2  * include/contex.h - type representing the context execution of a command.\r
3  *\r
4  * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved. \r
5  *\r
6  * This program is free software; you can redistribute it and/or modify it \r
7  * under the terms of the license (GNU LGPL) which comes with this package.\r
8  *\r
9  * Purpose:\r
10  *              This file contains all the declarations of the functions related with\r
11  *              the tesh context type.\r
12  *\r
13  */\r
14  \r
15 #ifndef _CONTEXT_H\r
16 #define _CONTEXT_H\r
17 \r
18 #include <com.h>\r
19 \r
20 #ifdef __cplusplus\r
21 extern "C" {\r
22 #endif\r
23 \r
24 /*! \brief create_new - create a new context.\r
25  *\r
26  * \return                      If successful the function returns the newly created\r
27  *                                      command. Otherwise the function returns NULL and sets the\r
28  *                                      global variable errno with the appropiate error code.\r
29  *                                      [ENOMEM] if the system has not enough space to allocate\r
30  *                                               the context.\r
31  */\r
32 context_t\r
33 context_new(void);\r
34 \r
35 /*! \brief context_free - destroy a context object.\r
36  *\r
37  * \param ptr           A pointer to the context object to destroy.\r
38  *\r
39  * \return                      If successful the function returns the 0. Otherwise \r
40  *                                      the function returns -1 and sets the global variable \r
41  *                                      errno with the appropiate error code.\r
42  *\r
43  * errors :\r
44  *                                      [EINVAL] if the context object pointed to by the ptr parameter is invalid.\r
45  *                                      \r
46  */\r
47 int\r
48 context_free(context_t* ptr);\r
49 \r
50 /*! \brief context_dup - duplicate a context object.\r
51  *\r
52  * \param context       The context to duplicate.\r
53  *\r
54  * \return                      If successful the function returns the duplicate. Otherwise \r
55  *                                      the function returns NULL and sets the global variable \r
56  *                                      errno with the appropiate error code.\r
57  *\r
58  * errors :\r
59  *                                      [EINVAL] if the parameter is invalid.\r
60  *                                      [ENOMEM] if there is not enough memory to allocate the duplicate.\r
61  *                                      \r
62  */\r
63 context_t\r
64 context_dup(context_t context);\r
65 \r
66 \r
67 /*! \brief context_reset - reset a context object.\r
68  *\r
69  * \param context       The context to reset.\r
70  *\r
71  * \return                      If successful the function returns 0. Otherwise \r
72  *                                      the function returns -1 and sets the global variable \r
73  *                                      errno with the appropiate error code.\r
74  *\r
75  * errors :\r
76  *                                      [EINVAL] if the parameter is invalid.\r
77  *                                      \r
78  */\r
79 int\r
80 context_reset(context_t context);\r
81 \r
82 void\r
83 context_clear(context_t context);\r
84 \r
85 void\r
86 context_input_write(context_t context, const char* buffer);\r
87 \r
88 void\r
89 context_ouput_read(context_t context, const char* buffer);\r
90 \r
91 \r
92 \r
93 #ifdef __cplusplus\r
94 extern }\r
95 #endif\r
96 \r
97 #endif /* !_CONTEXT_H */\r