Classes | Defines | Typedefs | Enumerations | Functions | Variables

jsstr.h File Reference

#include <ctype.h>
#include "jspubtd.h"
#include "jsprvtd.h"
#include "jslock.h"
Include dependency graph for jsstr.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  JSString
struct  JSSubString

Defines

#define JSSTRING_BIT(n)   ((size_t)1 << (n))
#define JSSTRING_BITMASK(n)   (JSSTRING_BIT(n) - 1)
#define JS_CCODE(c)   (js_A[js_Y[(js_X[(uint16)(c)>>6]<<6)|((c)&0x3F)]])
#define JS_CTYPE(c)   (JS_CCODE(c) & 0x1F)
#define JS_ISALPHA(c)
#define JS_ISALNUM(c)
#define JS_ISLETTER(c)
#define JS_ISIDPART(c)
#define JS_ISFORMAT(c)   (((1 << JSCT_FORMAT) >> JS_CTYPE(c)) & 1)
#define JS_ISWORD(c)   ((c) < 128 && js_alnum[(c)])
#define JS_ISIDSTART(c)   (JS_ISLETTER(c) || (c) == '_' || (c) == '$')
#define JS_ISIDENT(c)   (JS_ISIDPART(c) || (c) == '_' || (c) == '$')
#define JS_ISXMLSPACE(c)
#define JS_ISXMLNSSTART(c)   ((JS_CCODE(c) & 0x00000100) || (c) == '_')
#define JS_ISXMLNS(c)
#define JS_ISXMLNAMESTART(c)   (JS_ISXMLNSSTART(c) || (c) == ':')
#define JS_ISXMLNAME(c)   (JS_ISXMLNS(c) || (c) == ':')
#define JS_ISDIGIT(c)   (JS_CTYPE(c) == JSCT_DECIMAL_DIGIT_NUMBER)
#define JS_ISPRINT(c)   ((c) < 128 && isprint(c))
#define JS_ISUPPER(c)   (JS_CTYPE(c) == JSCT_UPPERCASE_LETTER)
#define JS_ISLOWER(c)   (JS_CTYPE(c) == JSCT_LOWERCASE_LETTER)
#define JS_TOUPPER(c)
#define JS_TOLOWER(c)
#define JS7_ISDEC(c)   ((((unsigned)(c)) - '0') <= 9)
#define JS7_UNDEC(c)   ((c) - '0')
#define JS7_ISHEX(c)   ((c) < 128 && isxdigit(c))
#define JS7_UNHEX(c)   (uintN)(JS7_ISDEC(c) ? (c) - '0' : 10 + tolower(c) - 'a')
#define JS7_ISLET(c)   ((c) < 128 && isalpha(c))
#define js_ValueToPrintableString(cx, v)   js_ValueToPrintable(cx, v, js_ValueToString)
#define js_ValueToPrintableSource(cx, v)   js_ValueToPrintable(cx, v, js_ValueToSource)
#define js_strncpy(t, s, n)   memcpy((t), (s), (n) * sizeof(jschar))
#define js_PutEscapedString(buffer, bufferSize, str, quote)   js_PutEscapedStringImpl(buffer, bufferSize, NULL, str, quote)
#define js_FileEscapedString(file, str, quote)   (JS_ASSERT(file), js_PutEscapedStringImpl(NULL, 0, file, str, quote))

Typedefs

typedef enum JSCharType JSCharType
typedef JSString *(* JSValueToStringFun )(JSContext *cx, jsval v)

Enumerations

