ReactOS  0.4.13-dev-235-g7373cb3
jsstr.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _jsstr_t
 
struct  jsstr_inline_t
 
struct  jsstr_heap_t
 
struct  jsstr_rope_t
 

Macros

#define JSSTR_LENGTH_SHIFT   4
 
#define JSSTR_MAX_LENGTH   ((1 << (32-JSSTR_LENGTH_SHIFT))-1)
 
#define JSSTR_FLAGS_MASK   ((1 << JSSTR_LENGTH_SHIFT)-1)
 
#define JSSTR_FLAG_LBIT   1
 
#define JSSTR_FLAG_FLAT   2
 
#define JSSTR_FLAG_TAG_MASK   3
 

Enumerations

enum  jsstr_tag_t { JSSTR_INLINE = JSSTR_FLAG_FLAT, JSSTR_HEAP = JSSTR_FLAG_FLAT|JSSTR_FLAG_LBIT, JSSTR_ROPE = JSSTR_FLAG_LBIT }
 

Functions

static unsigned jsstr_length (jsstr_t *str)
 
static jsstr_tag_t jsstr_tag (jsstr_t *str)
 
static BOOL jsstr_is_inline (jsstr_t *str)
 
static BOOL jsstr_is_heap (jsstr_t *str)
 
static BOOL jsstr_is_rope (jsstr_t *str)
 
jsstr_tjsstr_alloc_len (const WCHAR *, unsigned) DECLSPEC_HIDDEN
 
jsstr_tjsstr_alloc_buf (unsigned, WCHAR **) DECLSPEC_HIDDEN
 
static jsstr_tjsstr_alloc (const WCHAR *str)
 
void jsstr_free (jsstr_t *) DECLSPEC_HIDDEN
 
static void jsstr_release (jsstr_t *str)
 
static jsstr_tjsstr_addref (jsstr_t *str)
 
static jsstr_inline_tjsstr_as_inline (jsstr_t *str)
 
static jsstr_heap_tjsstr_as_heap (jsstr_t *str)
 
static jsstr_rope_tjsstr_as_rope (jsstr_t *str)
 
const WCHARjsstr_rope_flatten (jsstr_rope_t *) DECLSPEC_HIDDEN
 
static const WCHARjsstr_flatten (jsstr_t *str)
 
void jsstr_extract (jsstr_t *, unsigned, unsigned, WCHAR *) DECLSPEC_HIDDEN
 
static unsigned jsstr_flush (jsstr_t *str, WCHAR *buf)
 
static jsstr_tjsstr_substr (jsstr_t *str, unsigned off, unsigned len)
 
int jsstr_cmp (jsstr_t *, jsstr_t *) DECLSPEC_HIDDEN
 
static BOOL jsstr_eq (jsstr_t *left, jsstr_t *right)
 
jsstr_tjsstr_concat (jsstr_t *, jsstr_t *) DECLSPEC_HIDDEN
 
jsstr_tjsstr_nan (void) DECLSPEC_HIDDEN
 
jsstr_tjsstr_empty (void) DECLSPEC_HIDDEN
 
jsstr_tjsstr_undefined (void) DECLSPEC_HIDDEN
 
jsstr_tjsstr_null_bstr (void) DECLSPEC_HIDDEN
 
BOOL is_null_bstr (jsstr_t *) DECLSPEC_HIDDEN
 
BOOL init_strings (void) DECLSPEC_HIDDEN
 
void free_strings (void) DECLSPEC_HIDDEN
 
const chardebugstr_jsstr (jsstr_t *) DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ JSSTR_FLAG_FLAT

#define JSSTR_FLAG_FLAT   2

Definition at line 49 of file jsstr.h.

◆ JSSTR_FLAG_LBIT

#define JSSTR_FLAG_LBIT   1

Definition at line 48 of file jsstr.h.

◆ JSSTR_FLAG_TAG_MASK

#define JSSTR_FLAG_TAG_MASK   3

Definition at line 50 of file jsstr.h.

◆ JSSTR_FLAGS_MASK

