ScummVM API documentation
sqstdio.h
1 /* see copyright notice in squirrel.h */
2 #ifndef _SQSTDIO_H_
3 #define _SQSTDIO_H_
4 
5 #ifdef __cplusplus
6 
7 #define SQSTD_STREAM_TYPE_TAG 0x80000000
8 
9 struct SQStream {
10  virtual ~SQStream() {}
11  virtual SQInteger Read(void *buffer, SQInteger size) = 0;
12  virtual SQInteger Write(void *buffer, SQInteger size) = 0;
13  virtual SQInteger Flush() = 0;
14  virtual SQInteger Tell() = 0;
15  virtual SQInteger Len() = 0;
16  virtual SQInteger Seek(SQInteger offset, SQInteger origin) = 0;
17  virtual bool IsValid() = 0;
18  virtual bool EOS() = 0;
19 };
20 
21 extern "C" {
22 #endif
23 
24 #define SQ_SEEK_CUR 0
25 #define SQ_SEEK_END 1
26 #define SQ_SEEK_SET 2
27 
28 typedef void* SQFILE;
29 
30 SQUIRREL_API SQFILE sqstd_fopen(const SQChar *,const SQChar *);
31 SQUIRREL_API SQInteger sqstd_fread(SQUserPointer, SQInteger, SQInteger, SQFILE);
32 SQUIRREL_API SQInteger sqstd_fwrite(const SQUserPointer, SQInteger, SQInteger, SQFILE);
33 SQUIRREL_API SQInteger sqstd_fseek(SQFILE , SQInteger , SQInteger);
34 SQUIRREL_API SQInteger sqstd_ftell(SQFILE);
35 SQUIRREL_API SQInteger sqstd_fflush(SQFILE);
36 SQUIRREL_API SQInteger sqstd_fclose(SQFILE);
37 SQUIRREL_API SQInteger sqstd_feof(SQFILE);
38 
39 SQUIRREL_API SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own);
40 SQUIRREL_API SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file);
41 
42 //compiler helpers
43 SQUIRREL_API SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror);
44 SQUIRREL_API SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror);
45 SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename);
46 
47 SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v);
48 
49 #ifdef __cplusplus
50 } /*extern "C"*/
51 #endif
52 
53 #endif /*_SQSTDIO_H_*/
54 
Definition: sqvm.h:33