Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
expr.c File Reference
#include "groonga_in.h"
#include "db.h"
#include "ctx_impl.h"
#include <string.h>
#include <float.h>
#include "ii.h"
#include "geo.h"
#include "expr.h"
#include "util.h"
#include "normalizer_in.h"
#include "mrb.h"
#include "mrb/mrb_expr.h"
#include "snip.h"
#include "ecmascript.h"
#include "ecmascript.c"
Include dependency graph for expr.c:

Go to the source code of this file.

Data Structures

struct  grn_expr_dfi
struct  _grn_scan_info
struct  efs_info
struct  efs_op

Macros

#define DFI_POP(e, d)
#define DFI_PUT(e, t, d, c)
#define GRN_PTR_POP(obj, value)
#define EXPRVP(x)   ((x)->header.impl_flags & GRN_OBJ_EXPRVALUE)
#define CONSTP(obj)   ((obj) && ((obj)->header.impl_flags & GRN_OBJ_EXPRCONST))
#define PUSH_CODE(e, o, v, n, c)
#define APPEND_UNARY_MINUS_OP(e)
#define PUSH_N_ARGS_ARITHMETIC_OP(e, op, obj, nargs, code)
#define WITH_SPSAVE(block)
#define DO_COMPARE_SUB_NUMERIC(y, op)
#define DO_COMPARE_SUB(op)
#define DO_COMPARE_BUILTIN(x, y, r, op)
#define DO_COMPARE(x, y, r, op)
#define DO_EQ_SUB
#define DO_EQ(x, y, r)
#define GEO_RESOLUTION   3600000
#define GEO_RADIOUS   6357303
#define GEO_BES_C1   6334834
#define GEO_BES_C2   6377397
#define GEO_BES_C3   0.006674
#define GEO_GRS_C1   6335439
#define GEO_GRS_C2   6378137
#define GEO_GRS_C3   0.006694
#define GEO_INT2RAD(x)   ((M_PI * x) / (GEO_RESOLUTION * 180))
#define VAR_SET_VALUE(ctx, var, value)
#define PUSH1(v)
#define POP1(v)
#define ALLOC1(value)
#define POP1ALLOC1(arg, value)
#define POP2ALLOC1(arg1, arg2, value)
#define INTEGER_ARITHMETIC_OPERATION_PLUS(x, y)   ((x) + (y))
#define FLOAT_ARITHMETIC_OPERATION_PLUS(x, y)   ((double)(x) + (double)(y))
#define INTEGER_ARITHMETIC_OPERATION_MINUS(x, y)   ((x) - (y))
#define FLOAT_ARITHMETIC_OPERATION_MINUS(x, y)   ((double)(x) - (double)(y))
#define INTEGER_ARITHMETIC_OPERATION_STAR(x, y)   ((x) * (y))
#define FLOAT_ARITHMETIC_OPERATION_STAR(x, y)   ((double)(x) * (double)(y))
#define INTEGER_ARITHMETIC_OPERATION_SLASH(x, y)   ((x) / (y))
#define FLOAT_ARITHMETIC_OPERATION_SLASH(x, y)   ((double)(x) / (double)(y))
#define INTEGER_ARITHMETIC_OPERATION_MOD(x, y)   ((x) % (y))
#define FLOAT_ARITHMETIC_OPERATION_MOD(x, y)   (fmod((x), (y)))
#define INTEGER_ARITHMETIC_OPERATION_SHIFTL(x, y)   ((x) << (y))
#define FLOAT_ARITHMETIC_OPERATION_SHIFTL(x, y)   ((long long int)(x) << (long long int)(y))
#define INTEGER_ARITHMETIC_OPERATION_SHIFTR(x, y)   ((x) >> (y))
#define FLOAT_ARITHMETIC_OPERATION_SHIFTR(x, y)   ((long long int)(x) >> (long long int)(y))
#define INTEGER8_ARITHMETIC_OPERATION_SHIFTRR(x, y)   ((uint8_t)(x) >> (y))
#define INTEGER16_ARITHMETIC_OPERATION_SHIFTRR(x, y)   ((uint16_t)(x) >> (y))
#define INTEGER32_ARITHMETIC_OPERATION_SHIFTRR(x, y)   ((unsigned int)(x) >> (y))
#define INTEGER64_ARITHMETIC_OPERATION_SHIFTRR(x, y)   ((long long unsigned int)(x) >> (y))
#define FLOAT_ARITHMETIC_OPERATION_SHIFTRR(x, y)   ((long long unsigned int)(x) >> (long long unsigned int)(y))
#define INTEGER_ARITHMETIC_OPERATION_BITWISE_OR(x, y)   ((x) | (y))
#define FLOAT_ARITHMETIC_OPERATION_BITWISE_OR(x, y)   ((long long int)(x) | (long long int)(y))
#define INTEGER_ARITHMETIC_OPERATION_BITWISE_XOR(x, y)   ((x) ^ (y))
#define FLOAT_ARITHMETIC_OPERATION_BITWISE_XOR(x, y)   ((long long int)(x) ^ (long long int)(y))
#define INTEGER_ARITHMETIC_OPERATION_BITWISE_AND(x, y)   ((x) & (y))
#define FLOAT_ARITHMETIC_OPERATION_BITWISE_AND(x, y)   ((long long int)(x) & (long long int)(y))
#define INTEGER_UNARY_ARITHMETIC_OPERATION_MINUS(x)   (-(x))
#define FLOAT_UNARY_ARITHMETIC_OPERATION_MINUS(x)   (-(x))
#define INTEGER_UNARY_ARITHMETIC_OPERATION_BITWISE_NOT(x)   (~(x))
#define FLOAT_UNARY_ARITHMETIC_OPERATION_BITWISE_NOT(x)   (~((long long int)(x)))
#define TEXT_ARITHMETIC_OPERATION(operator)
#define TEXT_UNARY_ARITHMETIC_OPERATION(unary_operator)
#define ARITHMETIC_OPERATION_NO_CHECK(y)   do {} while (0)
#define ARITHMETIC_OPERATION_ZERO_DIVISION_CHECK(y)
#define NUMERIC_ARITHMETIC_OPERATION_DISPATCH(set, get, x_, y, res,integer_operation,float_operation,right_expression_check,invalid_type_error)
#define ARITHMETIC_OPERATION_DISPATCH(x, y, res,integer8_operation,integer16_operation,integer32_operation,integer64_operation,float_operation,left_expression_check,right_expression_check,text_operation,invalid_type_error)
#define ARITHMETIC_BINARY_OPERATION_DISPATCH(integer8_operation,integer16_operation,integer32_operation,integer64_operation,float_operation,left_expression_check,right_expression_check,text_operation,invalid_type_error)
#define ARITHMETIC_UNARY_OPERATION_DISPATCH(integer_operation,float_operation,left_expression_check,right_expression_check,text_operation,invalid_type_error)
#define EXEC_OPERATE(operate_sentence, assign_sentence)
#define EXEC_OPERATE_POST(operate_sentence, assign_sentence)
#define UNARY_OPERATE_AND_ASSIGN_DISPATCH(exec_operate, delta,set_flags)
#define ARITHMETIC_OPERATION_AND_ASSIGN_DISPATCH(integer8_operation,integer16_operation,integer32_operation,integer64_operation,float_operation,left_expression_check, right_expression_check, text_operation)
#define SI_FREE(si)
#define SI_ALLOC(si, i, st)
#define EXPRLOG(name, expr)
#define DEFAULT_NEAR_MAX_INTERVAL   10
#define DEFAULT_WEIGHT   5
#define DEFAULT_DECAYSTEP   2
#define DEFAULT_MAX_INTERVAL   10
#define DEFAULT_SIMILARITY_THRESHOLD   10
#define DEFAULT_TERM_EXTRACT_POLICY   0
#define DEFAULT_WEIGHT_VECTOR_SIZE   4096
#define DISABLE_UNUSED_CODE   1
#define PARSE(token)   grn_expr_parser(ctx->impl->parser, (token), 0, q)