#define JSSTR_FLAGS_MASK   ((1 << JSSTR_LENGTH_SHIFT)-1)

Definition at line 46 of file jsstr.h.

◆ JSSTR_LENGTH_SHIFT

#define JSSTR_LENGTH_SHIFT   4

Definition at line 44 of file jsstr.h.

◆ JSSTR_MAX_LENGTH

#define JSSTR_MAX_LENGTH   ((1 << (32-JSSTR_LENGTH_SHIFT))-1)

Definition at line 45 of file jsstr.h.

Enumeration Type Documentation

◆ jsstr_tag_t

Enumerator
JSSTR_INLINE 
JSSTR_HEAP 
JSSTR_ROPE 

Definition at line 52 of file jsstr.h.

52  {
56 } jsstr_tag_t;
jsstr_tag_t
Definition: jsstr.h:52
#define JSSTR_FLAG_FLAT
Definition: jsstr.h:49
#define JSSTR_FLAG_LBIT
Definition: jsstr.h:48

Function Documentation

◆ debugstr_jsstr()

const char* debugstr_jsstr ( jsstr_t )

Definition at line 37 of file jsstr.c.

38 {
42 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
const WCHAR * str
const char * debugstr_jsstr(jsstr_t *str)
Definition: jsstr.c:37
GLint left
Definition: glext.h:7726
#define debugstr_wn
Definition: kernel32.h:33
static BOOL jsstr_is_heap(jsstr_t *str)
Definition: jsstr.h:73
static BOOL jsstr_is_inline(jsstr_t *str)
Definition: jsstr.h:68
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127
static jsstr_inline_t * jsstr_as_inline(jsstr_t *str)
Definition: jsstr.h:122

Referenced by array_join(), create_regexp(), debugstr_jsstr(), debugstr_jsval(), dump_instr_arg(), interp_regexp(), interp_str(), interp_throw_type(), JSGlobal_decodeURI(), JSGlobal_encodeURI(), String_idx_get(), and String_replace().

◆ free_strings()

void free_strings ( void  )

Definition at line 325 of file jsstr.c.

326 {
327  if(empty_str)
329  if(nan_str)
331  if(undefined_str)
333  if(null_bstr_str)
335 }
static jsstr_t * undefined_str
Definition: jsstr.c:281
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
static jsstr_t * empty_str
Definition: jsstr.c:281
static jsstr_t * nan_str
Definition: jsstr.c:281
static jsstr_t * null_bstr_str
Definition: jsstr.c:281

Referenced by DllMain().

◆ init_strings()

BOOL init_strings ( void  )

Definition at line 308 of file jsstr.c.

309 {
310  static const WCHAR NaNW[] = { 'N','a','N',0 };
311  static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
312  WCHAR *ptr;
313 
314  if(!(empty_str = jsstr_alloc_buf(0, &ptr)))
315  return FALSE;
316  if(!(nan_str = jsstr_alloc(NaNW)))
317  return FALSE;
319  return FALSE;
320  if(!(null_bstr_str = jsstr_alloc_buf(0, &ptr)))
321  return FALSE;
322  return TRUE;
323 }
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
#define TRUE
Definition: types.h:120
static jsstr_t * undefined_str
Definition: jsstr.c:281
static const WCHAR undefinedW[]
Definition: engine.c:37
static PVOID ptr
Definition: dispmode.c:27
static jsstr_t * empty_str
Definition: jsstr.c:281
static jsstr_t * nan_str
Definition: jsstr.c:281
static const WCHAR NaNW[]
Definition: global.c:32
__wchar_t WCHAR
Definition: xmlstorage.h:180
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69
static jsstr_t * null_bstr_str
Definition: jsstr.c:281

Referenced by DllMain().

◆ is_null_bstr()

BOOL is_null_bstr ( jsstr_t )

Definition at line 303 of file jsstr.c.

304 {
305  return str == null_bstr_str;
306 }
const WCHAR * str
static jsstr_t * null_bstr_str
Definition: jsstr.c:281

Referenced by jsval_to_variant(), and variant_change_type().

◆ jsstr_addref()

◆ jsstr_alloc()

static jsstr_t* jsstr_alloc ( const WCHAR str)
inlinestatic

Definition at line 103 of file jsstr.h.

104 {
105  return jsstr_alloc_len(str, strlenW(str));
106 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
jsstr_t * jsstr_alloc_len(const WCHAR *, unsigned) DECLSPEC_HIDDEN
Definition: jsstr.c:86
const WCHAR * str

Referenced by Bool_toString(), create_utc_string(), date_to_string(), Date_toISOString(), Date_toTimeString(), dateobj_to_date_string(), double_to_string(), Error_toString(), init_error_constr(), init_strings(), int_to_string(), JSGlobal_ScriptEngine(), Number_toString(), Object_get_value(), parse_json_value(), stack_push_string(), throw_error(), and to_string().

◆ jsstr_alloc_buf()

jsstr_t* jsstr_alloc_buf ( unsigned  ,
WCHAR **   
)

Definition at line 69 of file jsstr.c.

70 {
72 
73  if(len > JSSTR_MAX_LENGTH)
74  return NULL;
75 
77  if(!ret)
78  return NULL;
79 
80  jsstr_init(&ret->str, len, JSSTR_INLINE);
81  ret->buf[len] = 0;
82  *buf = ret->buf;
83  return &ret->str;
84 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define JSSTR_MAX_LENGTH
Definition: jsstr.h:45
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
static void jsstr_init(jsstr_t *str, unsigned len, jsstr_tag_t tag)
Definition: jsstr.c:63
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

Referenced by array_join(), Date_toLocaleDateString(), Date_toLocaleString(), Date_toLocaleTimeString(), do_attribute_tag_format(), do_attributeless_tag_format(), Error_toString(), function_to_string(), init_strings(), JSGlobal_decodeURI(), JSGlobal_decodeURIComponent(), JSGlobal_encodeURI(), JSGlobal_encodeURIComponent(), JSGlobal_escape(), JSGlobal_unescape(), jsstr_alloc_len(), jsstr_concat(), jsstr_substr(), number_to_exponential(), number_to_fixed(), Object_toString(), RegExp_toString(), String_concat(), String_toLowerCase(), String_toUpperCase(), and StringConstr_fromCharCode().

◆ jsstr_alloc_len()

jsstr_t* jsstr_alloc_len ( const WCHAR ,
unsigned   
)

Definition at line 86 of file jsstr.c.

87 {
88  jsstr_t *ret;
89  WCHAR *ptr;
90 
92  if(ret)
93  memcpy(ptr, buf, len*sizeof(WCHAR));
94 
95  return ret;
96 }
Definition: jsstr.h:39
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static PVOID ptr
Definition: dispmode.c:27
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69

Referenced by compiler_alloc_string_len(), create_match_array(), function_to_string(), interp_forin(), JSON_stringify(), jsstr_alloc(), rep_call(), String_replace(), String_split(), String_trim(), and variant_to_jsval().

◆ jsstr_as_heap()

static jsstr_heap_t* jsstr_as_heap ( jsstr_t str)
inlinestatic

Definition at line 127 of file jsstr.h.

128 {
130 }
const WCHAR * str
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 debugstr_jsstr(), jsstr_cmp_str(), jsstr_extract(), jsstr_flatten(), jsstr_flush(), jsstr_free(), jsstr_rope_flatten(), and jsstr_try_flat().

◆ jsstr_as_inline()

static jsstr_inline_t* jsstr_as_inline ( jsstr_t str)
inlinestatic

Definition at line 122 of file jsstr.h.

123 {
125 }
const WCHAR * str
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 debugstr_jsstr(), jsstr_cmp_str(), jsstr_extract(), jsstr_flatten(), jsstr_flush(), and jsstr_try_flat().

◆ jsstr_as_rope()

static jsstr_rope_t* jsstr_as_rope ( jsstr_t str)
inlinestatic

Definition at line 132 of file jsstr.h.

133 {
135 }
const WCHAR * str
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 debugstr_jsstr(), jsstr_cmp(), jsstr_cmp_str(), jsstr_concat(), jsstr_extract(), jsstr_flatten(), jsstr_flush(), and jsstr_free().

◆ jsstr_cmp()

int jsstr_cmp ( jsstr_t ,
jsstr_t  
)

Definition at line 189 of file jsstr.c.

190 {
191  unsigned len1 = jsstr_length(str1);
192  unsigned len2 = jsstr_length(str2);
193  const WCHAR *str;
194  int ret;
195 
196  str = jsstr_try_flat(str2);
197  if(str) {
198  ret = jsstr_cmp_str(str1, str, min(len1, len2));
199  return ret || len1 == len2 ? ret : -1;
200  }
201 
202  str = jsstr_try_flat(str1);
203  if(str) {
204  ret = jsstr_cmp_str(str2, str, min(len1, len2));
205  return ret || len1 == len2 ? -ret : 1;
206  }
207 
208  return ropes_cmp(jsstr_as_rope(str1), jsstr_as_rope(str2));
209 }
static int jsstr_cmp_str(jsstr_t *jsstr, const WCHAR *str, unsigned len)
Definition: jsstr.c:128
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static int ropes_cmp(jsstr_rope_t *left, jsstr_rope_t *right)
Definition: jsstr.c:156
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define min(a, b)
Definition: monoChain.cc:55
static const WCHAR * jsstr_try_flat(jsstr_t *str)
Definition: jsstr.c:182

Referenced by jsstr_eq(), less_eval(), and sort_cmp().

◆ jsstr_concat()

jsstr_t* jsstr_concat ( jsstr_t ,
jsstr_t  
)

Definition at line 211 of file jsstr.c.

212 {
213  unsigned len1, len2;
214  jsstr_t *ret;
215  WCHAR *ptr;
216 
217  len1 = jsstr_length(str1);
218  if(!len1)
219  return jsstr_addref(str2);
220 
221  len2 = jsstr_length(str2);
222  if(!len2)
223  return jsstr_addref(str1);
224 
225  if(len1 + len2 >= JSSTR_SHORT_STRING_LENGTH) {
226  unsigned depth, depth2;
228 
229  depth = jsstr_is_rope(str1) ? jsstr_as_rope(str1)->depth : 0;
230  depth2 = jsstr_is_rope(str2) ? jsstr_as_rope(str2)->depth : 0;
231  if(depth2 > depth)
232  depth = depth2;
233 
234  if(depth++ < JSSTR_MAX_ROPE_DEPTH) {
235  if(len1+len2 > JSSTR_MAX_LENGTH)
236  return NULL;
237 
238  rope = heap_alloc(sizeof(*rope));
239  if(!rope)
240  return NULL;
241 
242  jsstr_init(&rope->str, len1+len2, JSSTR_ROPE);
243  rope->left = jsstr_addref(str1);
244  rope->right = jsstr_addref(str2);
245  rope->depth = depth;
246  return &rope->str;
247  }
248  }
249 
250  ret = jsstr_alloc_buf(len1+len2, &ptr);
251  if(!ret)
252  return NULL;
253 
254  jsstr_flush(str1, ptr);
255  jsstr_flush(str2, ptr+len1);
256  return ret;
257 
258 }
Definition: _rope.h:91
Definition: jsstr.h:39
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
#define JSSTR_MAX_LENGTH
Definition: jsstr.h:45
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static void jsstr_init(jsstr_t *str, unsigned len, jsstr_tag_t tag)
Definition: jsstr.c:63
#define JSSTR_MAX_ROPE_DEPTH
Definition: jsstr.c:35
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned depth
Definition: jsstr.h:97
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
int ret
#define JSSTR_SHORT_STRING_LENGTH
Definition: jsstr.c:30
static BOOL jsstr_is_rope(jsstr_t *str)
Definition: jsstr.h:78
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69

Referenced by add_eval(), and String_concat().

◆ jsstr_empty()

jsstr_t* jsstr_empty ( void  )

Definition at line 288 of file jsstr.c.

289 {
290  return jsstr_addref(empty_str);
291 }
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static jsstr_t * empty_str
Definition: jsstr.c:281

Referenced by array_join(), create_match_array(), create_string_constr(), error_constr(), JScriptParse_InitNew(), RegExp_exec(), rep_call(), run_exec(), String_charAt(), and StringConstr_value().

◆ jsstr_eq()

static BOOL jsstr_eq ( jsstr_t left,
jsstr_t right 
)
inlinestatic

Definition at line 176 of file jsstr.h.

177 {
179 }
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
int jsstr_cmp(jsstr_t *, jsstr_t *) DECLSPEC_HIDDEN
Definition: jsstr.c:189

Referenced by jsval_strict_equal().

◆ jsstr_extract()

void jsstr_extract ( jsstr_t ,
unsigned  ,
unsigned  ,
WCHAR  
)

Definition at line 113 of file jsstr.c.

114 {
115  switch(jsstr_tag(str)) {
116  case JSSTR_INLINE:
117  memcpy(buf, jsstr_as_inline(str)->buf+off, len*sizeof(WCHAR));
118  return;
119  case JSSTR_HEAP:
120  memcpy(buf, jsstr_as_heap(str)->buf+off, len*sizeof(WCHAR));
121  return;
122  case JSSTR_ROPE:
124  return;
125  }
126 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static jsstr_tag_t jsstr_tag(jsstr_t *str)
Definition: jsstr.h:63
static void jsstr_rope_extract(jsstr_rope_t *str, unsigned off, unsigned len, WCHAR *buf)
Definition: jsstr.c:98
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127
static jsstr_inline_t * jsstr_as_inline(jsstr_t *str)
Definition: jsstr.h:122
off
Definition: i386-dis.c:3909

Referenced by JSON_stringify(), jsstr_rope_extract(), jsstr_substr(), and String_charCodeAt().

◆ jsstr_flatten()

static const WCHAR* jsstr_flatten ( jsstr_t str)
inlinestatic

Definition at line 139 of file jsstr.h.

140 {
144 }
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
const WCHAR * jsstr_rope_flatten(jsstr_rope_t *) DECLSPEC_HIDDEN
Definition: jsstr.c:262
WCHAR * buf
Definition: jsstr.h:90
const WCHAR * str
WCHAR buf[1]
Definition: jsstr.h:85
static BOOL jsstr_is_heap(jsstr_t *str)
Definition: jsstr.h:73
static BOOL jsstr_is_inline(jsstr_t *str)
Definition: jsstr.h:68
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127
static jsstr_inline_t * jsstr_as_inline(jsstr_t *str)
Definition: jsstr.h:122

Referenced by create_match_array(), create_regexp(), create_regexp_var(), date_parse(), disp_delete_name(), get_string_flat_val(), interp_throw_type(), JSGlobal_eval(), Object_hasOwnProperty(), regexp_match(), regexp_match_next(), regexp_string_match(), str_to_number(), stringify(), and to_flat_string().

◆ jsstr_flush()

static unsigned jsstr_flush ( jsstr_t str,
WCHAR buf 
)
inlinestatic

Definition at line 148 of file jsstr.h.

149 {
150  unsigned len = jsstr_length(str);
151  if(jsstr_is_inline(str)) {
152  memcpy(buf, jsstr_as_inline(str)->buf, len*sizeof(WCHAR));
153  }else if(jsstr_is_heap(str)) {
154  memcpy(buf, jsstr_as_heap(str)->buf, len*sizeof(WCHAR));
155  }else {
157  jsstr_flush(rope->left, buf);
158  jsstr_flush(rope->right, buf+jsstr_length(rope->left));
159  }
160  return len;
161 }
Definition: _rope.h:91
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static BOOL jsstr_is_heap(jsstr_t *str)
Definition: jsstr.h:73
static BOOL jsstr_is_inline(jsstr_t *str)
Definition: jsstr.h:68
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127
static jsstr_inline_t * jsstr_as_inline(jsstr_t *str)
Definition: jsstr.h:122

Referenced by array_join(), construct_function(), disp_delete_name(), do_attribute_tag_format(), do_attributeless_tag_format(), Error_toString(), jsstr_concat(), jsstr_rope_flatten(), jsval_to_variant(), literal_as_bstr(), Object_hasOwnProperty(), RegExp_toString(), strbuf_append_jsstr(), String_concat(), String_toLowerCase(), String_toUpperCase(), and variant_change_type().

◆ jsstr_free()

void jsstr_free ( jsstr_t )

Definition at line 44 of file jsstr.c.

45 {
46  switch(jsstr_tag(str)) {
47  case JSSTR_HEAP:
49  break;
50  case JSSTR_ROPE: {
52  jsstr_release(rope->left);
53  jsstr_release(rope->right);
54  break;
55  }
56  case JSSTR_INLINE:
57  break;
58  }
59 
60  heap_free(str);
61 }
Definition: _rope.h:91
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static jsstr_rope_t * jsstr_as_rope(jsstr_t *str)
Definition: jsstr.h:132
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
const WCHAR * str
static jsstr_tag_t jsstr_tag(jsstr_t *str)
Definition: jsstr.h:63
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by jsstr_release().

◆ jsstr_is_heap()

static BOOL jsstr_is_heap ( jsstr_t str)
inlinestatic

Definition at line 73 of file jsstr.h.

74 {
75  return jsstr_tag(str) == JSSTR_HEAP;
76 }
const WCHAR * str
static jsstr_tag_t jsstr_tag(jsstr_t *str)
Definition: jsstr.h:63

Referenced by debugstr_jsstr(), jsstr_flatten(), jsstr_flush(), and jsstr_try_flat().

◆ jsstr_is_inline()

static BOOL jsstr_is_inline ( jsstr_t str)
inlinestatic

Definition at line 68 of file jsstr.h.

69 {
70  return jsstr_tag(str) == JSSTR_INLINE;
71 }
const WCHAR * str
static jsstr_tag_t jsstr_tag(jsstr_t *str)
Definition: jsstr.h:63

Referenced by debugstr_jsstr(), jsstr_flatten(), jsstr_flush(), and jsstr_try_flat().

◆ jsstr_is_rope()

static BOOL jsstr_is_rope ( jsstr_t str)
inlinestatic

Definition at line 78 of file jsstr.h.

79 {
80  return jsstr_tag(str) == JSSTR_ROPE;
81 }
const WCHAR * str
static jsstr_tag_t jsstr_tag(jsstr_t *str)
Definition: jsstr.h:63

Referenced by jsstr_concat().

◆ jsstr_length()

◆ jsstr_nan()

jsstr_t* jsstr_nan ( void  )

Definition at line 283 of file jsstr.c.

284 {
285  return jsstr_addref(nan_str);
286 }
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static jsstr_t * nan_str
Definition: jsstr.c:281

Referenced by create_utc_string(), date_to_string(), Date_toLocaleDateString(), Date_toLocaleString(), Date_toLocaleTimeString(), Date_toTimeString(), dateobj_to_date_string(), and double_to_string().

◆ jsstr_null_bstr()

jsstr_t* jsstr_null_bstr ( void  )

Definition at line 298 of file jsstr.c.

299 {
300  return jsstr_addref(null_bstr_str);
301 }
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static jsstr_t * null_bstr_str
Definition: jsstr.c:281

Referenced by variant_to_jsval().

◆ jsstr_release()

static void jsstr_release ( jsstr_t str)
inlinestatic

Definition at line 110 of file jsstr.h.

111 {
112  if(!--str->ref)
113  jsstr_free(str);
114 }
void jsstr_free(jsstr_t *) DECLSPEC_HIDDEN
Definition: jsstr.c:44
const WCHAR * str

Referenced by ActiveXObject_value(), add_eval(), array_join(), Array_join(), construct_function(), create_match_array(), DateConstr_parse(), do_attribute_tag_format(), do_attributeless_tag_format(), do_regexp_match_next(), error_constr(), Error_toString(), free_strings(), Function_toString(), get_string_flat_val(), init_error_constr(), interp_array(), interp_delete(), interp_forin(), interp_in(), interp_memberid(), JSGlobal_decodeURI(), JSGlobal_decodeURIComponent(), JSGlobal_encodeURI(), JSGlobal_encodeURIComponent(), JSGlobal_escape(), JSGlobal_parseFloat(), JSGlobal_parseInt(), JSGlobal_unescape(), JSON_parse(), jsstr_free(), jsstr_rope_flatten(), jsval_release(), less_eval(), literal_as_bstr(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), Object_defineProperty(), Object_getOwnPropertyDescriptor(), Object_hasOwnProperty(), Object_propertyIsEnumerable(), RegExp_destructor(), RegExp_exec(), regexp_string_match(), RegExp_test(), release_bytecode(), rep_call(), run_exec(), script_release(), sort_cmp(), String_charAt(), String_charCodeAt(), String_concat(), String_destructor(), String_indexOf(), String_lastIndexOf(), String_match(), String_replace(), String_search(), String_slice(), String_split(), String_substr(), String_substring(), String_toLowerCase(), String_toUpperCase(), String_trim(), StringConstr_fromCharCode(), StringConstr_value(), stringify(), throw_error(), and to_flat_string().

◆ jsstr_rope_flatten()

const WCHAR* jsstr_rope_flatten ( jsstr_rope_t )

Definition at line 262 of file jsstr.c.

263 {
264  WCHAR *buf;
265 
266  buf = heap_alloc((jsstr_length(&str->str)+1) * sizeof(WCHAR));
267  if(!buf)
268  return NULL;
269 
270  jsstr_flush(str->left, buf);
271  jsstr_flush(str->right, buf+jsstr_length(str->left));
272  buf[jsstr_length(&str->str)] = 0;
273 
274  /* Trasform to heap string */
275  jsstr_release(str->left);
276  jsstr_release(str->right);
277  str->str.length_flags |= JSSTR_FLAG_FLAT;
278  return jsstr_as_heap(&str->str)->buf = buf;
279 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WCHAR * buf
Definition: jsstr.h:90
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define JSSTR_FLAG_FLAT
Definition: jsstr.h:49
static jsstr_heap_t * jsstr_as_heap(jsstr_t *str)
Definition: jsstr.h:127

Referenced by jsstr_flatten().

◆ jsstr_substr()

static jsstr_t* jsstr_substr ( jsstr_t str,
unsigned  off,
unsigned  len 
)
inlinestatic

Definition at line 163 of file jsstr.h.

164 {
165  jsstr_t *ret;
166  WCHAR *ptr;
167 
168  ret = jsstr_alloc_buf(len, &ptr);
169  if(ret)
171  return ret;
172 }
Definition: jsstr.h:39
jsstr_t * jsstr_alloc_buf(unsigned, WCHAR **) DECLSPEC_HIDDEN
Definition: jsstr.c:69
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
void jsstr_extract(jsstr_t *, unsigned, unsigned, WCHAR *) DECLSPEC_HIDDEN
Definition: jsstr.c:113
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
off
Definition: i386-dis.c:3909

Referenced by create_match_array(), global_idx(), regexp_string_match(), RegExpConstr_get_leftContext(), RegExpConstr_get_rightContext(), rep_call(), String_charAt(), String_idx_get(), String_slice(), String_substr(), and String_substring().

◆ jsstr_tag()

static jsstr_tag_t jsstr_tag ( jsstr_t str)
inlinestatic

Definition at line 63 of file jsstr.h.

64 {
65  return str->length_flags & JSSTR_FLAG_TAG_MASK;
66 }
const WCHAR * str
#define JSSTR_FLAG_TAG_MASK
Definition: jsstr.h:50

Referenced by jsstr_cmp_str(), jsstr_extract(), jsstr_free(), jsstr_is_heap(), jsstr_is_inline(), and jsstr_is_rope().

◆ jsstr_undefined()

jsstr_t* jsstr_undefined ( void  )