Code::Blocks  SVN r11506
Macros | Functions | Variables
sqbaselib.cpp File Reference
#include "sqpcheader.h"
#include "sqvm.h"
#include "sqstring.h"
#include "sqtable.h"
#include "sqarray.h"
#include "sqfuncproto.h"
#include "sqclosure.h"
#include "sqclass.h"
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
Include dependency graph for sqbaselib.cpp:

Go to the source code of this file.

Macros

#define STRING_TOFUNCZ(func)
 

Functions

bool str2num (const SQChar *s, SQObjectPtr &res)
 
static SQInteger base_dummy (HSQUIRRELVM)
 
static SQInteger base_collectgarbage (HSQUIRRELVM v)
 
static SQInteger base_getroottable (HSQUIRRELVM v)
 
static SQInteger base_getconsttable (HSQUIRRELVM v)
 
static SQInteger base_setroottable (HSQUIRRELVM v)
 
static SQInteger base_setconsttable (HSQUIRRELVM v)
 
static SQInteger base_seterrorhandler (HSQUIRRELVM v)
 
static SQInteger base_setdebughook (HSQUIRRELVM v)
 
static SQInteger base_enabledebuginfo (HSQUIRRELVM v)
 
static SQInteger base_getstackinfos (HSQUIRRELVM v)
 
static SQInteger base_assert (HSQUIRRELVM v)
 
static SQInteger get_slice_params (HSQUIRRELVM v, SQInteger &sidx, SQInteger &eidx, SQObjectPtr &o)
 
static SQInteger base_print (HSQUIRRELVM v)
 
static SQInteger base_compilestring (HSQUIRRELVM v)
 
static SQInteger base_newthread (HSQUIRRELVM v)
 
static SQInteger base_suspend (HSQUIRRELVM v)
 
static SQInteger base_array (HSQUIRRELVM v)
 
static SQInteger base_type (HSQUIRRELVM v)
 
void sq_base_register (HSQUIRRELVM v)
 
static SQInteger default_delegate_len (HSQUIRRELVM v)
 
static SQInteger default_delegate_tofloat (HSQUIRRELVM v)
 
static SQInteger default_delegate_tointeger (HSQUIRRELVM v)
 
static SQInteger default_delegate_tostring (HSQUIRRELVM v)
 
static SQInteger obj_delegate_weakref (HSQUIRRELVM v)
 
static SQInteger obj_clear (HSQUIRRELVM v)
 
static SQInteger number_delegate_tochar (HSQUIRRELVM v)
 
static SQInteger table_rawdelete (HSQUIRRELVM v)
 
static SQInteger container_rawexists (HSQUIRRELVM v)
 
static SQInteger table_rawset (HSQUIRRELVM v)
 
static SQInteger table_rawget (HSQUIRRELVM v)
 
static SQInteger array_append (HSQUIRRELVM v)
 
static SQInteger array_extend (HSQUIRRELVM v)
 
static SQInteger array_reverse (HSQUIRRELVM v)
 
static SQInteger array_pop (HSQUIRRELVM v)
 
static SQInteger array_top (HSQUIRRELVM v)
 
static SQInteger array_insert (HSQUIRRELVM v)
 
static SQInteger array_remove (HSQUIRRELVM v)
 
static SQInteger array_resize (HSQUIRRELVM v)
 
bool _sort_compare (HSQUIRRELVM v, SQObjectPtr &a, SQObjectPtr &b, SQInteger func, SQInteger &ret)
 
bool _hsort_sift_down (HSQUIRRELVM v, SQArray *arr, int root, int bottom, SQInteger func)
 
bool _hsort (HSQUIRRELVM v, SQObjectPtr &arr, SQInteger l, SQInteger r, SQInteger func)
 
static SQInteger array_sort (HSQUIRRELVM v)
 
static SQInteger array_slice (HSQUIRRELVM v)
 
static SQInteger string_slice (HSQUIRRELVM v)
 
static SQInteger string_find (HSQUIRRELVM v)
 
static SQInteger closure_pcall (HSQUIRRELVM v)
 
static SQInteger closure_call (HSQUIRRELVM v)
 
static SQInteger _closure_acall (HSQUIRRELVM v, SQBool raiseerror)
 