Enumerations

enum  grn_expr_pack_type { GRN_EXPR_PACK_TYPE_NULL = 0, GRN_EXPR_PACK_TYPE_VARIABLE = 1, GRN_EXPR_PACK_TYPE_OTHERS = 2 }

Functions

grn_objgrn_expr_alloc (grn_ctx *ctx, grn_obj *expr, grn_id domain, grn_obj_flags flags)
grn_rc grn_expr_clear_vars (grn_ctx *ctx, grn_obj *expr)
grn_objgrn_proc_get_info (grn_ctx *ctx, grn_user_data *user_data, grn_expr_var **vars, unsigned int *nvars, grn_obj **caller)
grn_objgrn_proc_get_var (grn_ctx *ctx, grn_user_data *user_data, const char *name, unsigned int name_size)
grn_objgrn_proc_get_var_by_offset (grn_ctx *ctx, grn_user_data *user_data, unsigned int offset)
grn_objgrn_proc_get_or_add_var (grn_ctx *ctx, grn_user_data *user_data, const char *name, unsigned int name_size)
grn_objgrn_proc_alloc (grn_ctx *ctx, grn_user_data *user_data, grn_id domain, grn_obj_flags flags)
grn_rc grn_proc_set_selector (grn_ctx *ctx, grn_obj *proc, grn_selector_func selector)
grn_rc grn_expr_inspect (grn_ctx *ctx, grn_obj *buf, grn_obj *expr)
grn_objgrn_ctx_pop (grn_ctx *ctx)
grn_rc grn_ctx_push (grn_ctx *ctx, grn_obj *obj)
void grn_obj_pack (grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
const uint8_t * grn_obj_unpack (grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, uint8_t type, uint8_t flags, grn_obj *obj)
void grn_expr_pack (grn_ctx *ctx, grn_obj *buf, grn_obj *expr)
const uint8_t * grn_expr_unpack (grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, grn_obj *expr)
grn_objgrn_expr_open (grn_ctx *ctx, grn_obj_spec *spec, const uint8_t *p, const uint8_t *pe)
grn_expr_dfidfi_value_at (grn_expr *expr, int offset)
grn_objgrn_expr_create (grn_ctx *ctx, const char *name, unsigned int name_size)
grn_rc grn_expr_close (grn_ctx *ctx, grn_obj *expr)
grn_objgrn_expr_add_var (grn_ctx *ctx, grn_obj *expr, const char *name, unsigned int name_size)
grn_objgrn_expr_get_var (grn_ctx *ctx, grn_obj *expr, const char *name, unsigned int name_size)
grn_objgrn_expr_get_or_add_var (grn_ctx *ctx, grn_obj *expr, const char *name, unsigned int name_size)
grn_objgrn_expr_get_var_by_offset (grn_ctx *ctx, grn_obj *expr, unsigned int offset)
grn_objgrn_expr_append_obj (grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op, int nargs)
grn_objgrn_expr_append_const (grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op, int nargs)
grn_objgrn_expr_append_const_str (grn_ctx *ctx, grn_obj *expr, const char *str, unsigned int str_size, grn_operator op, int nargs)
grn_objgrn_expr_append_const_int (grn_ctx *ctx, grn_obj *expr, int i, grn_operator op, int nargs)
grn_rc grn_expr_append_op (grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs)
grn_rc grn_expr_compile (grn_ctx *ctx, grn_obj *expr)
grn_rc grn_proc_call (grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
grn_objgrn_expr_exec (grn_ctx *ctx, grn_obj *expr, int nargs)
grn_objgrn_expr_get_value (grn_ctx *ctx, grn_obj *expr, int offset)
scan_infogrn_scan_info_open (grn_ctx *ctx, int start)
void grn_scan_info_close (grn_ctx *ctx, scan_info *si)
void grn_scan_info_put_index (grn_ctx *ctx, scan_info *si, grn_obj *index, uint32_t sid, int32_t weight)
scan_info ** grn_scan_info_put_logical_op (grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int start)
int32_t grn_expr_code_get_weight (grn_ctx *ctx, grn_expr_code *ec)
int grn_scan_info_get_flags (scan_info *si)
void grn_scan_info_set_flags (scan_info *si, int flags)
grn_operator grn_scan_info_get_logical_op (scan_info *si)
void grn_scan_info_set_logical_op (scan_info *si, grn_operator logical_op)
void grn_scan_info_set_op (scan_info *si, grn_operator op)
void grn_scan_info_set_end (scan_info *si, uint32_t end)
void grn_scan_info_set_query (scan_info *si, grn_obj *query)
grn_bool grn_scan_info_push_arg (scan_info *si, grn_obj *arg)
grn_objgrn_scan_info_get_arg (grn_ctx *ctx, scan_info *si, int i)
grn_objgrn_table_select (grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *res, grn_operator op)
grn_objgrn_ptr_value_at (grn_obj *obj, int offset)
int32_t grn_int32_value_at (grn_obj *obj, int offset)
grn_rc grn_expr_parse (grn_ctx *ctx, grn_obj *expr, const char *str, unsigned int str_size, grn_obj *default_column, grn_operator default_mode, grn_operator default_op, grn_expr_flags flags)
grn_rc grn_expr_parser_close (grn_ctx *ctx)
grn_snipgrn_expr_snip (grn_ctx *ctx, grn_obj *expr, int flags, unsigned int width, unsigned int max_results, unsigned int n_tags, const char **opentags, unsigned int *opentag_lens, const char **closetags, unsigned int *closetag_lens, grn_snip_mapping *mapping)
grn_rc grn_column_filter (grn_ctx *ctx, grn_obj *column, grn_operator operator, grn_obj *value, grn_obj *result_set, grn_operator set_operation)
grn_rc grn_expr_syntax_escape (grn_ctx *ctx, const char *string, int string_size, const char *target_characters, char escape_character, grn_obj *escaped_string)
grn_rc grn_expr_syntax_escape_query (grn_ctx *ctx, const char *query, int query_size, grn_obj *escaped_query)

Macro Definition Documentation

#define ALLOC1 (   value)
Value:
do {\
s1 = s0;\
*sp++ = s0 = value = vp++;\
if (vp - e->values > e->values_tail) { e->values_tail = vp - e->values; }\
} while (0)

Definition at line 1827 of file expr.c.

#define APPEND_UNARY_MINUS_OP (   e)

Definition at line 788 of file expr.c.

#define ARITHMETIC_BINARY_OPERATION_DISPATCH (   integer8_operation,
  integer16_operation,
  integer32_operation,
  integer64_operation,
  float_operation,
  left_expression_check,
  right_expression_check,
  text_operation,
  invalid_type_error 
)
Value:
do { \
grn_obj *x, *y; \
POP2ALLOC1(x, y, res); \
if (y != res) { \
res->header.domain = x->header.domain; \
} \
ARITHMETIC_OPERATION_DISPATCH(x, y, res, \
integer8_operation, \
integer16_operation, \
integer32_operation, \
integer64_operation, \
float_operation, \
left_expression_check, \
right_expression_check, \
text_operation, \
invalid_type_error); \
if (y == res) { \
res->header.domain = x->header.domain; \
} \
} while (0)

Definition at line 2206 of file expr.c.

#define ARITHMETIC_OPERATION_AND_ASSIGN_DISPATCH (   integer8_operation,
  integer16_operation,
  integer32_operation,
  integer64_operation,
  float_operation,
  left_expression_check,
  right_expression_check,
  text_operation 
)

