The Squirrel interpreter. See http://www.squirrel-lang.org/
include/sqstdio.h@3:7268a3ceaffc, 2014-12-16 (annotated)
- Committer:
- jhnwkmn
- Date:
- Tue Dec 16 11:39:42 2014 +0000
- Revision:
- 3:7268a3ceaffc
- Parent:
- 0:97a4f8cc534c
Accepts \r as line terminator as well.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhnwkmn | 0:97a4f8cc534c | 1 | /* see copyright notice in squirrel.h */ |
jhnwkmn | 0:97a4f8cc534c | 2 | #ifndef _SQSTDIO_H_ |
jhnwkmn | 0:97a4f8cc534c | 3 | #define _SQSTDIO_H_ |
jhnwkmn | 0:97a4f8cc534c | 4 | |
jhnwkmn | 0:97a4f8cc534c | 5 | #ifdef __cplusplus |
jhnwkmn | 0:97a4f8cc534c | 6 | |
jhnwkmn | 0:97a4f8cc534c | 7 | #define SQSTD_STREAM_TYPE_TAG 0x80000000 |
jhnwkmn | 0:97a4f8cc534c | 8 | |
jhnwkmn | 0:97a4f8cc534c | 9 | struct SQStream { |
jhnwkmn | 0:97a4f8cc534c | 10 | virtual SQInteger Read(void *buffer, SQInteger size) = 0; |
jhnwkmn | 0:97a4f8cc534c | 11 | virtual SQInteger Write(void *buffer, SQInteger size) = 0; |
jhnwkmn | 0:97a4f8cc534c | 12 | virtual SQInteger Flush() = 0; |
jhnwkmn | 0:97a4f8cc534c | 13 | virtual SQInteger Tell() = 0; |
jhnwkmn | 0:97a4f8cc534c | 14 | virtual SQInteger Len() = 0; |
jhnwkmn | 0:97a4f8cc534c | 15 | virtual SQInteger Seek(SQInteger offset, SQInteger origin) = 0; |
jhnwkmn | 0:97a4f8cc534c | 16 | virtual bool IsValid() = 0; |
jhnwkmn | 0:97a4f8cc534c | 17 | virtual bool EOS() = 0; |
jhnwkmn | 0:97a4f8cc534c | 18 | }; |
jhnwkmn | 0:97a4f8cc534c | 19 | |
jhnwkmn | 0:97a4f8cc534c | 20 | extern "C" { |
jhnwkmn | 0:97a4f8cc534c | 21 | #endif |
jhnwkmn | 0:97a4f8cc534c | 22 | |
jhnwkmn | 0:97a4f8cc534c | 23 | #define SQ_SEEK_CUR 0 |
jhnwkmn | 0:97a4f8cc534c | 24 | #define SQ_SEEK_END 1 |
jhnwkmn | 0:97a4f8cc534c | 25 | #define SQ_SEEK_SET 2 |
jhnwkmn | 0:97a4f8cc534c | 26 | |
jhnwkmn | 0:97a4f8cc534c | 27 | typedef void* SQFILE; |
jhnwkmn | 0:97a4f8cc534c | 28 | |
jhnwkmn | 0:97a4f8cc534c | 29 | SQUIRREL_API SQFILE sqstd_fopen(const SQChar *,const SQChar *); |
jhnwkmn | 0:97a4f8cc534c | 30 | SQUIRREL_API SQInteger sqstd_fread(SQUserPointer, SQInteger, SQInteger, SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 31 | SQUIRREL_API SQInteger sqstd_fwrite(const SQUserPointer, SQInteger, SQInteger, SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 32 | SQUIRREL_API SQInteger sqstd_fseek(SQFILE , SQInteger , SQInteger); |
jhnwkmn | 0:97a4f8cc534c | 33 | SQUIRREL_API SQInteger sqstd_ftell(SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 34 | SQUIRREL_API SQInteger sqstd_fflush(SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 35 | SQUIRREL_API SQInteger sqstd_fclose(SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 36 | SQUIRREL_API SQInteger sqstd_feof(SQFILE); |
jhnwkmn | 0:97a4f8cc534c | 37 | |
jhnwkmn | 0:97a4f8cc534c | 38 | SQUIRREL_API SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own); |
jhnwkmn | 0:97a4f8cc534c | 39 | SQUIRREL_API SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file); |
jhnwkmn | 0:97a4f8cc534c | 40 | |
jhnwkmn | 0:97a4f8cc534c | 41 | //compiler helpers |
jhnwkmn | 0:97a4f8cc534c | 42 | SQUIRREL_API SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror); |
jhnwkmn | 0:97a4f8cc534c | 43 | SQUIRREL_API SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror); |
jhnwkmn | 0:97a4f8cc534c | 44 | SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename); |
jhnwkmn | 0:97a4f8cc534c | 45 | |
jhnwkmn | 0:97a4f8cc534c | 46 | SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v); |
jhnwkmn | 0:97a4f8cc534c | 47 | |
jhnwkmn | 0:97a4f8cc534c | 48 | #ifdef __cplusplus |
jhnwkmn | 0:97a4f8cc534c | 49 | } /*extern "C"*/ |
jhnwkmn | 0:97a4f8cc534c | 50 | #endif |
jhnwkmn | 0:97a4f8cc534c | 51 | |
jhnwkmn | 0:97a4f8cc534c | 52 | #endif /*_SQSTDIO_H_*/ |
jhnwkmn | 0:97a4f8cc534c | 53 |