enum  { UNIT_STRING_LIMIT = 256U, INT_STRING_LIMIT = 256U }
enum  JSCharType {
  JSCT_UNASSIGNED = 0, JSCT_UPPERCASE_LETTER = 1, JSCT_LOWERCASE_LETTER = 2, JSCT_TITLECASE_LETTER = 3,
  JSCT_MODIFIER_LETTER = 4, JSCT_OTHER_LETTER = 5, JSCT_NON_SPACING_MARK = 6, JSCT_ENCLOSING_MARK = 7,
  JSCT_COMBINING_SPACING_MARK = 8, JSCT_DECIMAL_DIGIT_NUMBER = 9, JSCT_LETTER_NUMBER = 10, JSCT_OTHER_NUMBER = 11,
  JSCT_SPACE_SEPARATOR = 12, JSCT_LINE_SEPARATOR = 13, JSCT_PARAGRAPH_SEPARATOR = 14, JSCT_CONTROL = 15,
  JSCT_FORMAT = 16, JSCT_PRIVATE_USE = 18, JSCT_SURROGATE = 19, JSCT_DASH_PUNCTUATION = 20,
  JSCT_START_PUNCTUATION = 21, JSCT_END_PUNCTUATION = 22, JSCT_CONNECTOR_PUNCTUATION = 23, JSCT_OTHER_PUNCTUATION = 24,
  JSCT_MATH_SYMBOL = 25, JSCT_CURRENCY_SYMBOL = 26, JSCT_MODIFIER_SYMBOL = 27, JSCT_OTHER_SYMBOL = 28
}

Functions

jscharjs_GetDependentStringChars (JSString *str)
void js_static_assert (int arg[((8 *8) >=32)?1:-1])
const jscharjs_GetStringChars (JSContext *cx, JSString *str)
JSStringjs_ConcatStrings (JSContext *cx, JSString *left, JSString *right)
const jscharjs_UndependString (JSContext *cx, JSString *str)
JSBool js_MakeStringImmutable (JSContext *cx, JSString *str)
JSStringjs_toLowerCase (JSContext *cx, JSString *str)
JSStringjs_toUpperCase (JSContext *cx, JSString *str)
JSBool js_InitRuntimeStringState (JSContext *cx)
JSBool js_InitDeflatedStringCache (JSRuntime *rt)
void js_FinishRuntimeStringState (JSContext *cx)
void js_FinishDeflatedStringCache (JSRuntime *rt)
JSObjectjs_InitStringClass (JSContext *cx, JSObject *obj)
JSStringjs_NewString (JSContext *cx, jschar *chars, size_t length)
JSStringjs_NewStringFromCharBuffer (JSContext *cx, JSCharBuffer &cb)
JSStringjs_NewDependentString (JSContext *cx, JSString *base, size_t start, size_t length)
JSStringjs_NewStringCopyN (JSContext *cx, const jschar *s, size_t n)
JSStringjs_NewStringCopyZ (JSContext *cx, const jschar *s)
const char * js_ValueToPrintable (JSContext *cx, jsval v, JSValueToStringFun v2sfun)
JSStringjs_ValueToString (JSContext *cx, jsval v)
JSBool js_ValueToCharBuffer (JSContext *cx, jsval v, JSCharBuffer &cb)
JSStringjs_ValueToSource (JSContext *cx, jsval v)
uint32 js_HashString (JSString *str)
JSBool js_EqualStrings (JSString *str1, JSString *str2)
int32 js_CompareStrings (JSString *str1, JSString *str2)
jsint js_BoyerMooreHorspool (const jschar *text, jsuint textlen, const jschar *pat, jsuint patlen)
size_t js_strlen (const jschar *s)
jscharjs_strchr (const jschar *s, jschar c)
jscharjs_strchr_limit (const jschar *s, jschar c, const jschar *limit)
jscharjs_InflateString (JSContext *cx, const char *bytes, size_t *length)
char * js_DeflateString (JSContext *cx, const jschar *chars, size_t length)
JSBool js_InflateStringToBuffer (JSContext *cx, const char *bytes, size_t length, jschar *chars, size_t *charsLength)
size_t js_GetDeflatedStringLength (JSContext *cx, const jschar *chars, size_t charsLength)
JSBool js_DeflateStringToBuffer (JSContext *cx, const jschar *chars, size_t charsLength, char *bytes, size_t *length)
JSBool js_SetStringBytes (JSContext *cx, JSString *str, char *bytes, size_t length)
const char * js_GetStringBytes (JSContext *cx, JSString *str)
void js_PurgeDeflatedStringCache (JSRuntime *rt, JSString *str)
JSBool js_str_escape (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
JSBool js_str_toString (JSContext *cx, uintN argc, jsval *vp)
int js_OneUcs4ToUtf8Char (uint8 *utf8Buffer, uint32 ucs4Char)
size_t js_PutEscapedStringImpl (char *buffer, size_t bufferSize, FILE *fp, JSString *str, uint32 quote)
JSBool js_String (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)

Variables

jschar js_empty_ucstr []
JSSubString js_EmptySubString
const uint8 js_X []
const uint8 js_Y []
const uint32 js_A []
const bool js_alnum []
JSClass js_StringClass
const char js_escape_str []
const char js_unescape_str []
const char js_uneval_str []
const char js_decodeURI_str []
const char js_encodeURI_str []
const char js_decodeURIComponent_str []
const char js_encodeURIComponent_str []

Define Documentation

#define JS7_ISDEC (   c  )     ((((unsigned)(c)) - '0') <= 9)
#define JS7_ISHEX (   c  )     ((c) < 128 && isxdigit(c))
#define JS7_ISLET (   c  )     ((c) < 128 && isalpha(c))
#define JS7_UNDEC (   c  )     ((c) - '0')
#define JS7_UNHEX (   c  )     (uintN)(JS7_ISDEC(c) ? (c) - '0' : 10 + tolower(c) - 'a')
#define JS_CCODE (   c  )     (js_A[js_Y[(js_X[(uint16)(c)>>6]<<6)|((c)&0x3F)]])
#define JS_CTYPE (   c  )     (JS_CCODE(c) & 0x1F)
#define js_FileEscapedString (   file,
  str,
  quote 
)    (JS_ASSERT(file), js_PutEscapedStringImpl(NULL, 0, file, str, quote))
#define JS_ISALNUM (   c  ) 
Value:
((((1 << JSCT_UPPERCASE_LETTER) |                     \
                           (1 << JSCT_LOWERCASE_LETTER) |                     \
                           (1 << JSCT_TITLECASE_LETTER) |                     \
                           (1 << JSCT_MODIFIER_LETTER) |                      \
                           (1 << JSCT_OTHER_LETTER) |                         \
                           (1 << JSCT_DECIMAL_DIGIT_NUMBER))                  \
                          >> JS_CTYPE(c)) & 1)