Definition at line 2418 of file expr.c.

#define ARITHMETIC_OPERATION_DISPATCH (   x,
  y,
  res,
  integer8_operation,
  integer16_operation,
  integer32_operation,
  integer64_operation,
  float_operation,
  left_expression_check,
  right_expression_check,
  text_operation,
  invalid_type_error 
)

Definition at line 2043 of file expr.c.

#define ARITHMETIC_OPERATION_NO_CHECK (   y)    do {} while (0)

Definition at line 1928 of file expr.c.

#define ARITHMETIC_OPERATION_ZERO_DIVISION_CHECK (   y)
Value:
do { \
if ((long long int)y == 0) { \
ERR(GRN_INVALID_ARGUMENT, "dividend should not be 0"); \
goto exit; \
} \
} while (0)

Definition at line 1929 of file expr.c.

#define ARITHMETIC_UNARY_OPERATION_DISPATCH (   integer_operation,
  float_operation,
  left_expression_check,
  right_expression_check,
  text_operation,
  invalid_type_error 
)

Definition at line 2236 of file expr.c.

#define CONSTP (   obj)    ((obj) && ((obj)->header.impl_flags & GRN_OBJ_EXPRCONST))

Definition at line 777 of file expr.c.

#define DEFAULT_DECAYSTEP   2

