Added support for specification of staticrank for grs-class of filters.
[idzebra-moved-to-github.git] / include / idzebra / bfile.h
index 91630d8..6369f4c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: bfile.h,v 1.7 2006-05-05 09:14:02 adam Exp $
+/* $Id: bfile.h,v 1.12 2006-11-14 08:12:07 adam Exp $
    Copyright (C) 1995-2006
    Index Data ApS
 
    Copyright (C) 1995-2006
    Index Data ApS
 
@@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra.  If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 */
 
 /** \file bfile.h
 */
 
 /** \file bfile.h
@@ -60,32 +60,40 @@ BFiles bfs_create (const char *spec, const char *base);
 */
 void bfs_destroy (BFiles bfiles);
 
 */
 void bfs_destroy (BFiles bfiles);
 
+/** \brief closes a Block file (may call exit)
+    \param bf block file
+ */
+YAZ_EXPORT
+void bf_close(BFile bf);
+
 /** \brief closes a Block file
     \param bf block file
 /** \brief closes a Block file
     \param bf block file
+    \retval 0 success
+    \retval -1 failure
  */
 YAZ_EXPORT
  */
 YAZ_EXPORT
-int bf_close (BFile bf);
+int bf_close2(BFile bf);
 
 /** \brief closes an extended Block file handle..
     \param bf extended block file opened with bf_xopen
     \param version version to be put in a file
     \param more_info more information to be stored in file (header)
 
 /** \brief closes an extended Block file handle..
     \param bf extended block file opened with bf_xopen
     \param version version to be put in a file
     \param more_info more information to be stored in file (header)
-    \retval 0 succes
+    \retval 0 success
     \retval -1 failure (can never happen as the code is now)
 */    
 YAZ_EXPORT
     \retval -1 failure (can never happen as the code is now)
 */    
 YAZ_EXPORT
-int bf_xclose (BFile bf, int version, const char *more_info);
+int bf_xclose(BFile bf, int version, const char *more_info);
 
 /** \brief opens and returns a Block file handle
     \param bfs block files
     \param name filename
     \param block_size block size in bytes
     \param wflag 1=opened for read&write, 0=read only
 
 /** \brief opens and returns a Block file handle
     \param bfs block files
     \param name filename
     \param block_size block size in bytes
     \param wflag 1=opened for read&write, 0=read only
-    \retval 0 succes
+    \retval 0 success
     \retval -1 failure (can never happen as the code is now)
 */
 YAZ_EXPORT
     \retval -1 failure (can never happen as the code is now)
 */
 YAZ_EXPORT
-BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag);
+BFile bf_open(BFiles bfs, const char *name, int block_size, int wflag);
 
 /** \brief opens and returns an extended Block file handle
     \param bfs block files
 
 /** \brief opens and returns an extended Block file handle
     \param bfs block files
@@ -101,6 +109,18 @@ BFile bf_xopen(BFiles bfs, const char *name, int block_size, int wflag,
               const char *magic, int *read_version,
               const char **more_info);
 
               const char *magic, int *read_version,
               const char **more_info);
 
+/** \brief read from block file (may call exit)
+    \param bf block file handle
+    \param no block no (first block is 0, second is 1..)
+    \param offset offset within block to be read
+    \param nbytes number of bytes to read (0 for whole block)
+    \param buf raw bytes with content (at least nbytes of size)
+    \retval 1 whole block could be read
+    \retval 0 whole block could not be read
+ */
+YAZ_EXPORT
+int bf_read(BFile bf, zint no, int offset, int nbytes, void *buf);
+
 /** \brief read from block file
     \param bf block file handle
     \param no block no (first block is 0, second is 1..)
 /** \brief read from block file
     \param bf block file handle
     \param no block no (first block is 0, second is 1..)
@@ -109,9 +129,27 @@ BFile bf_xopen(BFiles bfs, const char *name, int block_size, int wflag,
     \param buf raw bytes with content (at least nbytes of size)
     \retval 1 whole block could be read
     \retval 0 whole block could not be read
     \param buf raw bytes with content (at least nbytes of size)
     \retval 1 whole block could be read
     \retval 0 whole block could not be read
+    \retval -1 error
+ */
+YAZ_EXPORT
+int bf_read2(BFile bf, zint no, int offset, int nbytes, void *buf)
+    ZEBRA_GCC_ATTR((warn_unused_result));
+
+
+/** \brief writes block of bytes to file (may call exit)
+    \param bf block file handle
+    \param no block no
+    \param offset within block
+    \param nbytes number of bytes to write
+    \param buf buffer to write
+    \retval 0 success (block could be written)
+
+    This function can not return a failure. System calls exit(1)
+    if write failed.
  */
 YAZ_EXPORT
  */
 YAZ_EXPORT