static SQInteger closure_acall (HSQUIRRELVM v)
 
static SQInteger closure_pacall (HSQUIRRELVM v)
 
static SQInteger closure_bindenv (HSQUIRRELVM v)
 
static SQInteger closure_getinfos (HSQUIRRELVM v)
 
static SQInteger generator_getstatus (HSQUIRRELVM v)
 
static SQInteger thread_call (HSQUIRRELVM v)
 
static SQInteger thread_wakeup (HSQUIRRELVM v)
 
static SQInteger thread_getstatus (HSQUIRRELVM v)
 
static SQInteger class_getattributes (HSQUIRRELVM v)
 
static SQInteger class_setattributes (HSQUIRRELVM v)
 
static SQInteger class_instance (HSQUIRRELVM v)
 
static SQInteger instance_getclass (HSQUIRRELVM v)
 
static SQInteger weakref_ref (HSQUIRRELVM v)
 

Variables

static SQRegFunction base_funcs []
 

Macro Definition Documentation

◆ STRING_TOFUNCZ

#define STRING_TOFUNCZ (   func)
Value:
static SQInteger string_##func(HSQUIRRELVM v) \
{ \
SQObject str=stack_get(v,1); \
SQInteger len=_string(str)->_len; \
const SQChar *sThis=_stringval(str); \
SQChar *sNew=(_ss(v)->GetScratchPad(rsl(len))); \
for(SQInteger i=0;i<len;i++) sNew[i]=func(sThis[i]); \
v->Push(SQString::Create(_ss(v),sNew,len)); \
return 1; \
}
char SQChar

Definition at line 642 of file sqbaselib.cpp.

Function Documentation

◆ _closure_acall()

static SQInteger _closure_acall ( HSQUIRRELVM  v,
SQBool  raiseerror 
)
static

Definition at line 691 of file sqbaselib.cpp.

References sq_call().

Referenced by closure_acall(), and closure_pacall().

◆ _hsort()

bool _hsort ( HSQUIRRELVM  v,
SQObjectPtr &  arr,
SQInteger  l,
SQInteger  r,
SQInteger  func 
)

Definition at line 538 of file sqbaselib.cpp.

References _hsort_sift_down().

Referenced by array_sort().

◆ _hsort_sift_down()

bool _hsort_sift_down ( HSQUIRRELVM  v,
SQArray *  arr,
int  root,
int  bottom,
SQInteger  func 
)

Definition at line 503 of file sqbaselib.cpp.

References _sort_compare().

Referenced by _hsort().

◆ _sort_compare()

bool _sort_compare ( HSQUIRRELVM  v,
SQObjectPtr &  a,
SQObjectPtr &  b,
SQInteger  func,
SQInteger &  ret 
)

Definition at line 477 of file sqbaselib.cpp.

References sq_call(), sq_getinteger(), sq_gettop(), sq_push(), sq_pushroottable(), and sq_settop().

Referenced by _hsort_sift_down().

◆ array_append()

static SQInteger array_append ( HSQUIRRELVM  v)
static

Definition at line 407 of file sqbaselib.cpp.

References sq_arrayappend().

Referenced by array_slice().

◆ array_extend()

static SQInteger array_extend ( HSQUIRRELVM  v)
static

Definition at line 412 of file sqbaselib.cpp.

Referenced by array_slice().

◆ array_insert()

static SQInteger array_insert ( HSQUIRRELVM  v)
static

Definition at line 438 of file sqbaselib.cpp.

References sq_throwerror().

Referenced by array_slice().

◆ array_pop()

static SQInteger array_pop ( HSQUIRRELVM  v)
static

Definition at line 423 of file sqbaselib.cpp.

References sq_arraypop().

Referenced by array_slice().

◆ array_remove()

static SQInteger array_remove ( HSQUIRRELVM  v)
static

Definition at line 448 of file sqbaselib.cpp.

References sq_throwerror().

Referenced by array_slice().

◆ array_resize()

static SQInteger array_resize ( HSQUIRRELVM  v)
static

Definition at line 462 of file sqbaselib.cpp.

References sq_gettop(), and sq_throwerror().

Referenced by array_slice().

◆ array_reverse()

static SQInteger array_reverse ( HSQUIRRELVM  v)
static

