Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the use of logs in unit testing of parmap to fix supernovae
[simgrid.git] / tools / tesh2 / include / fstream.h
index 4c1c0fc..2183b21 100644 (file)
-#ifndef __FSTREAM_H
-#define __FSTREAM_H
-
-#include <com.h>
-
-#ifdef __cplusplus
+/*\r
+ * include/fstream.h - type representing the file stream used to manage the tesh files.\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 fstream type.\r
+ *\r
+ */  \r
+#ifndef __FSTREAM_H\r
+#define __FSTREAM_H\r
+    \r
+#include <com.h>\r
+    \r
+#ifdef __cplusplus\r
 extern "C" {
-#endif
-
-fstream_t
-fstream_new(const char* directory, const char* name);
-
-int
-fstream_open(fstream_t fstream);
-
-int
-fstream_close(fstream_t fstream);
-
-int
-fstream_free(void** fstreamptr);
-
-void
-fstream_parse(fstream_t fstream, unit_t unit, xbt_os_mutex_t mutex);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*! __FSTREAM_H */
+  \r
+#endif  /* \r */
+  \r
+/*! \brief fstream_new - create a new fstream.\r
+ *\r
+ * \param directory    The directory of the tesh file.\r
+ * \param name         The name of the tesh file.\r
+ *\r
+ * \return                     If successful the function returns the newly created\r
+ *                                     unit. Otherwise the function returns NULL and sets the\r
+ *                                     global variable errno with the appropiate error code.\r
+ * remarks:\r
+ *                                     If the parameter directory is NULL, the parameter name\r
+ *                                     must be `stdin`.\r
+ *\r
+ * errors :\r
+ *                                     [EINVAL] if one of the parameters is invalid.\r
+ *                                     [ENOMEM] if the system has not enough space to allocate\r
+ *                                              the file stream.\r
+ */ \r
+  fstream_t \r fstream_new(const char *directory, const char *name);
+  \r\r
+/*! \brief fstream_open - open a file stream object.\r
+ *\r
+ * \param fstream      The file stream to open.\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 fstream parameter is invalid.\r
+ *                                     [EALREADY] if the file stream is already opened.\r
+ *                                     \r
+ *                                     This function may also fail and set errno for any of \r
+ *                                     the errors specified for the function fopen.                    \r
+ */ \r
+  int \r fstream_open(fstream_t fstream);
+  \r \r
+/*! \brief fstream_close - close a file stream object.\r
+ *\r
+ * \param fstream      The file stream to close.\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 fstream parameter is invalid.\r
+ *                                     [EBADF] if the stream is not opened.\r
+ *                                     \r
+ *                                     \r
+ *                                     This function may also fail and set errno for any of \r
+ *                                     the errors specified for the function fclose.                   \r
+ */ \r
+  int \r fstream_close(fstream_t fstream);
+  \r \r
+/*! \brief fstream_free - destroy a file stream object.\r
+ *\r
+ * \param ptr          A pointer to the file stream 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 fstream object pointed to by the parameter ptr is invalid.\r
+ *                                     \r
+ *                                     \r
+ *                                     This function may also fail and set errno for any of \r
+ *                                     the errors specified for the function fclose.\r
+ *\r
+ * remarks :\r
+ *                                     Il the file stream object is opened the function close it\r
+ *                                     before its destruction.                         \r
+ */ \r
+  int \r fstream_free(fstream_t * ptr);
+  \r \r int \r fstream_parse(fstream_t fstream, xbt_os_mutex_t mutex);
+  \r \r void \r
+      fstream_lex_line(fstream_t fstream, context_t context,
+                       xbt_os_mutex_t mutex, const char *filepos,
+                       char *line);
+  \r\rvoid \r fstream_process_token(fstream_t fstream, context_t context,
+                                 xbt_os_mutex_t mutex, const char *filepos,
+                                 char token, char *line);
+  \r\rvoid \r fstream_handle_include(fstream_t fstream, context_t context,
+                                  xbt_os_mutex_t mutex,
+                                  const char *file_name,
+                                  const char *description);
+  \r\rvoid \r fstream_handle_suite(fstream_t fstream, const char *description,
+                                const char *filepos);
+  \r\rint \r fstream_launch_command(fstream_t fstream, context_t context,
+                                 xbt_os_mutex_t mutex);
+  \r \r long fstream_getline(fstream_t fstream, char **buf, size_t * n);
+  \r\r
+#ifdef __cplusplus\r
+} \r
+#endif  /* \r */
+\r\r
+#endif  /*! __FSTREAM_H */\r