Module: wine Branch: master Commit: 2270f14e1b7bbdfc3d8ce1ea0b10c2603e36b283 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2270f14e1b7bbdfc3d8ce1ea0b...
Author: Piotr Caban piotr@codeweavers.com Date: Tue Feb 19 12:40:12 2013 +0100
vbscript: Added RegExp2 flags getters and setters implementation.
---
dlls/vbscript/regexp.c | 18 +++++++++++++ dlls/vbscript/regexp.h | 1 + dlls/vbscript/vbregexp.c | 64 +++++++++++++++++++++++++++++++++++++-------- 3 files changed, 71 insertions(+), 12 deletions(-)
diff --git a/dlls/vbscript/regexp.c b/dlls/vbscript/regexp.c index 0bd59ac..c74ded5 100644 --- a/dlls/vbscript/regexp.c +++ b/dlls/vbscript/regexp.c @@ -3286,3 +3286,21 @@ out: heap_pool_clear(mark); return re; } + +HRESULT regexp_set_flags(regexp_t **regexp, void *cx, heap_pool_t *pool, WORD flags) +{ + if(((*regexp)->flags & REG_FOLD) != (flags & REG_FOLD)) { + regexp_t *new_regexp = regexp_new(cx, pool, (*regexp)->source, + (*regexp)->source_len, flags, FALSE); + + if(!new_regexp) + return E_FAIL; + + regexp_destroy(*regexp); + *regexp = new_regexp; + }else { + (*regexp)->flags = flags; + } + + return S_OK; +} diff --git a/dlls/vbscript/regexp.h b/dlls/vbscript/regexp.h index de86aa2..5ceb8a0 100644 --- a/dlls/vbscript/regexp.h +++ b/dlls/vbscript/regexp.h @@ -65,6 +65,7 @@ regexp_t* regexp_new(void*, heap_pool_t*, const WCHAR*, DWORD, WORD, BOOL) DECLS void regexp_destroy(regexp_t*) DECLSPEC_HIDDEN; HRESULT regexp_execute(regexp_t*, void*, heap_pool_t*, const WCHAR*, DWORD, match_state_t*) DECLSPEC_HIDDEN; +HRESULT regexp_set_flags(regexp_t**, void*, heap_pool_t*, WORD) DECLSPEC_HIDDEN;
static inline match_state_t* alloc_match_state(regexp_t *regexp, heap_pool_t *pool, const WCHAR *pos) diff --git a/dlls/vbscript/vbregexp.c b/dlls/vbscript/vbregexp.c index 39ff59d..d1fbcab 100644 --- a/dlls/vbscript/vbregexp.c +++ b/dlls/vbscript/vbregexp.c @@ -247,43 +247,79 @@ static HRESULT WINAPI RegExp2_put_Pattern(IRegExp2 *iface, BSTR pattern) static HRESULT WINAPI RegExp2_get_IgnoreCase(IRegExp2 *iface, VARIANT_BOOL *pIgnoreCase) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%p)\n", This, pIgnoreCase); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, pIgnoreCase); + + if(!pIgnoreCase) + return E_POINTER; + + *pIgnoreCase = This->flags & REG_FOLD ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; }
static HRESULT WINAPI RegExp2_put_IgnoreCase(IRegExp2 *iface, VARIANT_BOOL ignoreCase) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%s)\n", This, ignoreCase ? "true" : "false"); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, ignoreCase ? "true" : "false"); + + if(ignoreCase) + This->flags |= REG_FOLD; + else + This->flags &= ~REG_FOLD; + return S_OK; }
static HRESULT WINAPI RegExp2_get_Global(IRegExp2 *iface, VARIANT_BOOL *pGlobal) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%p)\n", This, pGlobal); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, pGlobal); + + if(!pGlobal) + return E_POINTER; + + *pGlobal = This->flags & REG_GLOB ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; }
static HRESULT WINAPI RegExp2_put_Global(IRegExp2 *iface, VARIANT_BOOL global) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%s)\n", This, global ? "true" : "false"); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, global ? "true" : "false"); + + if(global) + This->flags |= REG_GLOB; + else + This->flags &= ~REG_GLOB; + return S_OK; }
static HRESULT WINAPI RegExp2_get_Multiline(IRegExp2 *iface, VARIANT_BOOL *pMultiline) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%p)\n", This, pMultiline); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, pMultiline); + + if(!pMultiline) + return E_POINTER; + + *pMultiline = This->flags & REG_MULTILINE ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; }
static HRESULT WINAPI RegExp2_put_Multiline(IRegExp2 *iface, VARIANT_BOOL multiline) { RegExp2 *This = impl_from_IRegExp2(iface); - FIXME("(%p)->(%s)\n", This, multiline ? "true" : "false"); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, multiline ? "true" : "false"); + + if(multiline) + This->flags |= REG_MULTILINE; + else + This->flags &= ~REG_MULTILINE; + return S_OK; }
static HRESULT WINAPI RegExp2_Execute(IRegExp2 *iface, @@ -313,6 +349,10 @@ static HRESULT WINAPI RegExp2_Test(IRegExp2 *iface, BSTR sourceString, VARIANT_B strlenW(This->pattern), This->flags, FALSE); if(!This->regexp) return E_FAIL; + }else { + hres = regexp_set_flags(&This->regexp, NULL, &This->pool, This->flags); + if(FAILED(hres)) + return hres; }
mark = heap_pool_mark(&This->pool);