Definition at line 418 of file sqbaselib.cpp.

References sq_arrayreverse().

Referenced by array_slice().

◆ array_slice()

static SQInteger array_slice ( HSQUIRRELVM  v)
static

◆ array_sort()

static SQInteger array_sort ( HSQUIRRELVM  v)
static

Definition at line 555 of file sqbaselib.cpp.

References _hsort(), and sq_gettop().

Referenced by array_slice().

◆ array_top()

static SQInteger array_top ( HSQUIRRELVM  v)
static

Definition at line 428 of file sqbaselib.cpp.

References sq_throwerror().

Referenced by array_slice().

◆ base_array()

static SQInteger base_array ( HSQUIRRELVM  v)
static

Definition at line 204 of file sqbaselib.cpp.

References sq_gettop().

◆ base_assert()

static SQInteger base_assert ( HSQUIRRELVM  v)
static

Definition at line 135 of file sqbaselib.cpp.

References sq_throwerror().

◆ base_collectgarbage()

static SQInteger base_collectgarbage ( HSQUIRRELVM  v)
static

Definition at line 40 of file sqbaselib.cpp.

References sq_collectgarbage(), and sq_pushinteger().

◆ base_compilestring()

static SQInteger base_compilestring ( HSQUIRRELVM  v)
static

Definition at line 174 of file sqbaselib.cpp.

References NULL, sq_compilebuffer(), sq_getsize(), sq_getstring(), and sq_gettop().

◆ base_dummy()

static SQInteger base_dummy ( HSQUIRRELVM  )
static

Definition at line 34 of file sqbaselib.cpp.

◆ base_enabledebuginfo()

static SQInteger base_enabledebuginfo ( HSQUIRRELVM  v)
static

Definition at line 88 of file sqbaselib.cpp.

References sq_enabledebuginfo().

◆ base_getconsttable()

static SQInteger base_getconsttable ( HSQUIRRELVM  v)
static

Definition at line 53 of file sqbaselib.cpp.

◆ base_getroottable()

static SQInteger base_getroottable ( HSQUIRRELVM  v)
static

Definition at line 47 of file sqbaselib.cpp.

◆ base_getstackinfos()

static SQInteger base_getstackinfos ( HSQUIRRELVM  v)
static

◆ base_newthread()

static SQInteger base_newthread ( HSQUIRRELVM  v)
static

Definition at line 190 of file sqbaselib.cpp.

References sq_move(), and sq_newthread().

◆ base_print()

static SQInteger base_print ( HSQUIRRELVM  v)
static

Definition at line 165 of file sqbaselib.cpp.

References sq_getstring(), and sq_tostring().

◆ base_setconsttable()

static SQInteger base_setconsttable ( HSQUIRRELVM  v)
static

Definition at line 68 of file sqbaselib.cpp.

References sq_setconsttable().

◆ base_setdebughook()

static SQInteger base_setdebughook ( HSQUIRRELVM  v)
static

Definition at line 82 of file sqbaselib.cpp.

References sq_setdebughook().

◆ base_seterrorhandler()

static SQInteger base_seterrorhandler ( HSQUIRRELVM  v)
static

Definition at line 76 of file sqbaselib.cpp.

References sq_seterrorhandler().

◆ base_setroottable()

static SQInteger base_setroottable ( HSQUIRRELVM  v)
static

Definition at line 60 of file sqbaselib.cpp.

References sq_setroottable().

◆ base_suspend()

static SQInteger base_suspend ( HSQUIRRELVM  v)
static

Definition at line 199 of file sqbaselib.cpp.

References sq_suspendvm().

◆ base_type()

static SQInteger base_type ( HSQUIRRELVM  v)
static

Definition at line 219 of file sqbaselib.cpp.

References GetTypeName().

◆ class_getattributes()

static SQInteger class_getattributes ( HSQUIRRELVM  v)
static

Definition at line 873 of file sqbaselib.cpp.

References sq_getattributes().

Referenced by class_instance().

◆ class_instance()

static SQInteger class_instance ( HSQUIRRELVM  v)
static

◆ class_setattributes()

static SQInteger class_setattributes ( HSQUIRRELVM  v)
static

Definition at line 880 of file sqbaselib.cpp.

References sq_setattributes().

Referenced by class_instance().

