Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
str.c File Reference
#include "groonga_in.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "db.h"
#include "str.h"
#include <math.h>
Include dependency graph for str.c:

Go to the source code of this file.

Macros

#define _ISOC99_SOURCE
#define I2B(i)   ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(i) & 0x3f])
#define B2I(b)   (((b) < '+' || 'z' < (b)) ? 0xff : "\x3e\xff\xff\xff\x3f\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\xff\xff\xff\xff\xff\xff\xff\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\xff\xff\xff\xff\xff\xff\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33"[(b) - '+'])
#define MASK   0x34d34d34
#define I2B32H(i)   ("0123456789ABCDEFGHIJKLMNOPQRSTUV"[(i) & 0x1f])
#define UNIT_SIZE   (1 << 12)
#define UNIT_MASK   (UNIT_SIZE - 1)
#define DIGIT_NUMBER   15
#define TOK_ESC   (0x80)

Functions

unsigned int grn_str_charlen (grn_ctx *ctx, const char *str, grn_encoding encoding)
int grn_charlen_ (grn_ctx *ctx, const char *str, const char *end, grn_encoding encoding)
int grn_charlen (grn_ctx *ctx, const char *str, const char *end)
grn_strgrn_str_open_ (grn_ctx *ctx, const char *str, unsigned int str_len, int flags, grn_encoding encoding)
grn_strgrn_str_open (grn_ctx *ctx, const char *str, unsigned int str_len, int flags)
grn_rc grn_str_close (grn_ctx *ctx, grn_str *nstr)
const char * grn_encoding_to_string (grn_encoding enc)
grn_encoding grn_encoding_parse (const char *str)
size_t grn_str_len (grn_ctx *ctx, const char *str, grn_encoding encoding, const char **last)
int grn_isspace (const char *str, grn_encoding encoding)
int8_t grn_atoi8 (const char *nptr, const char *end, const char **rest)
uint8_t grn_atoui8 (const char *nptr, const char *end, const char **rest)
int16_t grn_atoi16 (const char *nptr, const char *end, const char **rest)
uint16_t grn_atoui16 (const char *nptr, const char *end, const char **rest)
int grn_atoi (const char *nptr, const char *end, const char **rest)
unsigned int grn_atoui (const char *nptr, const char *end, const char **rest)
int64_t grn_atoll (const char *nptr, const char *end, const char **rest)
unsigned int grn_htoui (const char *nptr, const char *end, const char **rest)
void grn_itoh (unsigned int i, char *p, unsigned int len)
grn_rc grn_itoa (int i, char *p, char *end, char **rest)
grn_rc grn_itoa_padded (int i, char *p, char *end, char ch)
grn_rc grn_lltoa (int64_t i, char *p, char *end, char **rest)
grn_rc grn_ulltoa (uint64_t i, char *p, char *end, char **rest)
char * grn_itob (grn_id id, char *p)
grn_id grn_btoi (char *b)
char * grn_lltob32h (int64_t i, char *p)
char * grn_ulltob32h (uint64_t i, char *p)
grn_rc grn_aton (grn_ctx *ctx, const char *p, const char *end, const char **rest, grn_obj *res)
int grn_str_tok (const char *str, size_t str_len, char delim, const char **tokbuf, int buf_size, const char **rest)
int grn_str_getopt (int argc, char *const argv[], const grn_str_getopt_opt *opts, int *flags)
grn_rc grn_bulk_resize (grn_ctx *ctx, grn_obj *buf, unsigned int newsize)
grn_rc grn_bulk_reinit (grn_ctx *ctx, grn_obj *buf, unsigned int size)
grn_rc grn_bulk_write (grn_ctx *ctx, grn_obj *buf, const char *str, unsigned int len)
grn_rc grn_bulk_write_from (grn_ctx *ctx, grn_obj *bulk, const char *str, unsigned int from, unsigned int len)
grn_rc grn_bulk_reserve (grn_ctx *ctx, grn_obj *buf, unsigned int len)
grn_rc grn_bulk_space (grn_ctx *ctx, grn_obj *buf, unsigned int len)
grn_rc grn_bulk_truncate (grn_ctx *ctx, grn_obj *bulk, unsigned int len)
grn_rc grn_text_itoa (grn_ctx *ctx, grn_obj *buf, int i)
grn_rc grn_text_itoa_padded (grn_ctx *ctx, grn_obj *buf, int i, char ch, unsigned int len)
grn_rc grn_text_lltoa (grn_ctx *ctx, grn_obj *buf, long long int i)
grn_rc grn_text_ulltoa (grn_ctx *ctx, grn_obj *buf, unsigned long long int i)
grn_rc grn_text_ftoa (grn_ctx *ctx, grn_obj *buf, double d)
grn_rc grn_text_itoh (grn_ctx *ctx, grn_obj *buf, int i, unsigned int len)
grn_rc grn_text_itob (grn_ctx *ctx, grn_obj *buf, grn_id id)
grn_rc grn_text_lltob32h (grn_ctx *ctx, grn_obj *buf, long long int i)
grn_rc grn_text_esc (grn_ctx *ctx, grn_obj *buf, const char *s, unsigned int len)
grn_rc grn_text_escape_xml (grn_ctx *ctx, grn_obj *buf, const char *s, unsigned int len)
const char * grn_text_unesc_tok (grn_ctx *ctx, grn_obj *buf, const char *s, const char *e, char *tok_type)
grn_rc grn_text_benc (grn_ctx *ctx, grn_obj *buf, unsigned int v)
grn_rc grn_text_urlenc (grn_ctx *ctx, grn_obj *buf, const char *s, unsigned int len)
grn_rc grn_text_time2rfc1123 (grn_ctx *ctx, grn_obj *bulk, int sec)
grn_rc grn_bulk_fin (grn_ctx *ctx, grn_obj *buf)
grn_rc grn_substring (grn_ctx *ctx, char **str, char **str_end, int start, int end, grn_encoding encoding)
grn_rc grn_text_otoj (grn_ctx *ctx, grn_obj *bulk, grn_obj *obj, grn_obj_format *format)
const char * grn_text_urldec (grn_ctx *ctx, grn_obj *buf, const char *p, const char *e, char d)
const char * grn_text_cgidec (grn_ctx *ctx, grn_obj *buf, const char *p, const char *e, const char *delimiters)
void grn_str_url_path_normalize (grn_ctx *ctx, const char *path, size_t path_len, char *buf, size_t buf_len)
grn_rc grn_text_fgets (grn_ctx *ctx, grn_obj *buf, FILE *fp)
grn_bool grn_bulk_is_zero (grn_ctx *ctx, grn_obj *obj)