Definition at line 5004 of file expr.c.

#define DEFAULT_MAX_INTERVAL   10

Definition at line 5005 of file expr.c.

#define DEFAULT_NEAR_MAX_INTERVAL   10
#define DEFAULT_SIMILARITY_THRESHOLD   10

Definition at line 5006 of file expr.c.

#define DEFAULT_TERM_EXTRACT_POLICY   0

Definition at line 5007 of file expr.c.

#define DEFAULT_WEIGHT   5

Definition at line 5003 of file expr.c.

#define DEFAULT_WEIGHT_VECTOR_SIZE   4096

Definition at line 5008 of file expr.c.

#define DFI_POP (   e,
 
)
Value:
do {\
if (GRN_BULK_VSIZE(&(e)->dfi) >= sizeof(grn_expr_dfi)) {\
GRN_BULK_INCR_LEN((&(e)->dfi), -(sizeof(grn_expr_dfi)));\
(d) = (grn_expr_dfi *)(GRN_BULK_CURR(&(e)->dfi));\
(e)->code0 = (d)->code;\
} else {\
(d) = NULL;\
(e)->code0 = NULL;\
}\
} while (0)

Definition at line 542 of file expr.c.

#define DFI_PUT (   e,
  t,
  d,
 
)
Value:
do {\
dfi.type = (t);\
dfi.domain = (d);\
dfi.code = (c);\
if ((e)->code0) { (e)->code0->modify = (c) ? ((c) - (e)->code0) : 0; }\
grn_bulk_write(ctx, &(e)->dfi, (char *)&dfi, sizeof(grn_expr_dfi));\
(e)->code0 = NULL;\
} while (0)

Definition at line 553 of file expr.c.

#define DISABLE_UNUSED_CODE   1

Definition at line 5417 of file expr.c.

#define DO_COMPARE (   x,
  y,
  r,
  op 
)

Definition at line 1522 of file expr.c.

#define DO_COMPARE_BUILTIN (   x,
  y,
  r,
  op 
)

Definition at line 1403 of file expr.c.

#define DO_COMPARE_SUB (   op)
Value:
do {\
switch (y->header.domain) {\
case GRN_DB_TEXT :\
{\
GRN_OBJ_INIT(&y_, GRN_BULK, 0, x->header.domain);\
if (grn_obj_cast(ctx, y, &y_, GRN_FALSE)) {\
r = 0;\
} else {\
DO_COMPARE_SUB_NUMERIC(&y_, op);\
}\
GRN_OBJ_FIN(ctx, &y_);\
}\
break;\
default :\
DO_COMPARE_SUB_NUMERIC(y,op);\
break;\
}\
} while (0)

Definition at line 1381 of file expr.c.

#define DO_COMPARE_SUB_NUMERIC (   y,
  op 
)

Definition at line 1343 of file expr.c.

#define DO_EQ (   x,
  y,
 
)

Definition at line 1602 of file expr.c.

#define DO_EQ_SUB

Definition at line 1555 of file expr.c.

#define EXEC_OPERATE (   operate_sentence,
  assign_sentence 
)
Value:
operate_sentence \
assign_sentence

Definition at line 2352 of file expr.c.

#define EXEC_OPERATE_POST (   operate_sentence,
  assign_sentence 
)
Value:
assign_sentence \
operate_sentence

Definition at line 2356 of file expr.c.