#define JS_ISALPHA (   c  ) 
Value:
((((1 << JSCT_UPPERCASE_LETTER) |                     \
                           (1 << JSCT_LOWERCASE_LETTER) |                     \
                           (1 << JSCT_TITLECASE_LETTER) |                     \
                           (1 << JSCT_MODIFIER_LETTER) |                      \
                           (1 << JSCT_OTHER_LETTER))                          \
                          >> JS_CTYPE(c)) & 1)
#define JS_ISDIGIT (   c  )     (JS_CTYPE(c) == JSCT_DECIMAL_DIGIT_NUMBER)
#define JS_ISFORMAT (   c  )     (((1 << JSCT_FORMAT) >> JS_CTYPE(c)) & 1)
#define JS_ISIDENT (   c  )     (JS_ISIDPART(c) || (c) == '_' || (c) == '$')
#define JS_ISIDPART (   c  ) 
Value:
((((1 << JSCT_UPPERCASE_LETTER) |                     \
                           (1 << JSCT_LOWERCASE_LETTER) |                     \
                           (1 << JSCT_TITLECASE_LETTER) |                     \
                           (1 << JSCT_MODIFIER_LETTER) |                      \
                           (1 << JSCT_OTHER_LETTER) |                         \
                           (1 << JSCT_LETTER_NUMBER) |                        \
                           (1 << JSCT_NON_SPACING_MARK) |                     \
                           (1 << JSCT_COMBINING_SPACING_MARK) |               \
                           (1 << JSCT_DECIMAL_DIGIT_NUMBER) |                 \
                           (1 << JSCT_CONNECTOR_PUNCTUATION))                 \
                          >> JS_CTYPE(c)) & 1)
#define JS_ISIDSTART (   c  )     (JS_ISLETTER(c) || (c) == '_' || (c) == '$')
#define JS_ISLETTER (   c  ) 
Value:
((((1 << JSCT_UPPERCASE_LETTER) |                    \
                            (1 << JSCT_LOWERCASE_LETTER) |                    \
                            (1 << JSCT_TITLECASE_LETTER) |                    \
                            (1 << JSCT_MODIFIER_LETTER) |                     \
                            (1 << JSCT_OTHER_LETTER) |                        \
                            (1 << JSCT_LETTER_NUMBER))                        \
                           >> JS_CTYPE(c)) & 1)