Variables

int grn_bulk_margin_size = 0

Macro Definition Documentation

#define _ISOC99_SOURCE

Definition at line 25 of file str.c.

#define B2I (   b)    (((b) < '+' || 'z' < (b)) ? 0xff : "\x3e\xff\xff\xff\x3f\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\xff\xff\xff\xff\xff\xff\xff\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\xff\xff\xff\xff\xff\xff\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33"[(b) - '+'])

Definition at line 1649 of file str.c.

#define DIGIT_NUMBER   15
#define I2B (   i)    ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(i) & 0x3f])

Definition at line 1646 of file str.c.

#define I2B32H (   i)    ("0123456789ABCDEFGHIJKLMNOPQRSTUV"[(i) & 0x1f])

Definition at line 1680 of file str.c.

#define MASK   0x34d34d34

Definition at line 1652 of file str.c.

#define TOK_ESC   (0x80)

Definition at line 2270 of file str.c.

#define UNIT_MASK   (UNIT_SIZE - 1)

Definition at line 1888 of file str.c.

#define UNIT_SIZE   (1 << 12)

Definition at line 1887 of file str.c.

Function Documentation

int grn_atoi ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1432 of file str.c.

Here is the caller graph for this function:

int16_t grn_atoi16 ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1397 of file str.c.

Here is the caller graph for this function:

int8_t grn_atoi8 ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1362 of file str.c.

Here is the caller graph for this function:

int64_t grn_atoll ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1467 of file str.c.

Here is the caller graph for this function:

grn_rc grn_aton ( grn_ctx ctx,
const char *  p,
const char *  end,
const char **  rest,
grn_obj res 
)

Definition at line 1724 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int grn_atoui ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1453 of file str.c.

