1 /*********************************************************************
2   Blosc - Blocked Shuffling and Compression Library
3 
4   Copyright (C) 2021  The Blosc Developers <blosc@blosc.org>
5   https://blosc.org
6   License: BSD 3-Clause (see LICENSE.txt)
7 
8   See LICENSE.txt for details about copyright and rights to use.
9 **********************************************************************/
10 
11 
12 #ifndef BLOSC_BLOSC2_STDIO_H
13 #define BLOSC_BLOSC2_STDIO_H
14 
15 
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include "blosc2-export.h"
19 
20 
21 #if defined(_WIN32) && !defined(__MINGW32__)
22 
23 /* stdint.h only available in VS2010 (VC++ 16.0) and newer */
24    #if defined(_MSC_VER) && _MSC_VER < 1600
25      #include "win32/stdint-windows.h"
26    #else
27      #include <stdint.h>
28    #endif
29 
30 #else
31 #include <stdint.h>
32 #endif
33 
34 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
35 #include <io.h>
36 #else
37 #include <unistd.h>
38 #endif
39 
40 typedef struct {
41   FILE *file;
42 } blosc2_stdio_file;
43 
44 BLOSC_EXPORT void *blosc2_stdio_open(const char *urlpath, const char *mode, void* params);
45 BLOSC_EXPORT int blosc2_stdio_close(void *stream);
46 BLOSC_EXPORT int64_t blosc2_stdio_tell(void *stream);
47 BLOSC_EXPORT int blosc2_stdio_seek(void *stream, int64_t offset, int whence);
48 BLOSC_EXPORT int64_t blosc2_stdio_write(const void *ptr, int64_t size, int64_t nitems, void *stream);
49 BLOSC_EXPORT int64_t blosc2_stdio_read(void *ptr, int64_t size, int64_t nitems, void *stream);
50 BLOSC_EXPORT int blosc2_stdio_truncate(void *stream, int64_t size);
51 
52 #endif //BLOSC_BLOSC2_STDIO_H
53