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

Go to the source code of this file.

Macros

#define SQSTD_BLOB_TYPE_TAG   (SQSTD_STREAM_TYPE_TAG | 0x00000002)
 
#define SETUP_BLOB(v)
 
#define _DECL_BLOB_FUNC(name, nparams, typecheck)   {_SC(#name),_blob_##name,nparams,typecheck}
 
#define _DECL_GLOBALBLOB_FUNC(name, nparams, typecheck)   {_SC(#name),_g_blob_##name,nparams,typecheck}
 

Functions

static SQInteger _blob_resize (HSQUIRRELVM v)
 
static void __swap_dword (unsigned int *n)
 
static void __swap_word (unsigned short *n)
 
static SQInteger _blob_swap4 (HSQUIRRELVM v)
 
static SQInteger _blob_swap2 (HSQUIRRELVM v)
 
static SQInteger _blob__set (HSQUIRRELVM v)
 
static SQInteger _blob__get (HSQUIRRELVM v)
 
static SQInteger _blob__nexti (HSQUIRRELVM v)
 
static SQInteger _blob__typeof (HSQUIRRELVM v)
 
static SQInteger _blob_releasehook (SQUserPointer p, SQInteger)
 
static SQInteger _blob_constructor (HSQUIRRELVM v)
 
static SQInteger _g_blob_casti2f (HSQUIRRELVM v)
 
static SQInteger _g_blob_castf2i (HSQUIRRELVM v)
 
static SQInteger _g_blob_swap2 (HSQUIRRELVM v)
 
static SQInteger _g_blob_swap4 (HSQUIRRELVM v)
 
static SQInteger _g_blob_swapfloat (HSQUIRRELVM v)
 
SQRESULT sqstd_getblob (HSQUIRRELVM v, SQInteger idx, SQUserPointer *ptr)
 
SQInteger sqstd_getblobsize (HSQUIRRELVM v, SQInteger idx)
 
SQUserPointer sqstd_createblob (HSQUIRRELVM v, SQInteger size)
 
SQRESULT sqstd_register_bloblib (HSQUIRRELVM v)
 

Variables

static SQRegFunction _blob_methods []
 
static SQRegFunction bloblib_funcs []
 

Macro Definition Documentation

◆ _DECL_BLOB_FUNC

#define _DECL_BLOB_FUNC (   name,
  nparams,
  typecheck 
)    {_SC(#name),_blob_##name,nparams,typecheck}

Definition at line 140 of file sqstdblob.cpp.

◆ _DECL_GLOBALBLOB_FUNC

#define _DECL_GLOBALBLOB_FUNC (   name,
  nparams,
  typecheck 
)    {_SC(#name),_g_blob_##name,nparams,typecheck}

Definition at line 201 of file sqstdblob.cpp.

◆ SETUP_BLOB

#define SETUP_BLOB (   v)
Value:
SQBlob *self = NULL; \
{ if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_BLOB_TYPE_TAG))) \
return SQ_ERROR; }
SQRESULT sq_getinstanceup(HSQUIRRELVM v, SQInteger idx, SQUserPointer *p, SQUserPointer typetag)
Definition: sqapi.cpp:647
#define SQSTD_BLOB_TYPE_TAG
Definition: sqstdblob.cpp:10
#define NULL
Definition: prefix.cpp:59

Definition at line 15 of file sqstdblob.cpp.

Referenced by _blob__get(), _blob__nexti(), _blob__set(), _blob_resize(), _blob_swap2(), and _blob_swap4().

◆ SQSTD_BLOB_TYPE_TAG

#define SQSTD_BLOB_TYPE_TAG   (SQSTD_STREAM_TYPE_TAG | 0x00000002)

Function Documentation

◆ __swap_dword()

static void __swap_dword ( unsigned int *  n)
static

Definition at line 31 of file sqstdblob.cpp.

Referenced by _blob_swap4(), _g_blob_swap4(), and _g_blob_swapfloat().

◆ __swap_word()

static void __swap_word ( unsigned short *  n)
static

Definition at line 39 of file sqstdblob.cpp.

Referenced by _blob_swap2().

◆ _blob__get()

static SQInteger _blob__get ( HSQUIRRELVM  v)
static

Definition at line 79 of file sqstdblob.cpp.

References SETUP_BLOB, sq_getinteger(), sq_pushinteger(), and sq_throwerror().

◆ _blob__nexti()

static SQInteger _blob__nexti ( HSQUIRRELVM  v)
static

◆ _blob__set()

static SQInteger _blob__set ( HSQUIRRELVM  v)
static

Definition at line 66 of file sqstdblob.cpp.

References SETUP_BLOB, sq_getinteger(), sq_push(), and sq_throwerror().

◆ _blob__typeof()

