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
24 /*! \brief fstream_new - create a new fstream.
\r
26 * \param directory The directory of the tesh file.
\r
27 * \param name The name of the tesh file.
\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
33 * If the parameter directory is NULL, the parameter name
\r
37 * [EINVAL] if one of the parameters is invalid.
\r
38 * [ENOMEM] if the system has not enough space to allocate
\r
41 fstream_t
\r fstream_new(const char *directory, const char *name);
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
58 int
\r fstream_open(fstream_t fstream);
60 /*! \brief fstream_close - close a file stream object.
\r
62 * \param fstream The file stream to close.
\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
69 * [EINVAL] if the fstream parameter is invalid.
\r
70 * [EBADF] if the stream is not opened.
\r
73 * This function may also fail and set errno for any of
\r
74 * the errors specified for the function fclose.
\r
76 int
\r fstream_close(fstream_t fstream);
78 /*! \brief fstream_free - destroy a file stream object.
\r
80 * \param ptr A pointer to the file stream object to destroy.
\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
87 * [EINVAL] if the fstream object pointed to by the parameter ptr is invalid.
\r
90 * This function may also fail and set errno for any of
\r
91 * the errors specified for the function fclose.
\r
94 * Il the file stream object is opened the function close it
\r
95 * before its destruction.
\r
97 int
\r fstream_free(fstream_t * ptr);
98 \r \r int
\r fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex);
100 fstream_lex_line(fstream_t fstream, context_t context,
101 xbt_os_mutex_t mutex, const char *filepos,
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);
120 #endif /*! __FSTREAM_H */
\r