#define EXPRLOG (   name,
  expr 
)
Value:
do {\
grn_obj strbuf;\
GRN_TEXT_INIT(&strbuf, 0);\
grn_expr_inspect(ctx, &strbuf, (expr));\
GRN_TEXT_PUTC(ctx, &strbuf, '\0');\
GRN_LOG(ctx, GRN_LOG_NOTICE, "%s=(%s)", (name), GRN_TEXT_VALUE(&strbuf));\
GRN_OBJ_FIN(ctx, &strbuf);\
} while (0)

Definition at line 3891 of file expr.c.

#define EXPRVP (   x)    ((x)->header.impl_flags & GRN_OBJ_EXPRVALUE)

Definition at line 775 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_BITWISE_AND (   x,
 
)    ((long long int)(x) & (long long int)(y))

Definition at line 1890 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_BITWISE_OR (   x,
 
)    ((long long int)(x) | (long long int)(y))

Definition at line 1884 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_BITWISE_XOR (   x,
 
)    ((long long int)(x) ^ (long long int)(y))

Definition at line 1887 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_MINUS (   x,
 
)    ((double)(x) - (double)(y))

Definition at line 1859 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_MOD (   x,
 
)    (fmod((x), (y)))

Definition at line 1865 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_PLUS (   x,
 
)    ((double)(x) + (double)(y))

Definition at line 1857 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_SHIFTL (   x,
 
)    ((long long int)(x) << (long long int)(y))

Definition at line 1867 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_SHIFTR (   x,
 
)    ((long long int)(x) >> (long long int)(y))

Definition at line 1870 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_SHIFTRR (   x,
 
)    ((long long unsigned int)(x) >> (long long unsigned int)(y))

Definition at line 1880 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_SLASH (   x,
 
)    ((double)(x) / (double)(y))

Definition at line 1863 of file expr.c.

#define FLOAT_ARITHMETIC_OPERATION_STAR (   x,
 
)    ((double)(x) * (double)(y))

Definition at line 1861 of file expr.c.

#define FLOAT_UNARY_ARITHMETIC_OPERATION_BITWISE_NOT (   x)    (~((long long int)(x)))

Definition at line 1896 of file expr.c.

#define FLOAT_UNARY_ARITHMETIC_OPERATION_MINUS (   x)    (-(x))

Definition at line 1894 of file expr.c.

#define GEO_BES_C1   6334834

Definition at line 1764 of file expr.c.

#define GEO_BES_C2   6377397

Definition at line 1765 of file expr.c.

#define GEO_BES_C3   0.006674

Definition at line 1766 of file expr.c.

#define GEO_GRS_C1   6335439

Definition at line 1767 of file expr.c.

#define GEO_GRS_C2   6378137

Definition at line 1768 of file expr.c.

#define GEO_GRS_C3   0.006694

Definition at line 1769 of file expr.c.

#define GEO_INT2RAD (   x)    ((M_PI * x) / (GEO_RESOLUTION * 180))

Definition at line 1770 of file expr.c.

#define GEO_RADIOUS   6357303

Definition at line 1763 of file expr.c.

#define GEO_RESOLUTION   3600000

Definition at line 1762 of file expr.c.

#define GRN_PTR_POP (   obj,
  value 
)
Value:
do {\
if (GRN_BULK_VSIZE(obj) >= sizeof(grn_obj *)) {\
GRN_BULK_INCR_LEN((obj), -(sizeof(grn_obj *)));\
value = *(grn_obj **)(GRN_BULK_CURR(obj));\
} else {\
value = NULL;\
}\
} while (0)

Definition at line 638 of file expr.c.

#define INTEGER16_ARITHMETIC_OPERATION_SHIFTRR (   x,
 
)    ((uint16_t)(x) >> (y))

Definition at line 1874 of file expr.c.

#define INTEGER32_ARITHMETIC_OPERATION_SHIFTRR (   x,
 
)    ((unsigned int)(x) >> (y))

Definition at line 1876 of file expr.c.

#define INTEGER64_ARITHMETIC_OPERATION_SHIFTRR (   x,
 
)    ((long long unsigned int)(x) >> (y))

Definition at line 1878 of file expr.c.

#define INTEGER8_ARITHMETIC_OPERATION_SHIFTRR (   x,
 
)    ((uint8_t)(x) >> (y))

Definition at line 1872 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_BITWISE_AND (   x,
 
)    ((x) & (y))

Definition at line 1889 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_BITWISE_OR (   x,
 
)    ((x) | (y))

Definition at line 1883 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_BITWISE_XOR (   x,
 
)    ((x) ^ (y))

Definition at line 1886 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_MINUS (   x,
 
)    ((x) - (y))

Definition at line 1858 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_MOD (   x,
 
)    ((x) % (y))

Definition at line 1864 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_PLUS (   x,
 
)    ((x) + (y))

Definition at line 1856 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_SHIFTL (   x,
 
)    ((x) << (y))

Definition at line 1866 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_SHIFTR (   x,
 
)    ((x) >> (y))

Definition at line 1869 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_SLASH (   x,
 
)    ((x) / (y))

Definition at line 1862 of file expr.c.

#define INTEGER_ARITHMETIC_OPERATION_STAR (   x,
 
)    ((x) * (y))

Definition at line 1860 of file expr.c.

#define INTEGER_UNARY_ARITHMETIC_OPERATION_BITWISE_NOT (   x)    (~(x))