◆ closure_acall()

static SQInteger closure_acall ( HSQUIRRELVM  v)
static

Definition at line 700 of file sqbaselib.cpp.

References _closure_acall().

Referenced by closure_getinfos().

◆ closure_bindenv()

static SQInteger closure_bindenv ( HSQUIRRELVM  v)
static

Definition at line 710 of file sqbaselib.cpp.

References sq_bindenv().

Referenced by closure_getinfos().

◆ closure_call()

static SQInteger closure_call ( HSQUIRRELVM  v)
static

Definition at line 686 of file sqbaselib.cpp.

References sq_call(), and sq_gettop().

Referenced by closure_getinfos().

◆ closure_getinfos()

static SQInteger closure_getinfos ( HSQUIRRELVM  v)
static

◆ closure_pacall()

static SQInteger closure_pacall ( HSQUIRRELVM  v)
static

Definition at line 705 of file sqbaselib.cpp.

References _closure_acall().

Referenced by closure_getinfos().

◆ closure_pcall()

static SQInteger closure_pcall ( HSQUIRRELVM  v)
static

Definition at line 681 of file sqbaselib.cpp.

References sq_call(), and sq_gettop().

Referenced by closure_getinfos().

◆ container_rawexists()

static SQInteger container_rawexists ( HSQUIRRELVM  v)
static

Definition at line 371 of file sqbaselib.cpp.

References sq_pushbool(), and sq_rawget().

Referenced by class_instance(), instance_getclass(), and table_rawget().

◆ default_delegate_len()

static SQInteger default_delegate_len ( HSQUIRRELVM  v)
static

Definition at line 277 of file sqbaselib.cpp.

References sq_getsize().

Referenced by array_slice(), and table_rawget().

◆ default_delegate_tofloat()

static SQInteger default_delegate_tofloat ( HSQUIRRELVM  v)
static

Definition at line 283 of file sqbaselib.cpp.

References _null_, sq_throwerror(), and str2num().

◆ default_delegate_tointeger()

static SQInteger default_delegate_tointeger ( HSQUIRRELVM  v)
static

Definition at line 308 of file sqbaselib.cpp.

References _null_, sq_throwerror(), and str2num().

◆ default_delegate_tostring()

static SQInteger default_delegate_tostring ( HSQUIRRELVM  v)
static

◆ generator_getstatus()

static SQInteger generator_getstatus ( HSQUIRRELVM  v)
static

Definition at line 769 of file sqbaselib.cpp.

References default_delegate_tostring(), NULL, and obj_delegate_weakref().

◆ get_slice_params()

static SQInteger get_slice_params ( HSQUIRRELVM  v,
SQInteger &  sidx,
SQInteger &  eidx,
SQObjectPtr &  o 
)
static

Definition at line 143 of file sqbaselib.cpp.

References sq_getsize(), and sq_gettop().

Referenced by array_slice(), and string_slice().

◆ instance_getclass()

static SQInteger instance_getclass ( HSQUIRRELVM  v)
static

◆ number_delegate_tochar()

static SQInteger number_delegate_tochar ( HSQUIRRELVM  v)
static

Definition at line 351 of file sqbaselib.cpp.

◆ obj_clear()

static SQInteger obj_clear ( HSQUIRRELVM  v)
static

Definition at line 345 of file sqbaselib.cpp.

References sq_clear().

Referenced by array_slice(), and table_rawget().

◆ obj_delegate_weakref()

static SQInteger obj_delegate_weakref ( HSQUIRRELVM  v)
static

◆ sq_base_register()

void sq_base_register ( HSQUIRRELVM  v)

◆ str2num()

bool str2num ( const SQChar s,
SQObjectPtr &  res 
)

Definition at line 16 of file sqbaselib.cpp.

Referenced by default_delegate_tofloat(), and default_delegate_tointeger().

◆ string_find()

static SQInteger string_find ( HSQUIRRELVM  v)
static

◆ string_slice()

static SQInteger string_slice ( HSQUIRRELVM  v)
static

Definition at line 610 of file sqbaselib.cpp.

References get_slice_params(), and sq_throwerror().

◆ table_rawdelete()

static SQInteger table_rawdelete ( HSQUIRRELVM  v)
static