static SQInteger _blob__typeof ( HSQUIRRELVM  v)
static

Definition at line 109 of file sqstdblob.cpp.

References sq_pushstring().

◆ _blob_constructor()

static SQInteger _blob_constructor ( HSQUIRRELVM  v)
static

◆ _blob_releasehook()

static SQInteger _blob_releasehook ( SQUserPointer  p,
SQInteger   
)
static

Definition at line 116 of file sqstdblob.cpp.

Referenced by _blob_constructor().

◆ _blob_resize()

static SQInteger _blob_resize ( HSQUIRRELVM  v)
static

Definition at line 21 of file sqstdblob.cpp.

References SETUP_BLOB, sq_getinteger(), and sq_throwerror().

◆ _blob_swap2()

static SQInteger _blob_swap2 ( HSQUIRRELVM  v)
static

Definition at line 55 of file sqstdblob.cpp.

References __swap_word(), and SETUP_BLOB.

◆ _blob_swap4()

static SQInteger _blob_swap4 ( HSQUIRRELVM  v)
static

Definition at line 44 of file sqstdblob.cpp.

References __swap_dword(), and SETUP_BLOB.

◆ _g_blob_castf2i()

static SQInteger _g_blob_castf2i ( HSQUIRRELVM  v)
static

Definition at line 165 of file sqstdblob.cpp.

References sq_getfloat(), and sq_pushinteger().

◆ _g_blob_casti2f()

static SQInteger _g_blob_casti2f ( HSQUIRRELVM  v)
static

Definition at line 157 of file sqstdblob.cpp.

References sq_getinteger(), and sq_pushfloat().

◆ _g_blob_swap2()

static SQInteger _g_blob_swap2 ( HSQUIRRELVM  v)
static

Definition at line 173 of file sqstdblob.cpp.

References sq_getinteger(), and sq_pushinteger().

◆ _g_blob_swap4()

static SQInteger _g_blob_swap4 ( HSQUIRRELVM  v)
static

Definition at line 182 of file sqstdblob.cpp.

References __swap_dword(), sq_getinteger(), and sq_pushinteger().

◆ _g_blob_swapfloat()

static SQInteger _g_blob_swapfloat ( HSQUIRRELVM  v)
static

Definition at line 192 of file sqstdblob.cpp.

References __swap_dword(), sq_getfloat(), and sq_pushfloat().

◆ sqstd_createblob()

SQUserPointer sqstd_createblob ( HSQUIRRELVM  v,
SQInteger  size 
)

◆ sqstd_getblob()

SQRESULT sqstd_getblob ( HSQUIRRELVM  v,
SQInteger  idx,
SQUserPointer *  ptr 
)

Definition at line 211 of file sqstdblob.cpp.

References sq_getinstanceup(), and SQSTD_BLOB_TYPE_TAG.

Referenced by _stream_writeblob().

◆ sqstd_getblobsize()

SQInteger sqstd_getblobsize ( HSQUIRRELVM  v,
SQInteger  idx 
)

Definition at line 220 of file sqstdblob.cpp.

References sq_getinstanceup(), and SQSTD_BLOB_TYPE_TAG.

Referenced by _stream_writeblob().

◆ sqstd_register_bloblib()

SQRESULT sqstd_register_bloblib ( HSQUIRRELVM  v)

Definition at line 248 of file sqstdblob.cpp.

References _blob_methods, bloblib_funcs, declare_stream(), and SQSTD_BLOB_TYPE_TAG.

Variable Documentation

◆ _blob_methods

SQRegFunction _blob_methods[]
static
Initial value:
= {
_DECL_BLOB_FUNC(constructor,-1,_SC("xn")),
_DECL_BLOB_FUNC(resize,2,_SC("xn")),
_DECL_BLOB_FUNC(swap2,1,_SC("x")),
_DECL_BLOB_FUNC(swap4,1,_SC("x")),
_DECL_BLOB_FUNC(_set,3,_SC("xnn")),
_DECL_BLOB_FUNC(_get,2,_SC("xn")),
_DECL_BLOB_FUNC(_typeof,1,_SC("x")),
_DECL_BLOB_FUNC(_nexti,2,_SC("x")),
{0,0,0,0}
}
#define _DECL_BLOB_FUNC(name, nparams, typecheck)
Definition: sqstdblob.cpp:140

Definition at line 141 of file sqstdblob.cpp.

Referenced by sqstd_register_bloblib().

◆ bloblib_funcs

SQRegFunction bloblib_funcs[]
static
Initial value:
={
_DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")),
_DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")),
{0,0}
}
#define _DECL_GLOBALBLOB_FUNC(name, nparams, typecheck)
Definition: sqstdblob.cpp:201

Definition at line 202 of file sqstdblob.cpp.

Referenced by sqstd_register_bloblib().