Code::Blocks  SVN r11506
Macros | Functions | Variables
sqstdstream.cpp File Reference
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <squirrel.h>
#include <sqstdio.h>
#include <sqstdblob.h>
#include "sqstdstream.h"
#include "sqstdblobimpl.h"
Include dependency graph for sqstdstream.cpp:

Go to the source code of this file.

Macros

#define SETUP_STREAM(v)
 
#define SAFE_READN(ptr, len)
 

Functions

SQInteger _stream_readblob (HSQUIRRELVM v)
 
SQInteger _stream_readn (HSQUIRRELVM v)
 
SQInteger _stream_writeblob (HSQUIRRELVM v)
 
SQInteger _stream_writen (HSQUIRRELVM v)
 
SQInteger _stream_seek (HSQUIRRELVM v)
 
SQInteger _stream_tell (HSQUIRRELVM v)
 
SQInteger _stream_len (HSQUIRRELVM v)
 
SQInteger _stream_flush (HSQUIRRELVM v)
 
SQInteger _stream_eos (HSQUIRRELVM v)
 
void init_streamclass (HSQUIRRELVM v)
 
SQRESULT declare_stream (HSQUIRRELVM v, const SQChar *name, SQUserPointer typetag, const SQChar *reg_name, SQRegFunction *methods, SQRegFunction *globals)
 

Variables

static SQRegFunction _stream_methods []
 

Macro Definition Documentation

◆ SAFE_READN

#define SAFE_READN (   ptr,
  len 
)
Value:
{ \
if(self->Read(ptr,len) != len) return sq_throwerror(v,_SC("io error")); \
}
SQRESULT sq_throwerror(HSQUIRRELVM v, const SQChar *err)
Definition: sqapi.cpp:918
const wxString ptr(_T("*"))

Definition at line 37 of file sqstdstream.cpp.

Referenced by _stream_readn().

◆ SETUP_STREAM

#define SETUP_STREAM (   v)
Value:
SQStream *self = NULL; \
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_STREAM_TYPE_TAG))) \
return sq_throwerror(v,_SC("invalid type tag")); \
if(!self->IsValid()) \
return sq_throwerror(v,_SC("the stream is invalid"));
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p, SQUserPointer typetag)
Definition: sqapi.cpp:647
SQRESULT sq_throwerror(HSQUIRRELVM v, const SQChar *err)
Definition: sqapi.cpp:918
#define NULL
Definition: prefix.cpp:59

Definition at line 12 of file sqstdstream.cpp.

Referenced by _stream_eos(), _stream_flush(), _stream_len(), _stream_readblob(), _stream_readn(), _stream_seek(), _stream_tell(), _stream_writeblob(), and _stream_writen().

Function Documentation

◆ _stream_eos()

SQInteger _stream_eos ( HSQUIRRELVM  v)

Definition at line 226 of file sqstdstream.cpp.

References SETUP_STREAM, sq_pushinteger(), and sq_pushnull().

◆ _stream_flush()

SQInteger _stream_flush ( HSQUIRRELVM  v)

Definition at line 216 of file sqstdstream.cpp.

References SETUP_STREAM, sq_pushinteger(), and sq_pushnull().

◆ _stream_len()

SQInteger _stream_len ( HSQUIRRELVM  v)

Definition at line 209 of file sqstdstream.cpp.

References SETUP_STREAM, and sq_pushinteger().

◆ _stream_readblob()

SQInteger _stream_readblob ( HSQUIRRELVM  v)

◆ _stream_readn()

SQInteger _stream_readn ( HSQUIRRELVM  v)

◆ _stream_seek()

SQInteger _stream_seek ( HSQUIRRELVM  v)

◆ _stream_tell()

SQInteger _stream_tell ( HSQUIRRELVM  v)

Definition at line 202 of file sqstdstream.cpp.

References SETUP_STREAM, and sq_pushinteger().

◆ _stream_writeblob()

SQInteger _stream_writeblob ( HSQUIRRELVM  v)

◆ _stream_writen()

SQInteger _stream_writen ( HSQUIRRELVM  v)

Definition at line 114 of file sqstdstream.cpp.

References SETUP_STREAM, sq_getfloat(), sq_getinteger(), and sq_throwerror().

◆ declare_stream()

SQRESULT declare_stream ( HSQUIRRELVM  v,
const SQChar name,
SQUserPointer  typetag,
const SQChar reg_name,
SQRegFunction *  methods,
SQRegFunction *  globals 
)

◆ init_streamclass()

void init_streamclass ( HSQUIRRELVM  v)

Variable Documentation

◆ _stream_methods

SQRegFunction _stream_methods[]
static
Initial value:
= {
_DECL_STREAM_FUNC(readblob,2,_SC("xn")),
_DECL_STREAM_FUNC(readn,2,_SC("xn")),
_DECL_STREAM_FUNC(writeblob,-2,_SC("xx")),
_DECL_STREAM_FUNC(writen,3,_SC("xnn")),
_DECL_STREAM_FUNC(seek,-2,_SC("xnn")),
_DECL_STREAM_FUNC(tell,1,_SC("x")),
_DECL_STREAM_FUNC(len,1,_SC("x")),
_DECL_STREAM_FUNC(eos,1,_SC("x")),
_DECL_STREAM_FUNC(flush,1,_SC("x")),
{0,0}
}

Definition at line 236 of file sqstdstream.cpp.

Referenced by init_streamclass().