2 * include/fstream.h - type representing the file stream used to manage the tesh files.
\r
4 * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved.
\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
10 * This file contains all the declarations of the functions related with
\r
11 * the tesh fstream type.
\r
23 /*! \brief fstream_new - create a new fstream.
\r
25 * \param directory The directory of the tesh file.
\r
26 * \param name The name of the tesh file.
\r
28 * \return If successful the function returns the newly created
\r
29 * unit. Otherwise the function returns NULL and sets the
\r
30 * global variable errno with the appropiate error code.
\r
32 * If the parameter directory is NULL, the parameter name
\r
36 * [EINVAL] if one of the parameters is invalid.
\r
37 * [ENOMEM] if the system has not enough space to allocate
\r
41 fstream_new(const char* directory, const char* name);
\r
43 /*! \brief fstream_open - open a file stream object.
\r
45 * \param fstream The file stream to open.
\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
52 * [EINVAL] if the fstream parameter is invalid.
\r
53 * [EALREADY] if the file stream is already opened.
\r
55 * This function may also fail and set errno for any of
\r
56 * the errors specified for the function fopen.
\r
59 fstream_open(fstream_t fstream);
\r
61 /*! \brief fstream_close - close a file stream object.
\r
63 * \param fstream The file stream to close.
\r
65 * \return If successful the function returns the 0. Otherwise
\r
66 * the function returns -1 and sets the global variable
\r
67 * errno with the appropiate error code.
\r
70 * [EINVAL] if the fstream parameter is invalid.
\r
71 * [EBADF] if the stream is not opened.
\r
74 * This function may also fail and set errno for any of
\r
75 * the errors specified for the function fclose.
\r
78 fstream_close(fstream_t fstream);
\r
80 /*! \brief fstream_free - destroy a file stream object.
\r
82 * \param ptr A pointer to the file stream object to destroy.
\r
84 * \return If successful the function returns the 0. Otherwise
\r
85 * the function returns -1 and sets the global variable
\r
86 * errno with the appropiate error code.
\r
89 * [EINVAL] if the fstream object pointed to by the parameter ptr is invalid.
\r
92 * This function may also fail and set errno for any of
\r
93 * the errors specified for the function fclose.
\r
96 * Il the file stream object is opened the function close it
\r
97 * before its destruction.
\r
100 fstream_free(fstream_t* ptr);
\r
103 fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex);
\r
106 fstream_lex_line(fstream_t fstream, context_t context, xbt_os_mutex_t mutex, const char * filepos, char *line);
\r
109 fstream_process_token(fstream_t fstream, context_t context, xbt_os_mutex_t mutex, const char* filepos, char token, char *line);
\r
112 fstream_handle_include(fstream_t fstream, context_t context, xbt_os_mutex_t mutex, const char* file_name, const char* description);
\r
115 fstream_handle_suite(fstream_t fstream, const char* description, const char* filepos);
\r
118 fstream_launch_command(fstream_t fstream, context_t context, xbt_os_mutex_t mutex);
\r
120 long fstream_getline(fstream_t fstream, char **buf, size_t *n);
\r
127 #endif /*! __FSTREAM_H */
\r