Code::Blocks  SVN r11506
Macros | Functions | Variables
sqstdstring.cpp File Reference
#include <squirrel.h>
#include <sqstdstring.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
Include dependency graph for sqstdstring.cpp:

Go to the source code of this file.

Macros

#define scstrchr   strchr
 
#define scsnprintf   snprintf
 
#define scatoi   atoi
 
#define scstrtok   strtok
 
#define MAX_FORMAT_LEN   20
 
#define MAX_WFORMAT_LEN   3
 
#define ADDITIONAL_FORMAT_SPACE   (100*sizeof(SQChar))
 
#define SETUP_REX(v)
 
#define _DECL_REX_FUNC(name, nparams, pmask)   {_SC(#name),_regexp_##name,nparams,pmask}
 
#define _DECL_FUNC(name, nparams, pmask)   {_SC(#name),_string_##name,nparams,pmask}
 

Functions

static SQInteger validate_format (HSQUIRRELVM v, SQChar *fmt, const SQChar *src, SQInteger n, SQInteger &width)
 
SQRESULT sqstd_format (HSQUIRRELVM v, SQInteger nformatstringidx, SQInteger *outlen, SQChar **output)
 
static SQInteger _string_format (HSQUIRRELVM v)
 
static void __strip_l (const SQChar *str, const SQChar **start)
 
static void __strip_r (const SQChar *str, SQInteger len, const SQChar **end)
 
static SQInteger _string_strip (HSQUIRRELVM v)
 
static SQInteger _string_lstrip (HSQUIRRELVM v)
 
static SQInteger _string_rstrip (HSQUIRRELVM v)
 
static SQInteger _string_split (HSQUIRRELVM v)
 
static SQInteger _rexobj_releasehook (SQUserPointer p, SQInteger)
 
static SQInteger _regexp_match (HSQUIRRELVM v)
 
static void _addrexmatch (HSQUIRRELVM v, const SQChar *str, const SQChar *begin, const SQChar *end)
 
static SQInteger _regexp_capture (HSQUIRRELVM v)
 
static SQInteger _regexp_subexpcount (HSQUIRRELVM v)
 
static SQInteger _regexp_constructor (HSQUIRRELVM v)
 
static SQInteger _regexp__typeof (HSQUIRRELVM v)
 
SQInteger sqstd_register_stringlib (HSQUIRRELVM v)
 

Variables

static SQRegFunction rexobj_funcs []
 
static SQRegFunction stringlib_funcs []
 

Macro Definition Documentation

◆ _DECL_FUNC

