ReactOS  0.4.14-dev-583-g2a1ba2c
jsregexp.c File Reference
#include <math.h>
#include "jscript.h"
#include "regexp.h"
#include "wine/debug.h"
Include dependency graph for jsregexp.c:

Go to the source code of this file.

Classes

struct  RegExpInstance
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (jscript)
 
static RegExpInstanceregexp_from_jsdisp (jsdisp_t *jsdisp)
 
static RegExpInstanceregexp_from_vdisp (vdisp_t *vdisp)
 
static void set_last_index (RegExpInstance *This, DWORD last_index)
 
static HRESULT do_regexp_match_next (script_ctx_t *ctx, RegExpInstance *regexp, DWORD rem_flags, jsstr_t *jsstr, const WCHAR *str, match_state_t *ret)
 
HRESULT regexp_match_next (script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags, jsstr_t *jsstr, match_state_t **ret)
 
static HRESULT regexp_match (script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr, BOOL gflag, match_result_t **match_result, DWORD *result_cnt)
 
static HRESULT RegExp_get_source (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExp_get_global (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExp_get_ignoreCase (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExp_get_multiline (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static INT index_from_val (script_ctx_t *ctx, jsval_t v)
 
static HRESULT RegExp_get_lastIndex (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExp_set_lastIndex (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
 
static HRESULT RegExp_toString (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT create_match_array (script_ctx_t *ctx, jsstr_t *input_str, const match_state_t *result, IDispatch **ret)
 
static HRESULT run_exec (script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsstr_t **input, match_state_t **result, BOOL *ret)
 
static HRESULT RegExp_exec (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT RegExp_test (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT RegExp_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static void RegExp_destructor (jsdisp_t *dispex)
 
static HRESULT alloc_regexp (script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
 
HRESULT create_regexp (script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **ret)
 
HRESULT create_regexp_var (script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg, jsdisp_t **ret)
 
HRESULT regexp_string_match (script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsval_t *r)
 
static HRESULT global_idx (script_ctx_t *ctx, DWORD idx, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx1 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx2 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx3 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx4 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx5 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx6 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx7 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx8 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_idx9 (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_leftContext (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_get_rightContext (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT RegExpConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
HRESULT create_regexp_constr (script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
 
HRESULT parse_regexp_flags (const WCHAR *str, DWORD str_len, DWORD *ret)
 

Variables

static const WCHAR sourceW [] = {'s','o','u','r','c','e',0}
 
static const WCHAR globalW [] = {'g','l','o','b','a','l',0}
 
static const WCHAR ignoreCaseW [] = {'i','g','n','o','r','e','C','a','s','e',0}
 
static const WCHAR multilineW [] = {'m','u','l','t','i','l','i','n','e',0}
 
static const WCHAR lastIndexW [] = {'l','a','s','t','I','n','d','e','x',0}
 
static const WCHAR toStringW [] = {'t','o','S','t','r','i','n','g',0}
 
static const WCHAR execW [] = {'e','x','e','c',0}
 
static const WCHAR testW [] = {'t','e','s','t',0}
 
static const WCHAR leftContextW []
 
static const WCHAR rightContextW []
 
static const WCHAR idx1W [] = {'$','1',0}
 
static const WCHAR idx2W [] = {'$','2',0}
 
static const WCHAR idx3W [] = {'$','3',0}
 
static const WCHAR idx4W [] = {'$','4',0}
 
static const WCHAR idx5W [] = {'$','5',0}
 
static const WCHAR idx6W [] = {'$','6',0}
 
static const WCHAR idx7W [] = {'$','7',0}
 
static const WCHAR idx8W [] = {'$','8',0}
 
static const WCHAR idx9W [] = {'$','9',0}
 
static const builtin_prop_t RegExp_props []
 
static const builtin_info_t RegExp_info
 
static const builtin_prop_t RegExpInst_props []
 
static const builtin_info_t RegExpInst_info
 
static const builtin_prop_t RegExpConstr_props []
 
static const builtin_info_t RegExpConstr_info
 

Function Documentation

◆ alloc_regexp()

static HRESULT alloc_regexp ( script_ctx_t ctx,
jsdisp_t object_prototype,
RegExpInstance **  ret 
)
static

Definition at line 621 of file jsregexp.c.

622 {
623  RegExpInstance *regexp;
624  HRESULT hres;
625 
626  regexp = heap_alloc_zero(sizeof(RegExpInstance));
627  if(!regexp)
628  return E_OUTOFMEMORY;
629 
630  if(object_prototype)
631  hres = init_dispex(&regexp->dispex, ctx, &RegExp_info, object_prototype);
632  else
634 
635  if(FAILED(hres)) {
636  heap_free(regexp);
637  return hres;
638  }
639 
640  *ret = regexp;
641  return S_OK;
642 }
jsdisp_t dispex
Definition: jsregexp.c:29
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
jsdisp_t * regexp_constr
Definition: jscript.h:457
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
static const builtin_info_t RegExpInst_info
Definition: jsregexp.c:612
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
static const builtin_info_t RegExp_info
Definition: jsregexp.c:595
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_regexp(), and create_regexp_constr().

◆ create_match_array()

static HRESULT create_match_array ( script_ctx_t ctx,
jsstr_t input_str,
const match_state_t result,
IDispatch **  ret 
)
static

Definition at line 372 of file jsregexp.c.

374 {
375  const WCHAR *input;
376  jsdisp_t *array;
377  jsstr_t *str;
378  DWORD i;
379  HRESULT hres = S_OK;
380 
381  static const WCHAR indexW[] = {'i','n','d','e','x',0};
382  static const WCHAR inputW[] = {'i','n','p','u','t',0};
383  static const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0};
384  static const WCHAR zeroW[] = {'0',0};
385 
386  input = jsstr_flatten(input_str);
387  if(!input)
388  return E_OUTOFMEMORY;
389 
390  hres = create_array(ctx, result->paren_count+1, &array);
391  if(FAILED(hres))
392  return hres;
393 
394  for(i=0; i < result->paren_count; i++) {
395  if(result->parens[i].index != -1)
396  str = jsstr_substr(input_str, result->parens[i].index, result->parens[i].length);
397  else
398  str = jsstr_empty();
399  if(!str) {
401  break;
402  }
403 
406  if(FAILED(hres))
407  break;
408  }
409 
410  while(SUCCEEDED(hres)) {
411  hres = jsdisp_propput_name(array, indexW, jsval_number(result->cp-input-result->match_len));
412  if(FAILED(hres))
413  break;
414 
416  if(FAILED(hres))
417  break;
418 
420  if(FAILED(hres))
421  break;
422 
423  str = jsstr_alloc_len(result->cp-result->match_len, result->match_len);
424  if(!str) {
426  break;
427  }
430  break;
431  }
432 
433  if(FAILED(hres)) {
435  return hres;
436  }
437 
438  *ret = to_disp(array);
439  return S_OK;
440 }
jsstr_t * jsstr_alloc_len(const WCHAR *buf, unsigned len)
Definition: jsstr.c:86
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
static jsstr_t * jsstr_substr(jsstr_t *str, unsigned off, unsigned len)
Definition: jsstr.h:163
Definition: jsstr.h:39
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const WCHAR inputW[]
Definition: htmlelem.c:31
const WCHAR * str
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static IDispatch * to_disp(jsdisp_t *jsdisp)
Definition: jscript.h:245
HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
Definition: dispex.c:1349
#define S_OK
Definition: intsafe.h:59
GLenum GLenum GLenum input
Definition: glext.h:9031
HRESULT create_array(script_ctx_t *ctx, DWORD length, jsdisp_t **ret)
Definition: array.c:1381
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
Definition: dispex.c:1344
static const WCHAR lastIndexW[]
Definition: jsregexp.c:41
GLuint64EXT * result
Definition: glext.h:11304
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum GLdouble GLenum GLint GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLenum GLfloat GLenum GLfloat GLenum GLushort const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLenum GLint GLenum GLint GLenum GLint GLuint GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble const GLfloat GLenum const GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLint GLint GLsizei GLsizei GLenum GLuint GLenum array
Definition: glfuncs.h:320
static jsval_t jsval_number(double n)
Definition: jsval.h:144

Referenced by RegExp_exec(), and regexp_string_match().

◆ create_regexp()

HRESULT create_regexp ( script_ctx_t ctx,
jsstr_t src,
DWORD  flags,
jsdisp_t **  ret 
)

Definition at line 644 of file jsregexp.c.

645 {
646  RegExpInstance *regexp;
647  const WCHAR *str;
648  HRESULT hres;
649 
650  str = jsstr_flatten(src);
651  if(!str)
652  return E_OUTOFMEMORY;
653 
654  TRACE("%s %x\n", debugstr_wn(str, jsstr_length(src)), flags);
655 
656  hres = alloc_regexp(ctx, NULL, &regexp);
657  if(FAILED(hres))
658  return hres;
659 
660  regexp->str = jsstr_addref(src);
661  regexp->last_index_val = jsval_number(0);
662 
663  regexp->jsregexp = regexp_new(ctx, &ctx->tmp_heap, str, jsstr_length(regexp->str), flags, FALSE);
664  if(!regexp->jsregexp) {
665  WARN("regexp_new failed\n");
666  jsdisp_release(&regexp->dispex);
667  return E_FAIL;
668  }
669 
670  *ret = &regexp->dispex;
671  return S_OK;
672 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
jsdisp_t dispex
Definition: jsregexp.c:29
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
jsval_t last_index_val
Definition: jsregexp.c:34
#define WARN(fmt,...)
Definition: debug.h:111
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
regexp_t * regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str, DWORD str_len, WORD flags, BOOL flat)
Definition: regexp.c:3195
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
GLenum src
Definition: glext.h:6340
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
Definition: jsregexp.c:621
#define debugstr_wn
Definition: kernel32.h:33
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
jsstr_t * str
Definition: jsregexp.c:32
static jsval_t jsval_number(double n)
Definition: jsval.h:144

Referenced by create_regexp_var(), interp_new(), interp_regexp(), and String_match().

◆ create_regexp_constr()

HRESULT create_regexp_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 1004 of file jsregexp.c.

1005 {
1006  RegExpInstance *regexp;
1007  HRESULT hres;
1008 
1009  static const WCHAR RegExpW[] = {'R','e','g','E','x','p',0};
1010 
1011  hres = alloc_regexp(ctx, object_prototype, &regexp);
1012  if(FAILED(hres))
1013  return hres;
1014 
1016  PROPF_CONSTR|2, &regexp->dispex, ret);
1017 
1018  jsdisp_release(&regexp->dispex);
1019  return hres;
1020 }
jsdisp_t dispex
Definition: jsregexp.c:29
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:926
static const builtin_info_t RegExpConstr_info
Definition: jsregexp.c:995
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
Definition: jsregexp.c:621
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static const WCHAR RegExpW[]
Definition: global.c:50

Referenced by init_constructors().

◆ create_regexp_var()

HRESULT create_regexp_var ( script_ctx_t ctx,
jsval_t  src_arg,
jsval_t flags_arg,
jsdisp_t **  ret 
)

Definition at line 674 of file jsregexp.c.

675 {
676  unsigned flags, opt_len = 0;
677  const WCHAR *opt = NULL;
678  jsstr_t *src;
679  HRESULT hres;
680 
681  if(is_object_instance(src_arg)) {
682  jsdisp_t *obj;
683 
684  obj = iface_to_jsdisp(get_object(src_arg));
685  if(obj) {
686  if(is_class(obj, JSCLASS_REGEXP)) {
688 
689  hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret);
691  return hres;
692  }
693 
695  }
696  }
697 
698  if(!is_string(src_arg)) {
699  FIXME("src_arg = %s\n", debugstr_jsval(src_arg));
700  return E_NOTIMPL;
701  }
702 
703  src = get_string(src_arg);
704 
705  if(flags_arg) {
706  jsstr_t *opt_str;
707 
708  if(!is_string(*flags_arg)) {
709  FIXME("unimplemented for %s\n", debugstr_jsval(*flags_arg));
710  return E_NOTIMPL;
711  }
712 
713  opt_str = get_string(*flags_arg);
714  opt = jsstr_flatten(opt_str);
715  if(!opt)
716  return E_OUTOFMEMORY;
717  opt_len = jsstr_length(opt_str);
718  }
719 
720  hres = parse_regexp_flags(opt, opt_len, &flags);
721  if(FAILED(hres))
722  return hres;
723 
724  return create_regexp(ctx, src, flags, ret);
725 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
Definition: jsstr.h:39
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
WORD flags
Definition: regexp.h:57
static BOOL is_string(parse_buffer *buf)
Definition: parsing.c:600
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static char * get_string(void)
Definition: ppl.yy.c:4402
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **ret)
Definition: jsregexp.c:644
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:504
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
GLbitfield flags
Definition: glext.h:7161
int ret
HRESULT parse_regexp_flags(const WCHAR *str, DWORD str_len, DWORD *ret)
Definition: jsregexp.c:1022
GLenum src
Definition: glext.h:6340
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1060
regexp_t * jsregexp
Definition: jsregexp.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
jsstr_t * str
Definition: jsregexp.c:32
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
Definition: jsutils.c:35

Referenced by RegExpConstr_value(), and String_search().

◆ do_regexp_match_next()

static HRESULT do_regexp_match_next ( script_ctx_t ctx,
RegExpInstance regexp,
DWORD  rem_flags,
jsstr_t jsstr,
const WCHAR str,
match_state_t ret 
)
static

Definition at line 78 of file jsregexp.c.

80 {
81  HRESULT hres;
82 
83  hres = regexp_execute(regexp->jsregexp, ctx, &ctx->tmp_heap,
84  str, jsstr_length(jsstr), ret);
85  if(FAILED(hres))
86  return hres;
87  if(hres == S_FALSE) {
88  if(rem_flags & REM_RESET_INDEX)
89  set_last_index(regexp, 0);
90  return S_FALSE;
91  }
92 
93  if(!(rem_flags & REM_NO_CTX_UPDATE) && ctx->last_match != jsstr) {
95  ctx->last_match = jsstr_addref(jsstr);
96  }
97 
98  if(!(rem_flags & REM_NO_CTX_UPDATE)) {
99  DWORD i, n = min(ARRAY_SIZE(ctx->match_parens), ret->paren_count);
100 
101  for(i=0; i < n; i++) {
102  if(ret->parens[i].index == -1) {
103  ctx->match_parens[i].index = 0;
104  ctx->match_parens[i].length = 0;
105  }else {
106  ctx->match_parens[i].index = ret->parens[i].index;
107  ctx->match_parens[i].length = ret->parens[i].length;
108  }
109  }
110 
111  if(n < ARRAY_SIZE(ctx->match_parens))
112  memset(ctx->match_parens+n, 0, sizeof(ctx->match_parens) - n*sizeof(ctx->match_parens[0]));
113  }
114 
115  set_last_index(regexp, ret->cp-str);
116 
117  if(!(rem_flags & REM_NO_CTX_UPDATE)) {
118  ctx->last_match_index = ret->cp-str-ret->match_len;
119  ctx->last_match_length = ret->match_len;
120  }
121 
122  return S_OK;
123 }
jsstr_t * last_match
Definition: jscript.h:436
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
GLdouble n
Definition: glext.h:7729
static void set_last_index(RegExpInstance *This, DWORD last_index)
Definition: jsregexp.c:71
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
unsigned index
Definition: jscript.h:405
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REM_NO_CTX_UPDATE
Definition: jscript.h:491
match_result_t match_parens[9]
Definition: jscript.h:437
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
DWORD last_match_index
Definition: jscript.h:438
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REM_RESET_INDEX
Definition: jscript.h:490
int ret
HRESULT regexp_execute(regexp_t *regexp, void *cx, heap_pool_t *pool, const WCHAR *str, DWORD str_len, match_state_t *result)
Definition: regexp.c:3140
heap_pool_t tmp_heap
Definition: jscript.h:427
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
DWORD last_match_length
Definition: jscript.h:439
unsigned length
Definition: jscript.h:406
#define memset(x, y, z)
Definition: compat.h:39

Referenced by regexp_match(), and regexp_match_next().

◆ global_idx()

static HRESULT global_idx ( script_ctx_t ctx,
DWORD  idx,
jsval_t r 
)
static

Definition at line 831 of file jsregexp.c.

832 {
833  jsstr_t *ret;
834 
836  if(!ret)
837  return E_OUTOFMEMORY;
838 
839  *r = jsval_string(ret);
840  return S_OK;
841 }
static jsstr_t * jsstr_substr(jsstr_t *str, unsigned off, unsigned len)
Definition: jsstr.h:163
jsstr_t * last_match
Definition: jscript.h:436
Definition: jsstr.h:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
unsigned index
Definition: jscript.h:405
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
match_result_t match_parens[9]
Definition: jscript.h:437
unsigned int idx
Definition: utils.c:41
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
int ret
#define S_OK
Definition: intsafe.h:59
unsigned length
Definition: jscript.h:406

Referenced by RegExpConstr_get_idx1(), RegExpConstr_get_idx2(), RegExpConstr_get_idx3(), RegExpConstr_get_idx4(), RegExpConstr_get_idx5(), RegExpConstr_get_idx6(), RegExpConstr_get_idx7(), RegExpConstr_get_idx8(), and RegExpConstr_get_idx9().

◆ index_from_val()

static INT index_from_val ( script_ctx_t ctx,
jsval_t  v 
)
static

Definition at line 283 of file jsregexp.c.

284 {
285  double n;
286  HRESULT hres;
287 
288  hres = to_number(ctx, v, &n);
289  if(FAILED(hres)) {
290  clear_ei(ctx); /* FIXME: Move ignoring exceptions to to_primitive */
291  return 0;
292  }
293 
294  n = floor(n);
295  return is_int32(n) ? n : 0;
296 }
GLdouble n
Definition: glext.h:7729
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
HRESULT to_number(script_ctx_t *, jsval_t, double *) DECLSPEC_HIDDEN
Definition: jsutils.c:609
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GLdouble * v
Definition: gl.h:2040
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
static BOOL is_int32(double d)
Definition: jscript.h:514

Referenced by RegExp_set_lastIndex().

◆ parse_regexp_flags()

HRESULT parse_regexp_flags ( const WCHAR str,
DWORD  str_len,
DWORD ret 
)

Definition at line 1022 of file jsregexp.c.

1023 {
1024  const WCHAR *p;
1025  DWORD flags = 0;
1026 
1027  for (p = str; p < str+str_len; p++) {
1028  switch (*p) {
1029  case 'g':
1030  flags |= REG_GLOB;
1031  break;
1032  case 'i':
1033  flags |= REG_FOLD;
1034  break;
1035  case 'm':
1036  flags |= REG_MULTILINE;
1037  break;
1038  case 'y':
1039  flags |= REG_STICKY;
1040  break;
1041  default:
1042  WARN("wrong flag %c\n", *p);
1043  return E_FAIL;
1044  }
1045  }
1046 
1047  *ret = flags;
1048  return S_OK;
1049 }
#define WARN(fmt,...)
Definition: debug.h:111
#define str_len
Definition: treelist.c:89
#define E_FAIL
Definition: ddrawi.h:102
#define REG_STICKY
Definition: regexp.h:39
#define REG_MULTILINE
Definition: regexp.h:38
#define REG_FOLD
Definition: regexp.h:36
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
#define S_OK
Definition: intsafe.h:59
#define REG_GLOB
Definition: regexp.h:37
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by create_regexp_var(), and parse_regexp().

◆ RegExp_destructor()

static void RegExp_destructor ( jsdisp_t dispex)
static

Definition at line 573 of file jsregexp.c.

574 {
576 
577  if(This->jsregexp)
578  regexp_destroy(This->jsregexp);
579  jsval_release(This->last_index_val);
580  jsstr_release(This->str);
581  heap_free(This);
582 }
void regexp_destroy(regexp_t *re)
Definition: regexp.c:3181
void jsval_release(jsval_t val)
Definition: jsutils.c:191
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ RegExp_exec()

static HRESULT RegExp_exec ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 497 of file jsregexp.c.

499 {
501  heap_pool_t *mark;
502  BOOL b;
503  jsstr_t *string;
504  HRESULT hres;
505 
506  TRACE("\n");
507 
508  mark = heap_pool_mark(&ctx->tmp_heap);
509 
510  hres = run_exec(ctx, jsthis, argc ? argv[0] : jsval_string(jsstr_empty()), &string, &match, &b);
511  if(FAILED(hres)) {
512  heap_pool_clear(mark);
513  return hres;
514  }
515 
516  if(r) {
517  if(b) {
518  IDispatch *ret;
519 
520  hres = create_match_array(ctx, string, match, &ret);
521  if(SUCCEEDED(hres))
522  *r = jsval_disp(ret);
523  }else {
524  *r = jsval_null();
525  }
526  }
527 
528  heap_pool_clear(mark);
529  jsstr_release(string);
530  return hres;
531 }
static int argc
Definition: ServiceArgs.c:12
Definition: jsstr.h:39
Definition: match.c:28
static jsval_t jsval_null(void)
Definition: jsval.h:130
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
#define argv
Definition: mplay32.c:18
unsigned int BOOL
Definition: ntddk_ex.h:94
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
struct match match
Definition: match.c:33
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
static jsval_t jsval_disp(IDispatch *obj)
Definition: jsval.h:117
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str, const match_state_t *result, IDispatch **ret)
Definition: jsregexp.c:372
static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsstr_t **input, match_state_t **result, BOOL *ret)
Definition: jsregexp.c:442
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
char string[160]
Definition: util.h:11
heap_pool_t * heap_pool_mark(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:182
#define SUCCEEDED(hr)
Definition: intsafe.h:57
void heap_pool_clear(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:146

◆ regexp_from_jsdisp()

static RegExpInstance* regexp_from_jsdisp ( jsdisp_t jsdisp)
inlinestatic

Definition at line 61 of file jsregexp.c.

62 {
63  return CONTAINING_RECORD(jsdisp, RegExpInstance, dispex);
64 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by create_regexp_var(), RegExp_destructor(), regexp_from_vdisp(), RegExp_get_global(), RegExp_get_ignoreCase(), RegExp_get_lastIndex(), RegExp_get_multiline(), RegExp_get_source(), regexp_match(), regexp_match_next(), RegExp_set_lastIndex(), and regexp_string_match().

◆ regexp_from_vdisp()

static RegExpInstance* regexp_from_vdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 66 of file jsregexp.c.

67 {
68  return regexp_from_jsdisp(vdisp->u.jsdisp);
69 }
jsdisp_t * jsdisp
Definition: jscript.h:144
union vdisp_t::@425 u
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61

Referenced by RegExp_toString(), and run_exec().

◆ RegExp_get_global()

static HRESULT RegExp_get_global ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 259 of file jsregexp.c.

260 {
261  TRACE("\n");
262 
263  *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_GLOB));
264  return S_OK;
265 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TRACE(s)
Definition: solgame.cpp:4
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
#define S_OK
Definition: intsafe.h:59
static jsval_t jsval_bool(BOOL b)
Definition: jsval.h:101
#define REG_GLOB
Definition: regexp.h:37

◆ RegExp_get_ignoreCase()

static HRESULT RegExp_get_ignoreCase ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 267 of file jsregexp.c.

268 {
269  TRACE("\n");
270 
271  *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_FOLD));
272  return S_OK;
273 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define REG_FOLD
Definition: regexp.h:36
#define TRACE(s)
Definition: solgame.cpp:4
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
#define S_OK
Definition: intsafe.h:59
static jsval_t jsval_bool(BOOL b)
Definition: jsval.h:101

◆ RegExp_get_lastIndex()

static HRESULT RegExp_get_lastIndex ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 298 of file jsregexp.c.

299 {
300  RegExpInstance *regexp = regexp_from_jsdisp(jsthis);
301 
302  TRACE("\n");
303 
304  return jsval_copy(regexp->last_index_val, r);
305 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
jsval_t last_index_val
Definition: jsregexp.c:34
HRESULT jsval_copy(jsval_t v, jsval_t *r)
Definition: jsutils.c:231
#define TRACE(s)
Definition: solgame.cpp:4
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61

◆ RegExp_get_multiline()

static HRESULT RegExp_get_multiline ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 275 of file jsregexp.c.

276 {
277  TRACE("\n");
278 
279  *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_MULTILINE));
280  return S_OK;
281 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define REG_MULTILINE
Definition: regexp.h:38
#define TRACE(s)
Definition: solgame.cpp:4
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
#define S_OK
Definition: intsafe.h:59
static jsval_t jsval_bool(BOOL b)
Definition: jsval.h:101

◆ RegExp_get_source()

static HRESULT RegExp_get_source ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 251 of file jsregexp.c.

252 {
253  TRACE("\n");
254 
256  return S_OK;
257 }
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const WCHAR * str
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define TRACE(s)
Definition: solgame.cpp:4
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
#define S_OK
Definition: intsafe.h:59

◆ regexp_match()

static HRESULT regexp_match ( script_ctx_t ctx,
jsdisp_t dispex,
jsstr_t jsstr,
BOOL  gflag,
match_result_t **  match_result,
DWORD result_cnt 
)
static

Definition at line 182 of file jsregexp.c.

184 {
188  DWORD i=0, ret_size = 0;
189  heap_pool_t *mark;
190  const WCHAR *str;
191  HRESULT hres;
192 
193  mark = heap_pool_mark(&ctx->tmp_heap);
194 
195  str = jsstr_flatten(jsstr);
196  if(!str)
197  return E_OUTOFMEMORY;
198 
199  result = alloc_match_state(This->jsregexp, &ctx->tmp_heap, str);
200  if(!result) {
201  heap_pool_clear(mark);
202  return E_OUTOFMEMORY;
203  }
204 
205  while(1) {
206  hres = do_regexp_match_next(ctx, This, 0, jsstr, str, result);
207  if(hres == S_FALSE) {
208  hres = S_OK;
209  break;
210  }
211 
212  if(FAILED(hres))
213  break;
214 
215  if(ret_size == i) {
216  if(ret) {
217  match_result_t *old_ret = ret;
218 
219  ret = heap_realloc(old_ret, (ret_size <<= 1) * sizeof(match_result_t));
220  if(!ret)
221  heap_free(old_ret);
222  }else {
223  ret = heap_alloc((ret_size=4) * sizeof(match_result_t));
224  }
225  if(!ret) {
227  break;
228  }
229  }
230 
231  ret[i].index = result->cp - str - result->match_len;
232  ret[i++].length = result->match_len;
233 
234  if(!gflag && !(This->jsregexp->flags & REG_GLOB)) {
235  hres = S_OK;
236  break;
237  }
238  }
239 
240  heap_pool_clear(mark);
241  if(FAILED(hres)) {
242  heap_free(ret);
243  return hres;
244  }
245 
246  *match_result = ret;
247  *result_cnt = i;
248  return S_OK;
249 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
static match_state_t * alloc_match_state(regexp_t *regexp, heap_pool_t *pool, const WCHAR *pos)
Definition: regexp.h:71
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, DWORD rem_flags, jsstr_t *jsstr, const WCHAR *str, match_state_t *ret)
Definition: jsregexp.c:78
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
#define S_OK
Definition: intsafe.h:59
#define REG_GLOB
Definition: regexp.h:37
heap_pool_t * heap_pool_mark(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:182
GLuint64EXT * result
Definition: glext.h:11304
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
void heap_pool_clear(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:146

Referenced by regexp_string_match().

◆ regexp_match_next()

HRESULT regexp_match_next ( script_ctx_t ctx,
jsdisp_t dispex,
DWORD  rem_flags,
jsstr_t jsstr,
match_state_t **  ret 
)

Definition at line 125 of file jsregexp.c.

127 {
128  RegExpInstance *regexp = regexp_from_jsdisp(dispex);
130  heap_pool_t *mark;
131  const WCHAR *str;
132  HRESULT hres;
133 
134  if((rem_flags & REM_CHECK_GLOBAL) && !(regexp->jsregexp->flags & REG_GLOB)) {
135  if(rem_flags & REM_ALLOC_RESULT)
136  *ret = NULL;
137  return S_FALSE;
138  }
139 
140  str = jsstr_flatten(jsstr);
141  if(!str)
142  return E_OUTOFMEMORY;
143 
144  if(rem_flags & REM_ALLOC_RESULT) {
145  match = alloc_match_state(regexp->jsregexp, NULL, str);
146  if(!match)
147  return E_OUTOFMEMORY;
148  *ret = match;
149  }
150 
151  mark = heap_pool_mark(&ctx->tmp_heap);
152 
153  if(rem_flags & REM_NO_PARENS) {
154  match = alloc_match_state(regexp->jsregexp, &ctx->tmp_heap, NULL);
155  if(!match) {
156  heap_pool_clear(mark);
157  return E_OUTOFMEMORY;
158  }
159  match->cp = (*ret)->cp;
160  match->match_len = (*ret)->match_len;
161  }else {
162  match = *ret;
163  }
164 
165  hres = do_regexp_match_next(ctx, regexp, rem_flags, jsstr, str, match);
166 
167  if(rem_flags & REM_NO_PARENS) {
168  (*ret)->cp = match->cp;
169  (*ret)->match_len = match->match_len;
170  }
171 
172  heap_pool_clear(mark);
173 
174  if(hres != S_OK && (rem_flags & REM_ALLOC_RESULT)) {
175  heap_free(match);
176  *ret = NULL;
177  }
178 
179  return hres;
180 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
static match_state_t * alloc_match_state(regexp_t *regexp, heap_pool_t *pool, const WCHAR *pos)
Definition: regexp.h:71
#define REM_ALLOC_RESULT
Definition: jscript.h:492
Definition: match.c:28
WORD flags
Definition: regexp.h:57
static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, DWORD rem_flags, jsstr_t *jsstr, const WCHAR *str, match_state_t *ret)
Definition: jsregexp.c:78
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
struct match match
Definition: match.c:33
#define REM_CHECK_GLOBAL
Definition: jscript.h:489
HRESULT hres
Definition: protocol.c:465
#define REM_NO_PARENS
Definition: jscript.h:493
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
#define REG_GLOB
Definition: regexp.h:37
heap_pool_t * heap_pool_mark(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:182
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
void heap_pool_clear(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:146

Referenced by regexp_string_match(), run_exec(), String_replace(), String_search(), and String_split().

◆ RegExp_set_lastIndex()

static HRESULT RegExp_set_lastIndex ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t  value 
)
static

Definition at line 307 of file jsregexp.c.

308 {
309  RegExpInstance *regexp = regexp_from_jsdisp(jsthis);
310  HRESULT hres;
311 
312  TRACE("\n");
313 
314  jsval_release(regexp->last_index_val);
315  hres = jsval_copy(value, &regexp->last_index_val);
316  if(FAILED(hres))
317  return hres;
318 
319  regexp->last_index = index_from_val(ctx, value);
320  return S_OK;
321 }
void jsval_release(jsval_t val)
Definition: jsutils.c:191
jsval_t last_index_val
Definition: jsregexp.c:34
HRESULT jsval_copy(jsval_t v, jsval_t *r)
Definition: jsutils.c:231
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static INT index_from_val(script_ctx_t *ctx, jsval_t v)
Definition: jsregexp.c:283
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
#define S_OK
Definition: intsafe.h:59
INT last_index
Definition: jsregexp.c:33

◆ regexp_string_match()

HRESULT regexp_string_match ( script_ctx_t ctx,
jsdisp_t re,
jsstr_t jsstr,
jsval_t r 
)

Definition at line 727 of file jsregexp.c.

728 {
729  static const WCHAR indexW[] = {'i','n','d','e','x',0};
730  static const WCHAR inputW[] = {'i','n','p','u','t',0};
731  static const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0};
732 
733  RegExpInstance *regexp = regexp_from_jsdisp(re);
734  match_result_t *match_result;
735  unsigned match_cnt, i;
736  const WCHAR *str;
737  jsdisp_t *array;
738  HRESULT hres;
739 
740  str = jsstr_flatten(jsstr);
741  if(!str)
742  return E_OUTOFMEMORY;
743 
744  if(!(regexp->jsregexp->flags & REG_GLOB)) {
746  heap_pool_t *mark;
747 
748  mark = heap_pool_mark(&ctx->tmp_heap);
749  match = alloc_match_state(regexp->jsregexp, &ctx->tmp_heap, str);
750  if(!match) {
751  heap_pool_clear(mark);
752  return E_OUTOFMEMORY;
753  }
754 
755  hres = regexp_match_next(ctx, &regexp->dispex, 0, jsstr, &match);
756  if(FAILED(hres)) {
757  heap_pool_clear(mark);
758  return hres;
759  }
760 
761  if(r) {
762  if(hres == S_OK) {
763  IDispatch *ret;
764 
765  hres = create_match_array(ctx, jsstr, match, &ret);
766  if(SUCCEEDED(hres))
767  *r = jsval_disp(ret);
768  }else {
769  *r = jsval_null();
770  }
771  }
772 
773  heap_pool_clear(mark);
774  return S_OK;
775  }
776 
777  hres = regexp_match(ctx, &regexp->dispex, jsstr, FALSE, &match_result, &match_cnt);
778  if(FAILED(hres))
779  return hres;
780 
781  if(!match_cnt) {
782  TRACE("no match\n");
783 
784  if(r)
785  *r = jsval_null();
786  return S_OK;
787  }
788 
789  hres = create_array(ctx, match_cnt, &array);
790  if(FAILED(hres))
791  return hres;
792 
793  for(i=0; i < match_cnt; i++) {
794  jsstr_t *tmp_str;
795 
796  tmp_str = jsstr_substr(jsstr, match_result[i].index, match_result[i].length);
797  if(!tmp_str) {
799  break;
800  }
801 
803  jsstr_release(tmp_str);
804  if(FAILED(hres))
805  break;
806  }
807 
808  while(SUCCEEDED(hres)) {
809  hres = jsdisp_propput_name(array, indexW, jsval_number(match_result[match_cnt-1].index));
810  if(FAILED(hres))
811  break;
812 
814  jsval_number(match_result[match_cnt-1].index + match_result[match_cnt-1].length));
815  if(FAILED(hres))
816  break;
817 
819  break;
820  }
821 
822  heap_free(match_result);
823 
824  if(SUCCEEDED(hres) && r)
825  *r = jsval_obj(array);
826  else
828  return hres;
829 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
static jsstr_t * jsstr_substr(jsstr_t *str, unsigned off, unsigned len)
Definition: jsstr.h:163
jsdisp_t dispex
Definition: jsregexp.c:29
static match_state_t * alloc_match_state(regexp_t *regexp, heap_pool_t *pool, const WCHAR *pos)
Definition: regexp.h:71
Definition: jsstr.h:39
Definition: match.c:28
static jsval_t jsval_null(void)
Definition: jsval.h:130
static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr, BOOL gflag, match_result_t **match_result, DWORD *result_cnt)
Definition: jsregexp.c:182
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
WORD flags
Definition: regexp.h:57
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const WCHAR inputW[]
Definition: htmlelem.c:31
const WCHAR * str
struct match match
Definition: match.c:33
GLuint index
Definition: glext.h:6031
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define TRACE(s)
Definition: solgame.cpp:4
static jsval_t jsval_disp(IDispatch *obj)
Definition: jsval.h:117
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str, const match_state_t *result, IDispatch **ret)
Definition: jsregexp.c:372
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags, jsstr_t *jsstr, match_state_t **ret)
Definition: jsregexp.c:125
HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
Definition: dispex.c:1349
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
HRESULT create_array(script_ctx_t *ctx, DWORD length, jsdisp_t **ret)
Definition: array.c:1381
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
Definition: dispex.c:1344
#define REG_GLOB
Definition: regexp.h:37
static const WCHAR lastIndexW[]
Definition: jsregexp.c:41
heap_pool_t * heap_pool_mark(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:182
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum GLdouble GLenum GLint GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLenum GLfloat GLenum GLfloat GLenum GLushort const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLenum GLint GLenum GLint GLenum GLint GLuint GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble const GLfloat GLenum const GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLint GLint GLsizei GLsizei GLenum GLuint GLenum array
Definition: glfuncs.h:320
static jsval_t jsval_number(double n)
Definition: jsval.h:144
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
void heap_pool_clear(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:146

Referenced by String_match().

◆ RegExp_test()

static HRESULT RegExp_test ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 533 of file jsregexp.c.

535 {
537  jsstr_t *undef_str;
538  heap_pool_t *mark;
539  BOOL b;
540  HRESULT hres;
541 
542  TRACE("\n");
543 
544  mark = heap_pool_mark(&ctx->tmp_heap);
545  hres = run_exec(ctx, jsthis, argc ? argv[0] : jsval_string(undef_str = jsstr_undefined()), NULL, &match, &b);
546  heap_pool_clear(mark);
547  if(!argc)
548  jsstr_release(undef_str);
549  if(FAILED(hres))
550  return hres;
551 
552  if(r)
553  *r = jsval_bool(b);
554  return S_OK;
555 }
static int argc
Definition: ServiceArgs.c:12
jsstr_t * jsstr_undefined(void)
Definition: jsstr.c:293
Definition: jsstr.h:39
Definition: match.c:28
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
#define argv
Definition: mplay32.c:18
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
struct match match
Definition: match.c:33
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsstr_t **input, match_state_t **result, BOOL *ret)
Definition: jsregexp.c:442
heap_pool_t tmp_heap
Definition: jscript.h:427
#define S_OK
Definition: intsafe.h:59
static jsval_t jsval_bool(BOOL b)
Definition: jsval.h:101
heap_pool_t * heap_pool_mark(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:182
void heap_pool_clear(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:146

◆ RegExp_toString()

static HRESULT RegExp_toString ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 323 of file jsregexp.c.

325 {
326  RegExpInstance *regexp;
327  unsigned len, f;
328  jsstr_t *ret;
329  WCHAR *ptr;
330 
331  TRACE("\n");
332 
333  if(!is_vclass(jsthis, JSCLASS_REGEXP)) {
334  FIXME("Not a RegExp\n");
335  return E_NOTIMPL;
336  }
337 
338  regexp = regexp_from_vdisp(jsthis);
339 
340  if(!r)
341  return S_OK;
342 
343  len = jsstr_length(regexp->str) + 2;
344 
345  f = regexp->jsregexp->flags;
346  if(f & REG_FOLD)
347  len++;
348  if(f & REG_GLOB)
349  len++;
350  if(f & REG_MULTILINE)
351  len++;
352 
353  ret = jsstr_alloc_buf(len, &ptr);
354  if(!ret)
355  return E_OUTOFMEMORY;
356 
357  *ptr++ = '/';
358  ptr += jsstr_flush(regexp->str, ptr);
359  *ptr++ = '/';
360 
361  if(f & REG_FOLD)
362  *ptr++ = 'i';
363  if(f & REG_GLOB)
364  *ptr++ = 'g';
365  if(f & REG_MULTILINE)
366  *ptr++ = 'm';
367 
368  *r = jsval_string(ret);
369  return S_OK;
370 }
Definition: jsstr.h:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
WORD flags
Definition: regexp.h:57
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
#define REG_MULTILINE
Definition: regexp.h:38
#define REG_FOLD
Definition: regexp.h:36
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
Definition: jscript.h:509
static RegExpInstance * regexp_from_vdisp(vdisp_t *vdisp)
Definition: jsregexp.c:66
int ret
GLenum GLsizei len
Definition: glext.h:6722
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
#define E_NOTIMPL
Definition: ddrawi.h:99
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69
#define REG_GLOB
Definition: regexp.h:37
jsstr_t * str
Definition: jsregexp.c:32

◆ RegExp_value()

static HRESULT RegExp_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 557 of file jsregexp.c.

559 {
560  TRACE("\n");
561 
562  switch(flags) {
563  case INVOKE_FUNC:
565  default:
566  FIXME("unimplemented flags %x\n", flags);
567  return E_NOTIMPL;
568  }
569 
570  return S_OK;
571 }
#define JS_E_FUNCTION_EXPECTED
Definition: jscript.h:552
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440

◆ RegExpConstr_get_idx1()

static HRESULT RegExpConstr_get_idx1 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 843 of file jsregexp.c.

844 {
845  TRACE("\n");
846  return global_idx(ctx, 0, r);
847 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx2()

static HRESULT RegExpConstr_get_idx2 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 849 of file jsregexp.c.

850 {
851  TRACE("\n");
852  return global_idx(ctx, 1, r);
853 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx3()

static HRESULT RegExpConstr_get_idx3 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 855 of file jsregexp.c.

856 {
857  TRACE("\n");
858  return global_idx(ctx, 2, r);
859 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx4()

static HRESULT RegExpConstr_get_idx4 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 861 of file jsregexp.c.

862 {
863  TRACE("\n");
864  return global_idx(ctx, 3, r);
865 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx5()

static HRESULT RegExpConstr_get_idx5 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 867 of file jsregexp.c.

868 {
869  TRACE("\n");
870  return global_idx(ctx, 4, r);
871 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx6()

static HRESULT RegExpConstr_get_idx6 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 873 of file jsregexp.c.

874 {
875  TRACE("\n");
876  return global_idx(ctx, 5, r);
877 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx7()

static HRESULT RegExpConstr_get_idx7 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 879 of file jsregexp.c.

880 {
881  TRACE("\n");
882  return global_idx(ctx, 6, r);
883 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx8()

static HRESULT RegExpConstr_get_idx8 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 885 of file jsregexp.c.

886 {
887  TRACE("\n");
888  return global_idx(ctx, 7, r);
889 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_idx9()

static HRESULT RegExpConstr_get_idx9 ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 891 of file jsregexp.c.

892 {
893  TRACE("\n");
894  return global_idx(ctx, 8, r);
895 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT global_idx(script_ctx_t *ctx, DWORD idx, jsval_t *r)
Definition: jsregexp.c:831
#define TRACE(s)
Definition: solgame.cpp:4

◆ RegExpConstr_get_leftContext()

static HRESULT RegExpConstr_get_leftContext ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 897 of file jsregexp.c.

898 {
899  jsstr_t *ret;
900 
901  TRACE("\n");
902 
903  ret = jsstr_substr(ctx->last_match, 0, ctx->last_match_index);
904  if(!ret)
905  return E_OUTOFMEMORY;
906 
907  *r = jsval_string(ret);
908  return S_OK;
909 }
static jsstr_t * jsstr_substr(jsstr_t *str, unsigned off, unsigned len)
Definition: jsstr.h:163
jsstr_t * last_match
Definition: jscript.h:436
Definition: jsstr.h:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define TRACE(s)
Definition: solgame.cpp:4
DWORD last_match_index
Definition: jscript.h:438
int ret
#define S_OK
Definition: intsafe.h:59

◆ RegExpConstr_get_rightContext()

static HRESULT RegExpConstr_get_rightContext ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 911 of file jsregexp.c.

912 {
913  jsstr_t *ret;
914 
915  TRACE("\n");
916 
919  if(!ret)
920  return E_OUTOFMEMORY;
921 
922  *r = jsval_string(ret);
923  return S_OK;
924 }
static jsstr_t * jsstr_substr(jsstr_t *str, unsigned off, unsigned len)
Definition: jsstr.h:163
jsstr_t * last_match
Definition: jscript.h:436
Definition: jsstr.h:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define TRACE(s)
Definition: solgame.cpp:4
DWORD last_match_index
Definition: jscript.h:438
int ret
#define S_OK
Definition: intsafe.h:59
DWORD last_match_length
Definition: jscript.h:439

◆ RegExpConstr_value()

static HRESULT RegExpConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 926 of file jsregexp.c.

928 {
929  TRACE("\n");
930 
931  switch(flags) {
932  case DISPATCH_METHOD:
933  if(argc) {
934  if(is_object_instance(argv[0])) {
935  jsdisp_t *jsdisp = iface_to_jsdisp(get_object(argv[0]));
936  if(jsdisp) {
937  if(is_class(jsdisp, JSCLASS_REGEXP)) {
938  if(argc > 1 && !is_undefined(argv[1])) {
939  jsdisp_release(jsdisp);
941  }
942 
943  if(r)
944  *r = jsval_obj(jsdisp);
945  else
946  jsdisp_release(jsdisp);
947  return S_OK;
948  }
949  jsdisp_release(jsdisp);
950  }
951  }
952  }
953  /* fall through */
954  case DISPATCH_CONSTRUCT: {
955  jsdisp_t *ret;
956  HRESULT hres;
957 
958  if(!argc) {
959  FIXME("no args\n");
960  return E_NOTIMPL;
961  }
962 
963  hres = create_regexp_var(ctx, argv[0], argc > 1 ? argv+1 : NULL, &ret);
964  if(FAILED(hres))
965  return hres;
966 
967  if(r)
968  *r = jsval_obj(ret);
969  else
971  return S_OK;
972  }
973  default:
974  FIXME("unimplemented flags: %x\n", flags);
975  return E_NOTIMPL;
976  }
977 
978  return S_OK;
979 }
static int argc
Definition: ServiceArgs.c:12
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static BOOL is_undefined(jsval_t v)
Definition: jsval.h:171
#define argv
Definition: mplay32.c:18
HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg, jsdisp_t **ret)
Definition: jsregexp.c:674
#define DISPATCH_METHOD
Definition: oleauto.h:1006
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:504
#define JS_E_REGEXP_SYNTAX
Definition: jscript.h:563
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1060
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
HRESULT throw_regexp_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:430

Referenced by create_regexp_constr().

◆ run_exec()

static HRESULT run_exec ( script_ctx_t ctx,
vdisp_t jsthis,
jsval_t  arg,
jsstr_t **  input,
match_state_t **  result,
BOOL ret 
)
static

Definition at line 442 of file jsregexp.c.

444 {
445  RegExpInstance *regexp;
447  DWORD last_index = 0;
448  const WCHAR *string;
449  jsstr_t *jsstr;
450  HRESULT hres;
451 
452  if(!is_vclass(jsthis, JSCLASS_REGEXP)) {
453  FIXME("Not a RegExp\n");
454  return E_NOTIMPL;
455  }
456 
457  regexp = regexp_from_vdisp(jsthis);
458 
459  hres = to_flat_string(ctx, arg, &jsstr, &string);
460  if(FAILED(hres))
461  return hres;
462 
463  if(regexp->jsregexp->flags & REG_GLOB) {
464  if(regexp->last_index < 0) {
465  jsstr_release(jsstr);
466  set_last_index(regexp, 0);
467  *ret = FALSE;
468  if(input)
469  *input = jsstr_empty();
470  return S_OK;
471  }
472 
473  last_index = regexp->last_index;
474  }
475 
476  match = alloc_match_state(regexp->jsregexp, &ctx->tmp_heap, string+last_index);
477  if(!match) {
478  jsstr_release(jsstr);
479  return E_OUTOFMEMORY;
480  }
481 
482  hres = regexp_match_next(ctx, &regexp->dispex, REM_RESET_INDEX, jsstr, &match);
483  if(FAILED(hres)) {
484  jsstr_release(jsstr);
485  return hres;
486  }
487 
488  *result = match;
489  *ret = hres == S_OK;
490  if(input)
491  *input = jsstr;
492  else
493  jsstr_release(jsstr);
494  return S_OK;
495 }
jsdisp_t dispex
Definition: jsregexp.c:29
static match_state_t * alloc_match_state(regexp_t *regexp, heap_pool_t *pool, const WCHAR *pos)
Definition: regexp.h:71
Definition: jsstr.h:39
Definition: match.c:28
WORD flags
Definition: regexp.h:57
static void set_last_index(RegExpInstance *This, DWORD last_index)
Definition: jsregexp.c:71
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
struct match match
Definition: match.c:33
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
Definition: jscript.h:509
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REM_RESET_INDEX
Definition: jscript.h:490
static RegExpInstance * regexp_from_vdisp(vdisp_t *vdisp)
Definition: jsregexp.c:66
int ret
heap_pool_t tmp_heap
Definition: jscript.h:427
char string[160]
Definition: util.h:11
HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags, jsstr_t *jsstr, match_state_t **ret)
Definition: jsregexp.c:125
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
GLenum GLenum GLenum input
Definition: glext.h:9031
#define E_NOTIMPL
Definition: ddrawi.h:99
INT last_index
Definition: jsregexp.c:33
#define REG_GLOB
Definition: regexp.h:37
GLuint64EXT * result
Definition: glext.h:11304
HRESULT to_flat_string(script_ctx_t *, jsval_t, jsstr_t **, const WCHAR **) DECLSPEC_HIDDEN
Definition: jsutils.c:798

Referenced by RegExp_exec(), and RegExp_test().

◆ set_last_index()

static void set_last_index ( RegExpInstance This,
DWORD  last_index 
)
static

Definition at line 71 of file jsregexp.c.

72 {
73  This->last_index = last_index;
74  jsval_release(This->last_index_val);
75  This->last_index_val = jsval_number(last_index);
76 }
void jsval_release(jsval_t val)
Definition: jsutils.c:191
static jsval_t jsval_number(double n)
Definition: jsval.h:144

Referenced by do_regexp_match_next(), and run_exec().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ execW

const WCHAR execW[] = {'e','x','e','c',0}
static

Definition at line 43 of file jsregexp.c.

◆ globalW

const WCHAR globalW[] = {'g','l','o','b','a','l',0}
static

Definition at line 38 of file jsregexp.c.

Referenced by test_RegQueryValueExPerformanceData().

◆ idx1W

const WCHAR idx1W[] = {'$','1',0}
static

Definition at line 51 of file jsregexp.c.

◆ idx2W

const WCHAR idx2W[] = {'$','2',0}
static

Definition at line 52 of file jsregexp.c.

◆ idx3W

const WCHAR idx3W[] = {'$','3',0}
static

Definition at line 53 of file jsregexp.c.

◆ idx4W

const WCHAR idx4W[] = {'$','4',0}
static

Definition at line 54 of file jsregexp.c.

◆ idx5W

const WCHAR idx5W[] = {'$','5',0}
static

Definition at line 55 of file jsregexp.c.

◆ idx6W

const WCHAR idx6W[] = {'$','6',0}
static

Definition at line 56 of file jsregexp.c.

◆ idx7W

const WCHAR idx7W[] = {'$','7',0}
static

Definition at line 57 of file jsregexp.c.

◆ idx8W

const WCHAR idx8W[] = {'$','8',0}
static

Definition at line 58 of file jsregexp.c.

◆ idx9W

const WCHAR idx9W[] = {'$','9',0}
static

Definition at line 59 of file jsregexp.c.

◆ ignoreCaseW

const WCHAR ignoreCaseW[] = {'i','g','n','o','r','e','C','a','s','e',0}
static

Definition at line 39 of file jsregexp.c.

◆ lastIndexW

const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0}
static

Definition at line 41 of file jsregexp.c.

Referenced by create_match_array(), and regexp_string_match().

◆ leftContextW

const WCHAR leftContextW[]
static
Initial value:
=
{'l','e','f','t','C','o','n','t','e','x','t',0}

Definition at line 46 of file jsregexp.c.

◆ multilineW

const WCHAR multilineW[] = {'m','u','l','t','i','l','i','n','e',0}
static

Definition at line 40 of file jsregexp.c.

◆ RegExp_info

const builtin_info_t RegExp_info
static
Initial value:
= {
}
static void RegExp_destructor(jsdisp_t *dispex)
Definition: jsregexp.c:573
static const builtin_prop_t RegExp_props[]
Definition: jsregexp.c:584
smooth NULL
Definition: ftsmooth.c:416
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:557

Definition at line 595 of file jsregexp.c.

Referenced by alloc_regexp().

◆ RegExp_props

const builtin_prop_t RegExp_props[]
static
Initial value:
= {
}
static HRESULT RegExp_get_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:298
static const WCHAR toStringW[]
Definition: jsregexp.c:42
static HRESULT RegExp_set_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
Definition: jsregexp.c:307
smooth NULL
Definition: ftsmooth.c:416
static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:533
static const WCHAR execW[]
Definition: jsregexp.c:43
static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:259
static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:275
static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:267
static const WCHAR multilineW[]
Definition: jsregexp.c:40
#define PROPF_METHOD
Definition: jscript.h:97
static const WCHAR ignoreCaseW[]
Definition: jsregexp.c:39
static const WCHAR sourceW[]
Definition: jsregexp.c:37
static HRESULT RegExp_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:323
static HRESULT RegExp_get_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:251
static const WCHAR lastIndexW[]
Definition: jsregexp.c:41
static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:497
static const WCHAR testW[]
Definition: jsregexp.c:44
static const WCHAR globalW[]
Definition: jsregexp.c:38

Definition at line 584 of file jsregexp.c.

◆ RegExpConstr_info

const builtin_info_t RegExpConstr_info
static
Initial value:
= {
}
static const builtin_prop_t RegExpConstr_props[]
Definition: jsregexp.c:981
smooth NULL
Definition: ftsmooth.c:416
#define DEFAULT_FUNCTION_VALUE
Definition: jscript.h:315
#define ARRAY_SIZE(a)
Definition: main.h:24

Definition at line 995 of file jsregexp.c.

Referenced by create_regexp_constr().

◆ RegExpConstr_props

const builtin_prop_t RegExpConstr_props[]
static
Initial value:
= {
}
static HRESULT RegExpConstr_get_leftContext(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:897
static HRESULT RegExpConstr_get_rightContext(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:911
static HRESULT RegExpConstr_get_idx4(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:861
static const WCHAR idx3W[]
Definition: jsregexp.c:53
static const WCHAR rightContextW[]
Definition: jsregexp.c:48
static const WCHAR idx4W[]
Definition: jsregexp.c:54
static const WCHAR leftContextW[]
Definition: jsregexp.c:46
static HRESULT RegExpConstr_get_idx3(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:855
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR idx6W[]
Definition: jsregexp.c:56
static HRESULT RegExpConstr_get_idx1(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:843
static HRESULT RegExpConstr_get_idx5(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:867
static HRESULT RegExpConstr_get_idx2(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:849
static HRESULT RegExpConstr_get_idx6(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:873
static const WCHAR idx9W[]
Definition: jsregexp.c:59
static const WCHAR idx8W[]
Definition: jsregexp.c:58
static const WCHAR idx5W[]
Definition: jsregexp.c:55
static HRESULT RegExpConstr_get_idx8(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:885
static const WCHAR idx2W[]
Definition: jsregexp.c:52
HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
Definition: dispex.c:555
static HRESULT RegExpConstr_get_idx7(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:879
static HRESULT RegExpConstr_get_idx9(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:891
static const WCHAR idx7W[]
Definition: jsregexp.c:57
static const WCHAR idx1W[]
Definition: jsregexp.c:51

Definition at line 981 of file jsregexp.c.

◆ RegExpInst_info

const builtin_info_t RegExpInst_info
static
Initial value:
= {
}
static void RegExp_destructor(jsdisp_t *dispex)
Definition: jsregexp.c:573
smooth NULL
Definition: ftsmooth.c:416
static const builtin_prop_t RegExpInst_props[]
Definition: jsregexp.c:604
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:557

Definition at line 612 of file jsregexp.c.

Referenced by alloc_regexp().

◆ RegExpInst_props

const builtin_prop_t RegExpInst_props[]
static
Initial value:
= {
}
static HRESULT RegExp_get_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:298
static HRESULT RegExp_set_lastIndex(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
Definition: jsregexp.c:307
smooth NULL
Definition: ftsmooth.c:416
static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:259
static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:275
static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:267
static const WCHAR multilineW[]
Definition: jsregexp.c:40
static const WCHAR ignoreCaseW[]
Definition: jsregexp.c:39
static const WCHAR sourceW[]
Definition: jsregexp.c:37
static HRESULT RegExp_get_source(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: jsregexp.c:251
static const WCHAR lastIndexW[]
Definition: jsregexp.c:41
static const WCHAR globalW[]
Definition: jsregexp.c:38

Definition at line 604 of file jsregexp.c.

◆ rightContextW

const WCHAR rightContextW[]
static
Initial value:
=
{'r','i','g','h','t','C','o','n','t','e','x','t',0}

Definition at line 48 of file jsregexp.c.

◆ sourceW

◆ testW

◆ toStringW

const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}
static

Definition at line 42 of file jsregexp.c.