Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert svn logs into ChangeLog (up to r7858 for now)
[simgrid.git] / tools / tesh2 / include / fstream.h
1 /*\r
2  * include/fstream.h - type representing the file stream used to manage the tesh files.\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 fstream type.\r
12  *\r
13  */  \r
14 #ifndef __FSTREAM_H\r
15 #define __FSTREAM_H\r
16     \r
17 #include <com.h>\r
18     \r
19 #ifdef __cplusplus\r
20 extern "C" {
21   \r
22 #endif  /* \r */
23   \r
24 /*! \brief fstream_new - create a new fstream.\r
25  *\r
26  * \param directory     The directory of the tesh file.\r
27  * \param name          The name of the tesh file.\r
28  *\r
29  * \return                      If successful the function returns the newly created\r
30  *                                      unit. Otherwise the function returns NULL and sets the\r
31  *                                      global variable errno with the appropiate error code.\r
32  * remarks:\r
33  *                                      If the parameter directory is NULL, the parameter name\r
34  *                                      must be `stdin`.\r
35  *\r
36  * errors :\r
37  *                                      [EINVAL] if one of the parameters is invalid.\r
38  *                                      [ENOMEM] if the system has not enough space to allocate\r
39  *                                               the file stream.\r
40  */ \r
41   fstream_t \r fstream_new(const char *directory, const char *name);
42   \r\r
43 /*! \brief fstream_open - open a file stream object.\r
44  *\r
45  * \param fstream       The file stream to open.\r
46  *\r
47  * \return                      If successful the function returns the 0. Otherwise \r
48  *                                      the function returns -1 and sets the global variable \r
49  *                                      errno with the appropiate error code.\r
50  *\r
51  * errors :\r
52  *                                      [EINVAL] if the fstream parameter is invalid.\r
53  *                                      [EALREADY] if the file stream is already opened.\r
54  *                                      \r
55  *                                      This function may also fail and set errno for any of \r
56  *                                      the errors specified for the function fopen.                    \r
57  */ \r
58   int \r fstream_open(fstream_t fstream);
59   \r \r
60 /*! \brief fstream_close - close a file stream object.\r
61  *\r
62  * \param fstream       The file stream to close.\r
63  *\r
64  * \return                      If successful the function returns the 0. Otherwise \r
65  *                                      the function returns -1 and sets the global variable \r
66  *                                      errno with the appropiate error code.\r
67  *\r
68  * errors :\r
69  *                                      [EINVAL] if the fstream parameter is invalid.\r
70  *                                      [EBADF] if the stream is not opened.\r
71  *                                      \r
72  *                                      \r
73  *                                      This function may also fail and set errno for any of \r
74  *                                      the errors specified for the function fclose.                   \r
75  */ \r
76   int \r fstream_close(fstream_t fstream);
77   \r \r
78 /*! \brief fstream_free - destroy a file stream object.\r
79  *\r
80  * \param ptr           A pointer to the file stream object to destroy.\r
81  *\r
82  * \return                      If successful the function returns the 0. Otherwise \r
83  *                                      the function returns -1 and sets the global variable \r
84  *                                      errno with the appropiate error code.\r
85  *\r
86  * errors :\r
87  *                                      [EINVAL] if the fstream object pointed to by the parameter ptr is invalid.\r
88  *                                      \r
89  *                                      \r
90  *                                      This function may also fail and set errno for any of \r
91  *                                      the errors specified for the function fclose.\r
92  *\r
93  * remarks :\r
94  *                                      Il the file stream object is opened the function close it\r
95  *                                      before its destruction.                         \r
96  */ \r
97   int \r fstream_free(fstream_t * ptr);
98   \r \r int \r fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex);
99   \r \r void \r
100       fstream_lex_line(fstream_t fstream, context_t context,
101                        xbt_os_mutex_t mutex, const char *filepos,
102                        char *line);
103   \r\rvoid \r fstream_process_token(fstream_t fstream, context_t context,
104                                  xbt_os_mutex_t mutex, const char *filepos,
105                                  char token, char *line);
106   \r\rvoid \r fstream_handle_include(fstream_t fstream, context_t context,
107                                   xbt_os_mutex_t mutex,
108                                   const char *file_name,
109                                   const char *description);
110   \r\rvoid \r fstream_handle_suite(fstream_t fstream, const char *description,
111                                 const char *filepos);
112   \r\rint \r fstream_launch_command(fstream_t fstream, context_t context,
113                                  xbt_os_mutex_t mutex);
114   \r \r long fstream_getline(fstream_t fstream, char **buf, size_t * n);
115   \r\r
116 #ifdef __cplusplus\r
117\r
118 #endif  /* \r */
119 \r\r
120 #endif  /*! __FSTREAM_H */\r