sqstd_register_stringlib |
SQRESULT sqstd_register_stringlib(
HSQUIRRELVM v)
;
initialize and register the string library in the given VM.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- return:
-
an SQRESULT
- remarks:
-
The function aspects a table on top of the stack where to register the global library functions.
sqstd_format |
SQRESULT sqstd_format(
HSQUIRRELVM v, SQInteger nformatstringidx, SQInteger * outlen, SQChar ** output)
;
creates a new string formatted according to the object at positionnformatstringidx and the optional parameters following it. The format string follows the same rules as the printf family of standard C functions( the "*" is not supported).
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- SQInteger nformatstringidx
-
index in the stack of the format string
- SQInteger * outlen
-
a pointer to an integer that will be filled with the length of the newly created string
- SQChar ** output
-
a pointer to a string pointer that will receive the newly created string
- return:
-
an SQRESULT
- remarks:
-
the newly created string is allocated in the scratchpad memory.
sqstd_rex_compile |
SQRex * sqstd_rex_compile(
const SQChar * pattern, const SQChar ** error)
;
compiles an expression and returns a pointer to the compiled version. in case of failure returns NULL.The returned object has to be deleted through the function sqstd_rex_free().
- parameters:
-
- const SQChar * pattern
-
a pointer to a zero terminated string containing the pattern that has to be compiled.
- const SQChar ** error
-
a pointer to a string pointer that will be set with an error string in case of failure.
- return:
-
a pointer to the compiled pattern
sqstd_rex_free |
void sqstd_rex_free(
SQRex * exp)
;
deletes a expression structure created with sqstd_rex_compile()
- parameters:
-
- SQRex * exp
-
the expression structure that has to be deleted
sqstd_rex_match |
SQBool sqstd_rex_match(
SQRex * exp, const SQChar * text)
;
returns SQTrue if the string specified in the parameter text is an exact match of the expression, otherwise returns SQFalse.
- parameters:
-
- SQRex * exp
-
the compiled expression
- const SQChar * text
-
the string that has to be tested
- return:
-
SQTrue if successful otherwise SQFalse
sqstd_rex_search |
SQBool sqstd_rex_search(
SQRex * exp, const SQChar * text, const SQChar ** out_begin, const SQChar ** out_end)
;
searches the first match of the expressin in the string specified in the parameter text. if the match is found returns SQTrue and the sets out_begin to the beginning of the match and out_end at the end of the match; otherwise returns SQFalse.
- parameters:
-
- SQRex * exp
-
the compiled expression
- const SQChar * text
-
the string that has to be tested
- const SQChar ** out_begin
-
a pointer to a string pointer that will be set with the beginning of the match
- const SQChar ** out_end
-
a pointer to a string pointer that will be set with the end of the match
- return:
-
SQTrue if successful otherwise SQFalse
sqstd_rex_searchrange |
SQBool sqstd_rex_searchrange(
SQRex * exp, const SQChar * text_begin, const SQChar * text_end, const SQChar ** out_begin, const SQChar ** out_end)
;
searches the first match of the expressin in the string delimited by the parameter text_begin and text_end. if the match is found returns SQTrue and the sets out_begin to the beginning of the match and out_end at the end of the match; otherwise returns SQFalse.
- parameters:
-
- SQRex * exp
-
the compiled expression
- const SQChar * text_begin
-
a pointer to the beginnning of the string that has to be tested
- const SQChar * text_end
-
a pointer to the end of the string that has to be tested
- const SQChar ** out_begin
-
a pointer to a string pointer that will be set with the beginning of the match
- const SQChar ** out_end
-
a pointer to a string pointer that will be set with the end of the match
- return:
-
an SQRESULT
sqstd_rex_getsubexpcount |
SQInteger sqstd_rex_getsubexpcount(
SQRex * exp)
;
returns the number of sub expressions matched by the expression
- parameters:
-
- SQRex * exp
-
the compiled expression
- return:
-
the number of sub expressions matched by the expression
sqstd_rex_getsubexp |
SQInteger sqstd_rex_getsubexp(
SQRex * exp, SQInteger n, SQRexMatch * subexp)
;
retrieve the begin and and pointer to the length of the sub expression indexed by n. The result is passed trhough the struct SQRexMatch.
- parameters:
-
- SQRex * exp
-
the compiled expression
- SQInteger n
-
the index of the submatch(0 is the complete match)
- SQRexMatch * subexp
-
a pointer to structure that will store the result
- return:
-
the function returns SQTrue if n is valid index otherwise SQFalse.