#define _DECL_FUNC (   name,
  nparams,
  pmask 
)    {_SC(#name),_string_##name,nparams,pmask}

Definition at line 327 of file sqstdstring.cpp.

◆ _DECL_REX_FUNC

#define _DECL_REX_FUNC (   name,
  nparams,
  pmask 
)    {_SC(#name),_regexp_##name,nparams,pmask}

Definition at line 316 of file sqstdstring.cpp.

◆ ADDITIONAL_FORMAT_SPACE

#define ADDITIONAL_FORMAT_SPACE   (100*sizeof(SQChar))

Definition at line 23 of file sqstdstring.cpp.

Referenced by sqstd_format().

◆ MAX_FORMAT_LEN

#define MAX_FORMAT_LEN   20

Definition at line 21 of file sqstdstring.cpp.

Referenced by sqstd_format(), and validate_format().

◆ MAX_WFORMAT_LEN

#define MAX_WFORMAT_LEN   3

Definition at line 22 of file sqstdstring.cpp.

Referenced by validate_format().

◆ scatoi

#define scatoi   atoi

Definition at line 18 of file sqstdstring.cpp.

Referenced by validate_format().

◆ scsnprintf

#define scsnprintf   snprintf

Definition at line 17 of file sqstdstring.cpp.

◆ scstrchr

#define scstrchr   strchr

Definition at line 16 of file sqstdstring.cpp.

Referenced by validate_format().

◆ scstrtok

#define scstrtok   strtok

Definition at line 19 of file sqstdstring.cpp.

Referenced by _string_split().

◆ SETUP_REX

#define SETUP_REX (   v)
Value:
SQRex *self = NULL; \
sq_getinstanceup(v,1,(SQUserPointer *)&self,0);
#define NULL
Definition: prefix.cpp:59

Definition at line 217 of file sqstdstring.cpp.

Referenced by _regexp_capture(), _regexp_match(), _regexp_search(), and _regexp_subexpcount().

Function Documentation

◆ __strip_l()

static void __strip_l ( const SQChar str,
const SQChar **  start 
)
static

Definition at line 149 of file sqstdstring.cpp.

Referenced by _string_lstrip(), and _string_strip().

◆ __strip_r()

static void __strip_r ( const SQChar str,
SQInteger  len,
const SQChar **  end 
)
static

Definition at line 156 of file sqstdstring.cpp.

Referenced by _string_rstrip(), and _string_strip().

◆ _addrexmatch()

static void _addrexmatch ( HSQUIRRELVM  v,
const SQChar str,
const SQChar begin,
const SQChar end 
)
static

Definition at line 243 of file sqstdstring.cpp.

References sq_newtable(), sq_pushinteger(), sq_pushstring(), and sq_rawset().

Referenced by _regexp_capture(), and _regexp_search().

◆ _regexp__typeof()

static SQInteger _regexp__typeof ( HSQUIRRELVM  v)
static

Definition at line 310 of file sqstdstring.cpp.

References sq_pushstring().

◆ _regexp_capture()

static SQInteger _regexp_capture ( HSQUIRRELVM  v)
static

◆ _regexp_constructor()

static SQInteger _regexp_constructor ( HSQUIRRELVM  v)
static

◆ _regexp_match()

static SQInteger _regexp_match ( HSQUIRRELVM  v)
static

Definition at line 229 of file sqstdstring.cpp.

References SETUP_REX, sq_getstring(), sq_pushbool(), and sqstd_rex_match().

◆ _regexp_search()

static SQInteger _regexp_search ( HSQUIRRELVM  v)
static

◆ _regexp_subexpcount()

static SQInteger _regexp_subexpcount ( HSQUIRRELVM  v)
static

Definition at line 292 of file sqstdstring.cpp.

References SETUP_REX, sq_pushinteger(), and sqstd_rex_getsubexpcount().

◆ _rexobj_releasehook()

static SQInteger _rexobj_releasehook ( SQUserPointer  p,
SQInteger   
)
static

Definition at line 222 of file sqstdstring.cpp.

References sqstd_rex_free().

Referenced by _regexp_constructor().

◆ _string_format()

static SQInteger _string_format ( HSQUIRRELVM  v)
static

Definition at line 139 of file sqstdstring.cpp.

References NULL, sq_pushstring(), and sqstd_format().

◆ _string_lstrip()

static SQInteger _string_lstrip ( HSQUIRRELVM  v)
static

Definition at line 178 of file sqstdstring.cpp.

References __strip_l(), sq_getstring(), and sq_pushstring().

◆ _string_rstrip()

static SQInteger _string_rstrip ( HSQUIRRELVM  v)
static

Definition at line 187 of file sqstdstring.cpp.

References __strip_r(), sq_getsize(), sq_getstring(), and sq_pushstring().

◆ _string_split()

static SQInteger _string_split ( HSQUIRRELVM  v)
static

◆ _string_strip()

static SQInteger _string_strip ( HSQUIRRELVM  v)
static

Definition at line 167 of file sqstdstring.cpp.

References __strip_l(), __strip_r(), sq_getsize(), sq_getstring(), and sq_pushstring().

◆ sqstd_format()

SQRESULT sqstd_format ( HSQUIRRELVM  v,
SQInteger  nformatstringidx,
SQInteger *  outlen,
SQChar **  output 
)

◆ sqstd_register_stringlib()

SQInteger sqstd_register_stringlib ( HSQUIRRELVM  v)

◆ validate_format()

static SQInteger validate_format ( HSQUIRRELVM  v,
SQChar fmt,
const SQChar src,
SQInteger  n,
SQInteger &  width 
)
static

Definition at line 25 of file sqstdstring.cpp.

References MAX_FORMAT_LEN, MAX_WFORMAT_LEN, scatoi, scstrchr, and sq_throwerror().

Referenced by sqstd_format().

Variable Documentation

◆ rexobj_funcs

SQRegFunction rexobj_funcs[]
static
Initial value:
={
_DECL_REX_FUNC(constructor,2,_SC(".s")),
_DECL_REX_FUNC(search,-2,_SC("xsn")),
_DECL_REX_FUNC(match,2,_SC("xs")),
_DECL_REX_FUNC(capture,-2,_SC("xsn")),
_DECL_REX_FUNC(subexpcount,1,_SC("x")),
_DECL_REX_FUNC(_typeof,1,_SC("x")),
{0,0}
}
static wxString capture
#define _DECL_REX_FUNC(name, nparams, pmask)

Definition at line 317 of file sqstdstring.cpp.

Referenced by sqstd_register_stringlib().

◆ stringlib_funcs

SQRegFunction stringlib_funcs[]
static
Initial value:
={
_DECL_FUNC(format,-2,_SC(".s")),
_DECL_FUNC(strip,2,_SC(".s")),
_DECL_FUNC(lstrip,2,_SC(".s")),
_DECL_FUNC(rstrip,2,_SC(".s")),
_DECL_FUNC(split,3,_SC(".ss")),
{0,0}
}
#define _DECL_FUNC(name, nparams, pmask)

Definition at line 328 of file sqstdstring.cpp.

Referenced by sqstd_register_stringlib().