Definition at line 1895 of file expr.c.

#define INTEGER_UNARY_ARITHMETIC_OPERATION_MINUS (   x)    (-(x))

Definition at line 1893 of file expr.c.

#define NUMERIC_ARITHMETIC_OPERATION_DISPATCH (   set,
  get,
  x_,
  y,
  res,
  integer_operation,
  float_operation,
  right_expression_check,
  invalid_type_error 
)

Definition at line 1937 of file expr.c.

#define PARSE (   token)    grn_expr_parser(ctx->impl->parser, (token), 0, q)

Definition at line 5550 of file expr.c.

#define POP1 (   v)
Value:
do {\
if (EXPRVP(s0)) { vp--; }\
v = s0;\
s0 = s1;\
sp--;\
if (sp < s_) { ERR(GRN_INVALID_ARGUMENT, "stack underflow"); goto exit; }\
s1 = sp[-2];\
} while (0)

Definition at line 1818 of file expr.c.

#define POP1ALLOC1 (   arg,
  value 
)
Value:
do {\
arg = s0;\
if (EXPRVP(s0)) {\
value = s0;\
} else {\
if (sp < s_ + 1) { ERR(GRN_INVALID_ARGUMENT, "stack underflow"); goto exit; }\
sp[-1] = s0 = value = vp++;\
s0->header.impl_flags |= GRN_OBJ_EXPRVALUE;\
}\
} while (0)

Definition at line 1833 of file expr.c.

#define POP2ALLOC1 (   arg1,
  arg2,
  value 
)
Value:
do {\
if (EXPRVP(s0)) { vp--; }\
if (EXPRVP(s1)) { vp--; }\
arg2 = s0;\
arg1 = s1;\
sp--;\
if (sp < s_ + 1) { ERR(GRN_INVALID_ARGUMENT, "stack underflow"); goto exit; }\
s1 = sp[-2];\
sp[-1] = s0 = value = vp++;\
s0->header.impl_flags |= GRN_OBJ_EXPRVALUE;\
} while (0)

Definition at line 1844 of file expr.c.

#define PUSH1 (   v)
Value:
do {\
if (EXPRVP(v)) { vp++; }\
s1 = s0;\
*sp++ = s0 = v;\
} while (0)

Definition at line 1812 of file expr.c.

#define PUSH_CODE (   e,
  o,
  v,
  n,
 
)
Value:
do {\
(c) = &(e)->codes[e->codes_curr++];\
(c)->value = (v);\
(c)->nargs = (n);\
(c)->op = (o);\
(c)->flags = 0;\
(c)->modify = 0;\
} while (0)

Definition at line 779 of file expr.c.

#define PUSH_N_ARGS_ARITHMETIC_OP (   e,
  op,
  obj,
  nargs,
  code 
)
Value:
do { \
PUSH_CODE(e, op, obj, nargs, code); \
{ \
int i = nargs; \
while (i--) { \
DFI_POP(e, dfi); \
} \
} \
DFI_PUT(e, type, domain, code); \
} while (0)

Definition at line 831 of file expr.c.

#define SI_ALLOC (   si,
  i,
  st 
)
Value:
do {\
if (!((si) = GRN_MALLOCN(scan_info, 1))) {\
int j;\
for (j = 0; j < i; j++) { SI_FREE(sis[j]); }\
GRN_FREE(sis);\
return NULL;\
}\
GRN_INT32_INIT(&(si)->wv, GRN_OBJ_VECTOR);\
GRN_PTR_INIT(&(si)->index, GRN_OBJ_VECTOR, GRN_ID_NIL);\
(si)->logical_op = GRN_OP_OR;\
(si)->flags = SCAN_PUSH;\
(si)->nargs = 0;\
(si)->start = (st);\
} while (0)

Definition at line 3811 of file expr.c.

#define SI_FREE (   si)
Value:
do {\
GRN_OBJ_FIN(ctx, &(si)->wv);\
GRN_OBJ_FIN(ctx, &(si)->index);\
GRN_FREE(si);\
} while (0)

Definition at line 3805 of file expr.c.

#define TEXT_ARITHMETIC_OPERATION (   operator)
Value:
do { \
long long int x_; \
long long int y_; \
\
res->header.domain = GRN_DB_INT64; \
GRN_INT64_SET(ctx, res, 0); \
grn_obj_cast(ctx, x, res, GRN_FALSE); \
x_ = GRN_INT64_VALUE(res); \
GRN_INT64_SET(ctx, res, 0); \
grn_obj_cast(ctx, y, res, GRN_FALSE); \
y_ = GRN_INT64_VALUE(res); \
GRN_INT64_SET(ctx, res, x_ operator y_); \
} while (0)

Definition at line 1899 of file expr.c.

#define TEXT_UNARY_ARITHMETIC_OPERATION (   unary_operator)
Value:
do { \
long long int x_; \
\
res->header.domain = GRN_DB_INT64; \
GRN_INT64_SET(ctx, res, 0); \
grn_obj_cast(ctx, x, res, GRN_FALSE); \
x_ = GRN_INT64_VALUE(res); \
GRN_INT64_SET(ctx, res, unary_operator x_); \
} while (0)