#define JS_ISLOWER (   c  )     (JS_CTYPE(c) == JSCT_LOWERCASE_LETTER)
#define JS_ISPRINT (   c  )     ((c) < 128 && isprint(c))
#define JS_ISUPPER (   c  )     (JS_CTYPE(c) == JSCT_UPPERCASE_LETTER)
#define JS_ISWORD (   c  )     ((c) < 128 && js_alnum[(c)])
#define JS_ISXMLNAME (   c  )     (JS_ISXMLNS(c) || (c) == ':')
#define JS_ISXMLNAMESTART (   c  )     (JS_ISXMLNSSTART(c) || (c) == ':')
#define JS_ISXMLNS (   c  ) 
Value:
((JS_CCODE(c) & 0x00000080) || (c) == '.' ||  \
                                 (c) == '-' || (c) == '_')
#define JS_ISXMLNSSTART (   c  )     ((JS_CCODE(c) & 0x00000100) || (c) == '_')
#define JS_ISXMLSPACE (   c  ) 
Value:
((c) == ' ' || (c) == '\t' || (c) == '\r' ||  \
                                 (c) == '\n')
#define js_PutEscapedString (   buffer,
  bufferSize,
  str,
  quote 
)    js_PutEscapedStringImpl(buffer, bufferSize, NULL, str, quote)
#define js_strncpy (   t,
  s,
  n 
)    memcpy((t), (s), (n) * sizeof(jschar))
#define JS_TOLOWER (   c  ) 
Value:
((jschar) ((JS_CCODE(c) & 0x00200000)                 \
                                   ? (c) + ((int32)JS_CCODE(c) >> 22)         \
                                   : (c)))
#define JS_TOUPPER (   c  ) 
Value:
((jschar) ((JS_CCODE(c) & 0x00100000)                 \
                                   ? (c) - ((int32)JS_CCODE(c) >> 22)         \
                                   : (c)))
#define js_ValueToPrintableSource (   cx,
  v 
)    js_ValueToPrintable(cx, v, js_ValueToSource)
#define js_ValueToPrintableString (   cx,
  v 
)    js_ValueToPrintable(cx, v, js_ValueToString)
#define JSSTRING_BIT (   n  )     ((size_t)1 << (n))
#define JSSTRING_BITMASK (   n  )     (JSSTRING_BIT(n) - 1)

Typedef Documentation

typedef enum JSCharType JSCharType

Enumeration Type Documentation

anonymous enum
Enumerator:
UNIT_STRING_LIMIT 
INT_STRING_LIMIT 
enum JSCharType
Enumerator:
JSCT_UNASSIGNED 
JSCT_UPPERCASE_LETTER 
JSCT_LOWERCASE_LETTER 
JSCT_TITLECASE_LETTER 
JSCT_MODIFIER_LETTER 
JSCT_OTHER_LETTER 
JSCT_NON_SPACING_MARK 
JSCT_ENCLOSING_MARK 
JSCT_COMBINING_SPACING_MARK 
JSCT_DECIMAL_DIGIT_NUMBER 
JSCT_LETTER_NUMBER 
JSCT_OTHER_NUMBER 
JSCT_SPACE_SEPARATOR 
JSCT_LINE_SEPARATOR 
JSCT_PARAGRAPH_SEPARATOR 
JSCT_CONTROL 
JSCT_FORMAT 
JSCT_PRIVATE_USE 
JSCT_SURROGATE 
JSCT_DASH_PUNCTUATION 
JSCT_START_PUNCTUATION 
JSCT_END_PUNCTUATION 
JSCT_CONNECTOR_PUNCTUATION 
JSCT_OTHER_PUNCTUATION 
JSCT_MATH_SYMBOL 
JSCT_CURRENCY_SYMBOL 
JSCT_MODIFIER_SYMBOL 
JSCT_OTHER_SYMBOL 

Function Documentation

jsint js_BoyerMooreHorspool ( const jschar text,
jsuint  textlen,
const jschar pat,
jsuint  patlen 
)
int32 js_CompareStrings ( JSString str1,
JSString str2 
)
JSString* js_ConcatStrings ( JSContext cx,
JSString left,
JSString right 
)
char* js_DeflateString ( JSContext cx,
const jschar chars,
size_t  length 
)
JSBool js_DeflateStringToBuffer ( JSContext cx,
const jschar chars,
size_t  charsLength,
char *  bytes,
size_t *  length 
)
JSBool js_EqualStrings ( JSString str1,
JSString str2 
)
void js_FinishDeflatedStringCache ( JSRuntime rt  ) 
void js_FinishRuntimeStringState ( JSContext cx  ) 
size_t js_GetDeflatedStringLength ( JSContext cx,
const jschar chars,
size_t  charsLength 
)
jschar* js_GetDependentStringChars ( JSString str  ) 
const char* js_GetStringBytes ( JSContext cx,
JSString str 
)
const jschar* js_GetStringChars ( JSContext cx,
JSString str 
)
uint32 js_HashString ( JSString str  ) 
jschar* js_InflateString ( JSContext cx,
const char *  bytes,
size_t *  length 
)
JSBool js_InflateStringToBuffer ( JSContext cx,
const char *  bytes,
size_t  length,
jschar chars,
size_t *  charsLength 
)
JSBool js_InitDeflatedStringCache ( JSRuntime rt  ) 
JSBool js_InitRuntimeStringState ( JSContext cx  ) 
JSObject* js_InitStringClass ( JSContext cx,
JSObject obj 
)
JSBool js_MakeStringImmutable ( JSContext cx,
JSString str 
)
JSString* js_NewDependentString ( JSContext cx,
JSString base,
size_t  start,
size_t  length 
)
JSString* js_NewString ( JSContext cx,
jschar chars,
size_t  length 
)
JSString* js_NewStringCopyN ( JSContext cx,
const jschar s,
size_t  n 
)
JSString* js_NewStringCopyZ ( JSContext cx,
const jschar s 
)
JSString* js_NewStringFromCharBuffer ( JSContext cx,
JSCharBuffer &  cb 
)
int js_OneUcs4ToUtf8Char ( uint8 utf8Buffer,
uint32  ucs4Char 
)
void js_PurgeDeflatedStringCache ( JSRuntime rt,
JSString str 
)
size_t js_PutEscapedStringImpl ( char *  buffer,
size_t  bufferSize,
FILE *  fp,
JSString str,
uint32  quote 
)
JSBool js_SetStringBytes ( JSContext cx,
JSString str,
char *  bytes,
size_t  length 
)
void js_static_assert ( int  arg[((8 *8) >=32)?1:-1]  ) 
JSBool js_str_escape ( JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval rval 
)
JSBool js_str_toString ( JSContext cx,
uintN  argc,
jsval vp 
)
jschar* js_strchr ( const jschar s,
jschar  c 
)
jschar* js_strchr_limit ( const jschar s,
jschar  c,
const jschar limit 
)
JSBool js_String ( JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval rval 
)
size_t js_strlen ( const jschar s  ) 
JSString* js_toLowerCase ( JSContext cx,
JSString str 
)
JSString* js_toUpperCase ( JSContext cx,
JSString str 
)
const jschar* js_UndependString ( JSContext cx,
JSString str 
)
JSBool js_ValueToCharBuffer ( JSContext cx,
jsval  v,
JSCharBuffer &  cb 
)
const char* js_ValueToPrintable ( JSContext cx,
jsval  v,
JSValueToStringFun  v2sfun 
)
JSString* js_ValueToSource ( JSContext cx,
jsval  v 
)
JSString* js_ValueToString ( JSContext cx,
jsval  v 
)

Variable Documentation

const uint32 js_A[]
const bool js_alnum[]
const char js_decodeURI_str[]
const char js_encodeURI_str[]
const char js_escape_str[]
const char js_unescape_str[]
const char js_uneval_str[]
const uint8 js_X[]
const uint8 js_Y[]