Here is the caller graph for this function:

uint16_t grn_atoui16 ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1418 of file str.c.

Here is the caller graph for this function:

uint8_t grn_atoui8 ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1383 of file str.c.

Here is the caller graph for this function:

grn_id grn_btoi ( char *  b)

Definition at line 1667 of file str.c.

grn_rc grn_bulk_fin ( grn_ctx ctx,
grn_obj buf 
)

Definition at line 2468 of file str.c.

Here is the caller graph for this function:

grn_bool grn_bulk_is_zero ( grn_ctx ctx,
grn_obj obj 
)

Definition at line 3101 of file str.c.

Here is the caller graph for this function:

grn_rc grn_bulk_reinit ( grn_ctx ctx,
grn_obj buf,
unsigned int  size 
)

Definition at line 1924 of file str.c.

Here is the call graph for this function:

grn_rc grn_bulk_reserve ( grn_ctx ctx,
grn_obj buf,
unsigned int  len 
)

Definition at line 1954 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_bulk_resize ( grn_ctx ctx,
grn_obj buf,
unsigned int  newsize 
)

Definition at line 1893 of file str.c.

Here is the caller graph for this function:

grn_rc grn_bulk_space ( grn_ctx ctx,
grn_obj buf,
unsigned int  len 
)

Definition at line 1964 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_bulk_truncate ( grn_ctx ctx,
grn_obj bulk,
unsigned int  len 
)

Definition at line 1985 of file str.c.

Here is the caller graph for this function:

grn_rc grn_bulk_write ( grn_ctx ctx,
grn_obj buf,
const char *  str,
unsigned int  len 
)

Definition at line 1931 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_bulk_write_from ( grn_ctx ctx,
grn_obj bulk,
const char *  str,
unsigned int  from,
unsigned int  len 
)

Definition at line 1945 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int grn_charlen ( grn_ctx ctx,
const char *  str,
const char *  end 
)

Definition at line 177 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int grn_charlen_ ( grn_ctx ctx,
const char *  str,
const char *  end,
grn_encoding  encoding 
)

Definition at line 130 of file str.c.

Here is the caller graph for this function:

grn_encoding grn_encoding_parse ( const char *  str)

Definition at line 1305 of file str.c.

Here is the caller graph for this function:

const char* grn_encoding_to_string ( grn_encoding  enc)

Definition at line 1295 of file str.c.

Here is the caller graph for this function:

unsigned int grn_htoui ( const char *  nptr,
const char *  end,
const char **  rest 
)

Definition at line 1490 of file str.c.

Here is the caller graph for this function:

int grn_isspace ( const char *  str,
grn_encoding  encoding 
)

Definition at line 1334 of file str.c.

grn_rc grn_itoa ( int  i,
char *  p,
char *  end,
char **  rest 
)

Definition at line 1546 of file str.c.

Here is the caller graph for this function:

grn_rc grn_itoa_padded ( int  i,
char *  p,
char *  end,
char  ch 
)

Definition at line 1575 of file str.c.

Here is the caller graph for this function:

char* grn_itob ( grn_id  id,
char *  p 
)

Definition at line 1655 of file str.c.

Here is the caller graph for this function:

void grn_itoh ( unsigned int  i,
char *  p,
unsigned int  len 
)

Definition at line 1535 of file str.c.

Here is the caller graph for this function:

grn_rc grn_lltoa ( int64_t  i,
char *  p,
char *  end,
char **  rest 
)

Definition at line 1600 of file str.c.

Here is the caller graph for this function:

char* grn_lltob32h ( int64_t  i,
char *  p 
)

Definition at line 1683 of file str.c.

Here is the caller graph for this function:

unsigned int grn_str_charlen ( grn_ctx ctx,
const char *  str,
grn_encoding  encoding 
)

Definition at line 67 of file str.c.

Here is the caller graph for this function:

grn_rc grn_str_close ( grn_ctx ctx,
grn_str nstr 
)

Definition at line 1271 of file str.c.

Here is the caller graph for this function:

int grn_str_getopt ( int  argc,
char *const  argv[],
const grn_str_getopt_opt opts,
int *  flags 
)

Definition at line 1829 of file str.c.

Here is the caller graph for this function:

size_t grn_str_len ( grn_ctx ctx,
const char *  str,
grn_encoding  encoding,
const char **  last 
)

Definition at line 1318 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_str* grn_str_open ( grn_ctx ctx,
const char *  str,
unsigned int  str_len,
int  flags 
)

Definition at line 1265 of file str.c.

Here is the call graph for this function:

grn_str* grn_str_open_ ( grn_ctx ctx,
const char *  str,
unsigned int  str_len,
int  flags,
grn_encoding  encoding 
)

Definition at line 1211 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int grn_str_tok ( const char *  str,
size_t  str_len,
char  delim,
const char **  tokbuf,
int  buf_size,
const char **  rest 
)

Definition at line 1776 of file str.c.

Here is the caller graph for this function:

void grn_str_url_path_normalize ( grn_ctx ctx,
const char *  path,
size_t  path_len,
char *  buf,
size_t  buf_len 
)

Definition at line 3043 of file str.c.

Here is the caller graph for this function:

grn_rc grn_substring ( grn_ctx ctx,
char **  str,
char **  str_end,
int  start,
int  end,
grn_encoding  encoding 
)

Definition at line 2484 of file str.c.

Here is the call graph for this function:

grn_rc grn_text_benc ( grn_ctx ctx,
grn_obj buf,
unsigned int  v 
)

Definition at line 2384 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* grn_text_cgidec ( grn_ctx ctx,
grn_obj buf,
const char *  p,
const char *  e,
const char *  delimiters 
)

Definition at line 3003 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_esc ( grn_ctx ctx,
grn_obj buf,
const char *  s,
unsigned int  len 
)

Definition at line 2165 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_escape_xml ( grn_ctx ctx,
grn_obj buf,
const char *  s,
unsigned int  len 
)

Definition at line 2238 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_fgets ( grn_ctx ctx,
grn_obj buf,
FILE *  fp 
)

Definition at line 3085 of file str.c.

Here is the call graph for this function:

grn_rc grn_text_ftoa ( grn_ctx ctx,
grn_obj buf,
double  d 
)

Definition at line 2094 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_itoa ( grn_ctx ctx,
grn_obj buf,
int  i 
)

Definition at line 2004 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_itoa_padded ( grn_ctx ctx,
grn_obj buf,
int  i,
char  ch,
unsigned int  len 
)

Definition at line 2021 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_itob ( grn_ctx ctx,
grn_obj buf,
grn_id  id 
)

Definition at line 2139 of file str.c.

Here is the call graph for this function:

grn_rc grn_text_itoh ( grn_ctx ctx,
grn_obj buf,
int  i,
unsigned int  len 
)

Definition at line 2127 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_lltoa ( grn_ctx ctx,
grn_obj buf,
long long int  i 
)

Definition at line 2034 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_lltob32h ( grn_ctx ctx,
grn_obj buf,
long long int  i 
)

Definition at line 2152 of file str.c.

Here is the call graph for this function:

grn_rc grn_text_otoj ( grn_ctx ctx,
grn_obj bulk,
grn_obj obj,
grn_obj_format format 
)

Definition at line 2609 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_time2rfc1123 ( grn_ctx ctx,
grn_obj bulk,
int  sec 
)

Definition at line 2433 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_ulltoa ( grn_ctx ctx,
grn_obj buf,
unsigned long long int  i 
)

Definition at line 2051 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* grn_text_unesc_tok ( grn_ctx ctx,
grn_obj buf,
const char *  s,
const char *  e,
char *  tok_type 
)

Definition at line 2273 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* grn_text_urldec ( grn_ctx ctx,
grn_obj buf,
const char *  p,
const char *  e,
char  d 
)

Definition at line 2978 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_text_urlenc ( grn_ctx ctx,
grn_obj buf,
const char *  s,
unsigned int  len 
)

Definition at line 2410 of file str.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ulltoa ( uint64_t  i,
char *  p,
char *  end,
char **  rest 
)

Definition at line 1628 of file str.c.

Here is the caller graph for this function:

char* grn_ulltob32h ( uint64_t  i,
char *  p 
)

Definition at line 1703 of file str.c.

Variable Documentation

int grn_bulk_margin_size = 0

Definition at line 1890 of file str.c.