Definition at line 1916 of file expr.c.

#define UNARY_OPERATE_AND_ASSIGN_DISPATCH (   exec_operate,
  delta,
  set_flags 
)

Definition at line 2360 of file expr.c.

#define VAR_SET_VALUE (   ctx,
  var,
  value 
)
Value:
do {\
if (GRN_DB_OBJP(value)) {\
(var)->header.type = GRN_PTR;\
(var)->header.domain = DB_OBJ(value)->id;\
GRN_PTR_SET(ctx, (var), (value));\
} else {\
(var)->header.type = (value)->header.type;\
(var)->header.domain = (value)->header.domain;\
GRN_TEXT_SET(ctx, (var), GRN_TEXT_VALUE(value), GRN_TEXT_LEN(value));\
}\
} while (0)

Definition at line 1772 of file expr.c.

#define WITH_SPSAVE (   block)
Value:
do {\
ctx->impl->stack_curr = sp - ctx->impl->stack;\
e->values_curr = vp - e->values;\
block\
vp = e->values + e->values_curr;\
s0 = sp[-1];\
s1 = sp[-2];\
} while (0)

Definition at line 1333 of file expr.c.

Enumeration Type Documentation

Enumerator:
GRN_EXPR_PACK_TYPE_NULL 
GRN_EXPR_PACK_TYPE_VARIABLE 
GRN_EXPR_PACK_TYPE_OTHERS 

Definition at line 387 of file expr.c.

Function Documentation

grn_expr_dfi* dfi_value_at ( grn_expr expr,
int  offset 
)

Definition at line 564 of file expr.c.

grn_rc grn_column_filter ( grn_ctx ctx,
grn_obj column,
grn_operator  operator,
grn_obj value,
grn_obj result_set,
grn_operator  set_operation 
)

Definition at line 6574 of file expr.c.

Here is the call graph for this function:

grn_obj* grn_ctx_pop ( grn_ctx ctx)

Definition at line 321 of file expr.c.

Here is the caller graph for this function:

grn_rc grn_ctx_push ( grn_ctx ctx,
grn_obj obj 
)

Definition at line 330 of file expr.c.

Here is the caller graph for this function:

grn_obj* grn_expr_add_var ( grn_ctx ctx,
grn_obj expr,
const char *  name,
unsigned int  name_size 
)

Definition at line 695 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_alloc ( grn_ctx ctx,
grn_obj expr,
grn_id  domain,
grn_obj_flags  flags 
)

Definition at line 46 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_append_const ( grn_ctx ctx,
grn_obj expr,
grn_obj obj,
grn_operator  op,
int  nargs 
)

Definition at line 1245 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_append_const_int ( grn_ctx ctx,
grn_obj expr,
int  i,
grn_operator  op,
int  nargs 
)

Definition at line 1304 of file expr.c.

Here is the call graph for this function:

grn_obj* grn_expr_append_const_str ( grn_ctx ctx,
grn_obj expr,
const char *  str,
unsigned int  str_size,
grn_operator  op,
int  nargs 
)

Definition at line 1293 of file expr.c.

Here is the call graph for this function:

grn_obj* grn_expr_append_obj ( grn_ctx ctx,
grn_obj expr,
grn_obj obj,
grn_operator  op,
int  nargs 
)

Definition at line 843 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_append_op ( grn_ctx ctx,
grn_obj expr,
grn_operator  op,
int  nargs 
)

Definition at line 1320 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_clear_vars ( grn_ctx ctx,
grn_obj expr 
)

Definition at line 95 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_close ( grn_ctx ctx,
grn_obj expr 
)

Definition at line 648 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t grn_expr_code_get_weight ( grn_ctx ctx,
grn_expr_code ec 
)

Definition at line 3987 of file expr.c.

grn_rc grn_expr_compile ( grn_ctx ctx,
grn_obj expr 
)

Definition at line 1327 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_create ( grn_ctx ctx,
const char *  name,
unsigned int  name_size 
)

Definition at line 575 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_exec ( grn_ctx ctx,
grn_obj expr,
int  nargs 
)

Definition at line 2561 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_get_or_add_var ( grn_ctx ctx,
grn_obj expr,
const char *  name,
unsigned int  name_size 
)

Definition at line 744 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_get_value ( grn_ctx ctx,
grn_obj expr,
int  offset 
)

Definition at line 3746 of file expr.c.

grn_obj* grn_expr_get_var ( grn_ctx ctx,
grn_obj expr,
const char *  name,
unsigned int  name_size 
)

Definition at line 734 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_get_var_by_offset ( grn_ctx ctx,
grn_obj expr,
unsigned int  offset 
)

Definition at line 766 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_inspect ( grn_ctx ctx,
grn_obj buf,
grn_obj expr 
)

Definition at line 267 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_expr_open ( grn_ctx ctx,
grn_obj_spec spec,
const uint8_t *  p,
const uint8_t *  pe 
)

Definition at line 494 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void grn_expr_pack ( grn_ctx ctx,
grn_obj buf,
grn_obj expr 
)

