added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / libs / lib3ds / io.h
1 /* -*- c -*- */
2 #ifndef INCLUDED_LIB3DS_IO_H
3 #define INCLUDED_LIB3DS_IO_H
4 /*
5  * The 3D Studio File Format Library
6  * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
7  * All rights reserved.
8  *
9  * This program is  free  software;  you can redistribute it and/or modify it
10  * under the terms of the  GNU Lesser General Public License  as published by 
11  * the  Free Software Foundation;  either version 2.1 of the License,  or (at 
12  * your option) any later version.
13  *
14  * This  program  is  distributed in  the  hope that it will  be useful,  but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public  
17  * License for more details.
18  *
19  * You should  have received  a copy of the GNU Lesser General Public License
20  * along with  this program;  if not, write to the  Free Software Foundation,
21  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id: io.h,v 1.3 2004/12/31 16:17:15 reed Exp $
24  */
25
26 #ifndef INCLUDED_LIB3DS_TYPES_H
27 #include <lib3ds/types.h>
28 #endif
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 typedef enum _Lib3dsIoSeek {
35   LIB3DS_SEEK_SET  =0,
36   LIB3DS_SEEK_CUR  =1,
37   LIB3DS_SEEK_END  =2
38 } Lib3dsIoSeek;
39   
40 typedef Lib3dsBool (*Lib3dsIoErrorFunc)(void *self);
41 typedef long (*Lib3dsIoSeekFunc)(void *self, long offset, Lib3dsIoSeek origin);
42 typedef long (*Lib3dsIoTellFunc)(void *self);
43 typedef int (*Lib3dsIoReadFunc)(void *self, Lib3dsByte *buffer, int size);
44 typedef int (*Lib3dsIoWriteFunc)(void *self, const Lib3dsByte *buffer, int size);
45
46 extern LIB3DSAPI Lib3dsIo* lib3ds_io_new(void *self, Lib3dsIoErrorFunc error_func,
47   Lib3dsIoSeekFunc seek_func, Lib3dsIoTellFunc tell_func,
48   Lib3dsIoReadFunc read_func, Lib3dsIoWriteFunc write_func);
49 extern LIB3DSAPI void lib3ds_io_free(Lib3dsIo *io);
50 extern LIB3DSAPI Lib3dsBool lib3ds_io_error(Lib3dsIo *io);
51 extern LIB3DSAPI long lib3ds_io_seek(Lib3dsIo *io, long offset, Lib3dsIoSeek origin);
52 extern LIB3DSAPI long lib3ds_io_tell(Lib3dsIo *io);
53 extern LIB3DSAPI int lib3ds_io_read(Lib3dsIo *io, Lib3dsByte *buffer, int size);
54 extern LIB3DSAPI int lib3ds_io_write(Lib3dsIo *io, const Lib3dsByte *buffer, int size);
55
56 extern LIB3DSAPI Lib3dsByte lib3ds_io_read_byte(Lib3dsIo *io);
57 extern LIB3DSAPI Lib3dsWord lib3ds_io_read_word(Lib3dsIo *io);
58 extern LIB3DSAPI Lib3dsDword lib3ds_io_read_dword(Lib3dsIo *io);
59 extern LIB3DSAPI Lib3dsIntb lib3ds_io_read_intb(Lib3dsIo *io);
60 extern LIB3DSAPI Lib3dsIntw lib3ds_io_read_intw(Lib3dsIo *io);
61 extern LIB3DSAPI Lib3dsIntd lib3ds_io_read_intd(Lib3dsIo *io);
62 extern LIB3DSAPI Lib3dsFloat lib3ds_io_read_float(Lib3dsIo *io);
63 extern LIB3DSAPI Lib3dsBool lib3ds_io_read_vector(Lib3dsIo *io, Lib3dsVector v);
64 extern LIB3DSAPI Lib3dsBool lib3ds_io_read_rgb(Lib3dsIo *io, Lib3dsRgb rgb);
65 extern LIB3DSAPI Lib3dsBool lib3ds_io_read_string(Lib3dsIo *io, char *s, int buflen);
66
67 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_byte(Lib3dsIo *io, Lib3dsByte b);
68 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_word(Lib3dsIo *io, Lib3dsWord w);
69 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_dword(Lib3dsIo *io, Lib3dsDword d);
70 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_intb(Lib3dsIo *io, Lib3dsIntb b);
71 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_intw(Lib3dsIo *io, Lib3dsIntw w);
72 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_intd(Lib3dsIo *io, Lib3dsIntd d);
73 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_float(Lib3dsIo *io, Lib3dsFloat l);
74 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_vector(Lib3dsIo *io, Lib3dsVector v);
75 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_rgb(Lib3dsIo *io, Lib3dsRgb rgb);
76 extern LIB3DSAPI Lib3dsBool lib3ds_io_write_string(Lib3dsIo *io, const char *s);
77
78 #ifdef __cplusplus
79 }
80 #endif
81 #endif
82