-int bf_read (BFile bf, zint no, int offset, int nbytes, void *buf);
+int bf_write(BFile bf, zint no, int offset, int nbytes, const void *buf);
+
 
 /** \brief writes block of bytes to file
     \param bf block file handle
 
 /** \brief writes block of bytes to file
     \param bf block file handle
@@ -119,13 +157,15 @@ int bf_read (BFile bf, zint no, int offset, int nbytes, void *buf);
     \param offset within block
     \param nbytes number of bytes to write
     \param buf buffer to write
     \param offset within block
     \param nbytes number of bytes to write
     \param buf buffer to write
-    \retval 0 succes (block could be written)
+    \retval 0 success (block written)
+    \retval -1 error
 
     This function can not return a failure. System calls exit(1)
     if write failed.
  */
 YAZ_EXPORT
 
     This function can not return a failure. System calls exit(1)
     if write failed.
  */
 YAZ_EXPORT
-int bf_write (BFile bf, zint no, int offset, int nbytes, const void *buf);
+int bf_write2(BFile bf, zint no, int offset, int nbytes, const void *buf)
+    ZEBRA_GCC_ATTR((warn_unused_result));
 
 /** \brief enables or disables shadow for block files
     \param bfs block files
 
 /** \brief enables or disables shadow for block files
     \param bfs block files
@@ -148,7 +188,7 @@ int bf_commitExists (BFiles bfs);
     \param bfs block files
 */
 YAZ_EXPORT
     \param bfs block files
 */
 YAZ_EXPORT
-void bf_commitExec (BFiles bfs);
+int bf_commitExec (BFiles bfs) ZEBRA_GCC_ATTR((warn_unused_result));
 
 /** \brief Cleans shadow files (remove them)
     \param bfs block files
 
 /** \brief Cleans shadow files (remove them)
     \param bfs block files
@@ -194,7 +234,8 @@ int bf_free(BFile bf, int no, const zint *blocks);
    Note that if a register area has unlimited size, that is represented
    as max_bytes = -1.
 
    Note that if a register area has unlimited size, that is represented
    as max_bytes = -1.
 
-*/ 
+*/
+YAZ_EXPORT
 int bfs_register_directory_stat(BFiles bfs, int no, const char **directory,
                                double *used_bytes, double *max_bytes);
 
 int bfs_register_directory_stat(BFiles bfs, int no, const char **directory,
                                double *used_bytes, double *max_bytes);
 
@@ -212,9 +253,18 @@ int bfs_register_directory_stat(BFiles bfs, int no, const char **directory,
    Note that if a shadow area has unlimited size, that is represented
    as max_bytes = -1.
 */ 
    Note that if a shadow area has unlimited size, that is represented
    as max_bytes = -1.
 */ 
+YAZ_EXPORT
 int bfs_shadow_directory_stat(BFiles bfs, int no, const char **directory,
                              double *used_bytes, double *max_bytes);
 
 YAZ_END_CDECL
 
 #endif
 int bfs_shadow_directory_stat(BFiles bfs, int no, const char **directory,
                              double *used_bytes, double *max_bytes);
 
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+