Definition at line 394 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_parse ( grn_ctx ctx,
grn_obj expr,
const char *  str,
unsigned int  str_size,
grn_obj default_column,
grn_operator  default_mode,
grn_operator  default_op,
grn_expr_flags  flags 
)

Definition at line 6410 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_parser_close ( grn_ctx ctx)

Definition at line 6479 of file expr.c.

Here is the caller graph for this function:

grn_snip* grn_expr_snip ( grn_ctx ctx,
grn_obj expr,
int  flags,
unsigned int  width,
unsigned int  max_results,
unsigned int  n_tags,
const char **  opentags,
unsigned int *  opentag_lens,
const char **  closetags,
unsigned int *  closetag_lens,
grn_snip_mapping mapping 
)

Definition at line 6494 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_syntax_escape ( grn_ctx ctx,
const char *  string,
int  string_size,
const char *  target_characters,
char  escape_character,
grn_obj escaped_string 
)

Definition at line 6593 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_expr_syntax_escape_query ( grn_ctx ctx,
const char *  query,
int  query_size,
grn_obj escaped_query 
)

Definition at line 6638 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const uint8_t* grn_expr_unpack ( grn_ctx ctx,
const uint8_t *  p,
const uint8_t *  pe,
grn_obj expr 
)

Definition at line 430 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t grn_int32_value_at ( grn_obj obj,
int  offset 
)

Definition at line 4990 of file expr.c.

void grn_obj_pack ( grn_ctx ctx,
grn_obj buf,
grn_obj obj 
)

Definition at line 357 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const uint8_t* grn_obj_unpack ( grn_ctx ctx,
const uint8_t *  p,
const uint8_t *  pe,
uint8_t  type,
uint8_t  flags,
grn_obj obj 
)

Definition at line 372 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_proc_alloc ( grn_ctx ctx,
grn_user_data user_data,
grn_id  domain,
grn_obj_flags  flags 
)

Definition at line 156 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_proc_call ( grn_ctx ctx,
grn_obj proc,
int  nargs,
grn_obj caller 
)

Definition at line 1785 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_obj* grn_proc_get_info ( grn_ctx ctx,
grn_user_data user_data,
grn_expr_var **  vars,
unsigned int *  nvars,
grn_obj **  caller 
)

Definition at line 115 of file expr.c.

grn_obj* grn_proc_get_or_add_var ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
unsigned int  name_size 
)

Definition at line 148 of file expr.c.

Here is the call graph for this function:

grn_obj* grn_proc_get_var ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
unsigned int  name_size 
)

Definition at line 134 of file expr.c.

Here is the call graph for this function:

grn_obj* grn_proc_get_var_by_offset ( grn_ctx ctx,
grn_user_data user_data,
unsigned int  offset 
)

Definition at line 141 of file expr.c.

Here is the call graph for this function:

grn_rc grn_proc_set_selector ( grn_ctx ctx,
grn_obj proc,
grn_selector_func  selector 
)

Definition at line 163 of file expr.c.

Here is the caller graph for this function:

grn_obj* grn_ptr_value_at ( grn_obj obj,
int  offset 
)

Definition at line 4980 of file expr.c.

void grn_scan_info_close ( grn_ctx ctx,
scan_info si 
)

Definition at line 3968 of file expr.c.

grn_obj* grn_scan_info_get_arg ( grn_ctx ctx,
scan_info si,
int  i 
)

Definition at line 4046 of file expr.c.

int grn_scan_info_get_flags ( scan_info si)

Definition at line 3993 of file expr.c.

grn_operator grn_scan_info_get_logical_op ( scan_info si)

Definition at line 4005 of file expr.c.

scan_info* grn_scan_info_open ( grn_ctx ctx,
int  start 
)

Definition at line 3949 of file expr.c.

grn_bool grn_scan_info_push_arg ( scan_info si,
grn_obj arg 
)

Definition at line 4035 of file expr.c.

void grn_scan_info_put_index ( grn_ctx ctx,
scan_info si,
grn_obj index,
uint32_t  sid,
int32_t  weight 
)

Definition at line 3974 of file expr.c.

scan_info** grn_scan_info_put_logical_op ( grn_ctx ctx,
scan_info **  sis,
int *  ip,
grn_operator  op,
int  start 
)

Definition at line 3980 of file expr.c.

void grn_scan_info_set_end ( scan_info si,
uint32_t  end 
)

Definition at line 4023 of file expr.c.

void grn_scan_info_set_flags ( scan_info si,
int  flags 
)

Definition at line 3999 of file expr.c.

void grn_scan_info_set_logical_op ( scan_info si,
grn_operator  logical_op 
)

Definition at line 4011 of file expr.c.

void grn_scan_info_set_op ( scan_info si,
grn_operator  op 
)

Definition at line 4017 of file expr.c.

void grn_scan_info_set_query ( scan_info si,
grn_obj query 
)

Definition at line 4029 of file expr.c.

grn_obj* grn_table_select ( grn_ctx ctx,
grn_obj table,
grn_obj expr,
grn_obj res,
grn_operator  op 
)

Definition at line 4888 of file expr.c.

Here is the call graph for this function:

Here is the caller graph for this function: