xaudio2: Implement IXAudio2SourceVoice::Discontinuity.
[wine/multimedia.git] / dlls / vbscript / regexp.h
blob5ceb8a0c77ae7d92428dbb2e83bbb5a75d78ae41
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Code in this file is based on files:
21 * js/src/jsregexp.h
22 * js/src/jsregexp.c
23 * from Mozilla project, released under LGPL 2.1 or later.
25 * The Original Code is Mozilla Communicator client code, released
26 * March 31, 1998.
28 * The Initial Developer of the Original Code is
29 * Netscape Communications Corporation.
30 * Portions created by the Initial Developer are Copyright (C) 1998
31 * the Initial Developer. All Rights Reserved.
34 #define REG_FOLD 0x01 /* fold uppercase to lowercase */
35 #define REG_GLOB 0x02 /* global exec, creates array of matches */
36 #define REG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
37 #define REG_STICKY 0x08 /* only match starting at lastIndex */
39 typedef struct RECapture {
40 ptrdiff_t index; /* start of contents, -1 for empty */
41 size_t length; /* length of capture */
42 } RECapture;
44 typedef struct match_state_t {
45 const WCHAR *cp;
46 DWORD match_len;
48 DWORD paren_count;
49 RECapture parens[1];
50 } match_state_t;
52 typedef BYTE jsbytecode;
54 typedef struct regexp_t {
55 WORD flags; /* flags, see jsapi.h's REG_* defines */
56 size_t parenCount; /* number of parenthesized submatches */
57 size_t classCount; /* count [...] bitmaps */
58 struct RECharSet *classList; /* list of [...] bitmaps */
59 const WCHAR *source; /* locked source string, sans // */
60 DWORD source_len;
61 jsbytecode program[1]; /* regular expression bytecode */
62 } regexp_t;
64 regexp_t* regexp_new(void*, heap_pool_t*, const WCHAR*, DWORD, WORD, BOOL) DECLSPEC_HIDDEN;
65 void regexp_destroy(regexp_t*) DECLSPEC_HIDDEN;
66 HRESULT regexp_execute(regexp_t*, void*, heap_pool_t*, const WCHAR*,
67 DWORD, match_state_t*) DECLSPEC_HIDDEN;
68 HRESULT regexp_set_flags(regexp_t**, void*, heap_pool_t*, WORD) DECLSPEC_HIDDEN;
70 static inline match_state_t* alloc_match_state(regexp_t *regexp,
71 heap_pool_t *pool, const WCHAR *pos)
73 size_t size = offsetof(match_state_t, parens) + regexp->parenCount*sizeof(RECapture);
74 match_state_t *ret;
76 ret = pool ? heap_pool_alloc(pool, size) : heap_alloc(size);
77 if(!ret)
78 return NULL;
80 ret->cp = pos;
81 return ret;