Definition at line 363 of file sqbaselib.cpp.

References sq_rawdeleteslot().

Referenced by table_rawget().

◆ table_rawget()

static SQInteger table_rawget ( HSQUIRRELVM  v)
static

◆ table_rawset()

static SQInteger table_rawset ( HSQUIRRELVM  v)
static

Definition at line 381 of file sqbaselib.cpp.

References sq_rawset().

Referenced by table_rawget().

◆ thread_call()

static SQInteger thread_call ( HSQUIRRELVM  v)
static

Definition at line 789 of file sqbaselib.cpp.

References sq_call(), sq_gettop(), sq_move(), sq_pop(), and sq_throwerror().

Referenced by thread_getstatus().

◆ thread_getstatus()

static SQInteger thread_getstatus ( HSQUIRRELVM  v)
static

◆ thread_wakeup()

static SQInteger thread_wakeup ( HSQUIRRELVM  v)
static

◆ weakref_ref()

static SQInteger weakref_ref ( HSQUIRRELVM  v)
static

Variable Documentation

◆ base_funcs

SQRegFunction base_funcs[]
static
Initial value:
={
{_SC("seterrorhandler"),base_seterrorhandler,2, NULL},
{_SC("setdebughook"),base_setdebughook,2, NULL},
{_SC("enabledebuginfo"),base_enabledebuginfo,2, NULL},
{_SC("getstackinfos"),base_getstackinfos,2, _SC(".n")},
{_SC("getroottable"),base_getroottable,1, NULL},
{_SC("setroottable"),base_setroottable,2, NULL},
{_SC("getconsttable"),base_getconsttable,1, NULL},
{_SC("setconsttable"),base_setconsttable,2, NULL},
{_SC("assert"),base_assert,2, NULL},
{_SC("print"),base_print,2, NULL},
{_SC("compilestring"),base_compilestring,-2, _SC(".ss")},
{_SC("newthread"),base_newthread,2, _SC(".c")},
{_SC("suspend"),base_suspend,-1, NULL},
{_SC("array"),base_array,-2, _SC(".n")},
{_SC("type"),base_type,2, NULL},
{_SC("dummy"),base_dummy,0,NULL},
{_SC("collectgarbage"),base_collectgarbage,1, _SC("t")},
{0,0}
}
static SQInteger base_getstackinfos(HSQUIRRELVM v)
Definition: sqbaselib.cpp:95
static SQInteger base_setroottable(HSQUIRRELVM v)
Definition: sqbaselib.cpp:60
static SQInteger base_newthread(HSQUIRRELVM v)
Definition: sqbaselib.cpp:190
static SQInteger base_collectgarbage(HSQUIRRELVM v)
Definition: sqbaselib.cpp:40
static SQInteger base_dummy(HSQUIRRELVM)
Definition: sqbaselib.cpp:34
static SQInteger base_print(HSQUIRRELVM v)
Definition: sqbaselib.cpp:165
static SQInteger base_seterrorhandler(HSQUIRRELVM v)
Definition: sqbaselib.cpp:76
static SQInteger base_compilestring(HSQUIRRELVM v)
Definition: sqbaselib.cpp:174
static SQInteger base_setdebughook(HSQUIRRELVM v)
Definition: sqbaselib.cpp:82
static SQInteger base_enabledebuginfo(HSQUIRRELVM v)
Definition: sqbaselib.cpp:88
static SQInteger base_getroottable(HSQUIRRELVM v)
Definition: sqbaselib.cpp:47
static SQInteger base_assert(HSQUIRRELVM v)
Definition: sqbaselib.cpp:135
static SQInteger base_suspend(HSQUIRRELVM v)
Definition: sqbaselib.cpp:199
static SQInteger base_getconsttable(HSQUIRRELVM v)
Definition: sqbaselib.cpp:53
static SQInteger base_array(HSQUIRRELVM v)
Definition: sqbaselib.cpp:204
static SQInteger base_setconsttable(HSQUIRRELVM v)
Definition: sqbaselib.cpp:68
#define NULL
Definition: prefix.cpp:59
static SQInteger base_type(HSQUIRRELVM v)
Definition: sqbaselib.cpp:219

Definition at line 226 of file sqbaselib.cpp.

Referenced by sq_base_register().