# sqstdio.h

    00001 /*  see copyright notice in squirrel.h */
    00002 #ifndef _SQSTDIO_H_
    00003 #define _SQSTDIO_H_
    00004
    00005 #ifdef __cplusplus
    00006
    00007 #define SQSTD_STREAM_TYPE_TAG 0x80000000
    00008
    00009 struct SQStream {
    00010   virtual ~SQStream() {}
    00011   virtual SQInteger Read(void *buffer, SQInteger size) = 0;
    00012   virtual SQInteger Write(void *buffer, SQInteger size) = 0;
    00013   virtual SQInteger Flush() = 0;
    00014   virtual SQInteger Tell() = 0;
    00015   virtual SQInteger Len() = 0;
    00016   virtual SQInteger Seek(SQInteger offset, SQInteger origin) = 0;
    00017   virtual bool IsValid() = 0;
    00018   virtual bool EOS() = 0;
    00019 };
    00020
    00021 extern "C" {
    00022 #endif
    00023
    00024 #define SQ_SEEK_CUR 0
    00025 #define SQ_SEEK_END 1
    00026 #define SQ_SEEK_SET 2
    00027
    00028 typedef void* SQFILE;
    00029
    00030 SQUIRREL_API SQFILE sqstd_fopen(const SQChar *,const SQChar *);
    00031 SQUIRREL_API SQInteger sqstd_fread(SQUserPointer, SQInteger, SQInteger, SQFILE);
    00032 SQUIRREL_API SQInteger sqstd_fwrite(const SQUserPointer, SQInteger, SQInteger, SQFILE);
    00033 SQUIRREL_API SQInteger sqstd_fseek(SQFILE , SQInteger , SQInteger);
    00034 SQUIRREL_API SQInteger sqstd_ftell(SQFILE);
    00035 SQUIRREL_API SQInteger sqstd_fflush(SQFILE);
    00036 SQUIRREL_API SQInteger sqstd_fclose(SQFILE);
    00037 SQUIRREL_API SQInteger sqstd_feof(SQFILE);
    00038
    00039 SQUIRREL_API SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own);
    00040 SQUIRREL_API SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file);
    00041
    00042 //compiler helpers
    00043 SQUIRREL_API SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror);
    00044 SQUIRREL_API SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror);
    00045 SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename);
    00046
    00047 SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v);
    00048
    00049 #ifdef __cplusplus
    00050 } /*extern "C"*/
    00051 #endif
    00052
    00053 #endif /*_SQSTDIO_H_*/
    00054