Groonga
Loading...
Searching...
No Matches
plugin.h File Reference
#include <stddef.h>
#include <groonga.h>
Include dependency graph for plugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRN_PLUGIN_IMPL_NAME_RAW(type)   grn_plugin_impl_##type
 
#define GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)    GRN_PLUGIN_IMPL_NAME_RAW(type##_##tag)
 
#define GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE(type, tag)    GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)
 
#define GRN_PLUGIN_IMPL_NAME(type)   GRN_PLUGIN_IMPL_NAME_RAW(type)
 
#define GRN_PLUGIN_INIT   GRN_PLUGIN_IMPL_NAME(init)
 
#define GRN_PLUGIN_REGISTER   GRN_PLUGIN_IMPL_NAME(register)
 
#define GRN_PLUGIN_FIN   GRN_PLUGIN_IMPL_NAME(fin)
 
#define GRN_PLUGIN_EXPORT
 
#define GRN_PLUGIN_DECLARE_FUNCTIONS(tag)
 
#define GRN_PLUGIN_MALLOC(ctx, size)    grn_plugin_malloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)
 
#define GRN_PLUGIN_MALLOCN(ctx, type, n)
 
#define GRN_PLUGIN_CALLOC(ctx, size)    grn_plugin_calloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)
 
#define GRN_PLUGIN_REALLOC(ctx, ptr, size)    grn_plugin_realloc((ctx), (ptr), (size), __FILE__, __LINE__, __FUNCTION__)
 
#define GRN_PLUGIN_FREE(ctx, ptr)    grn_plugin_free((ctx), (ptr), __FILE__, __LINE__, __FUNCTION__)
 
#define GRN_PLUGIN_LOG(ctx, level, ...)   GRN_LOG((ctx), (level), __VA_ARGS__)
 
#define GRN_PLUGIN_SET_ERROR(ctx, level, error_code, ...)
 
#define GRN_PLUGIN_ERROR(ctx, error_code, ...)    GRN_PLUGIN_SET_ERROR(ctx, GRN_LOG_ERROR, error_code, __VA_ARGS__)
 
#define GRN_PLUGIN_CLEAR_ERROR(ctx)
 

Typedefs

typedef struct _grn_plugin_mutex grn_plugin_mutex
 

Functions

GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_INIT (grn_ctx *ctx)
 
GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_REGISTER (grn_ctx *ctx)
 
GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_FIN (grn_ctx *ctx)
 
GRN_API void * grn_plugin_malloc (grn_ctx *ctx, size_t size, const char *file, int line, const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(2)
 
GRN_API void * grn_plugin_calloc (grn_ctx *ctx, size_t size, const char *file, int line, const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(2)
 
GRN_API void * grn_plugin_realloc (grn_ctx *ctx, void *ptr, size_t size, const char *file, int line, const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(3)
 
GRN_API void grn_plugin_free (grn_ctx *ctx, void *ptr, const char *file, int line, const char *func)
 
GRN_API void grn_plugin_set_error (grn_ctx *ctx, grn_log_level level, grn_rc error_code, const char *file, int line, const char *func, const char *format,...) GRN_ATTRIBUTE_PRINTF(7)
 
GRN_API void grn_plugin_clear_error (grn_ctx *ctx)
 
GRN_API void grn_plugin_backtrace (grn_ctx *ctx)
 
GRN_API void grn_plugin_logtrace (grn_ctx *ctx, grn_log_level level)
 
GRN_API grn_plugin_mutexgrn_plugin_mutex_open (grn_ctx *ctx)
 Create a new object of grn_plugin_mutex.
 
GRN_API grn_plugin_mutexgrn_plugin_mutex_create (grn_ctx *ctx)
 
GRN_API void grn_plugin_mutex_close (grn_ctx *ctx, grn_plugin_mutex *mutex)
 
GRN_API void grn_plugin_mutex_destroy (grn_ctx *ctx, grn_plugin_mutex *mutex)
 
GRN_API void grn_plugin_mutex_lock (grn_ctx *ctx, grn_plugin_mutex *mutex)
 
GRN_API void grn_plugin_mutex_unlock (grn_ctx *ctx, grn_plugin_mutex *mutex)
 
GRN_API grn_objgrn_plugin_proc_alloc (grn_ctx *ctx, grn_user_data *user_data, grn_id domain, unsigned char flags)
 
GRN_API grn_objgrn_plugin_proc_get_vars (grn_ctx *ctx, grn_user_data *user_data)
 
GRN_API grn_objgrn_plugin_proc_get_var (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size)
 
GRN_API bool grn_plugin_proc_get_var_bool (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, bool default_value)
 
GRN_API int32_t grn_plugin_proc_get_var_int32 (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, int32_t default_value)
 
GRN_API double grn_plugin_proc_get_var_double (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, double default_value)
 
GRN_API const char * grn_plugin_proc_get_var_string (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, size_t *size)
 
GRN_API grn_content_type grn_plugin_proc_get_var_content_type (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, grn_content_type default_value)
 
GRN_API grn_log_level grn_plugin_proc_get_var_log_level (grn_ctx *ctx, grn_user_data *user_data, const char *name, int name_size, grn_log_level default_value)
 Get the specified command argument value as grn_log_level.
 
GRN_API grn_objgrn_plugin_proc_get_var_by_offset (grn_ctx *ctx, grn_user_data *user_data, unsigned int offset)
 
GRN_API grn_objgrn_plugin_proc_get_caller (grn_ctx *ctx, grn_user_data *user_data)
 
GRN_API const char * grn_plugin_win32_base_dir (void)
 
GRN_API const char * grn_plugin_windows_base_dir (void)
 
GRN_API int grn_plugin_charlen (grn_ctx *ctx, const char *str_ptr, unsigned int str_length, grn_encoding encoding)
 
GRN_API int grn_plugin_isspace (grn_ctx *ctx, const char *str_ptr, unsigned int str_length, grn_encoding encoding)
 
GRN_API grn_rc grn_plugin_expr_var_init (grn_ctx *ctx, grn_expr_var *var, const char *name, int name_size)
 
GRN_API grn_objgrn_plugin_command_create (grn_ctx *ctx, const char *name, int name_size, grn_proc_func func, unsigned int n_vars, grn_expr_var *vars)
 
GRN_API bool grn_plugin_proc_get_value_bool (grn_ctx *ctx, grn_obj *value, bool default_value, const char *tag)
 
GRN_API int32_t grn_plugin_proc_get_value_int32 (grn_ctx *ctx, grn_obj *value, int32_t default_value_raw, const char *tag)
 
GRN_API int64_t grn_plugin_proc_get_value_int64 (grn_ctx *ctx, grn_obj *value, int64_t default_value_raw, const char *tag)
 
GRN_API double grn_plugin_proc_get_value_double (grn_ctx *ctx, grn_obj *value, double default_value_raw, const char *tag)
 
GRN_API grn_operator grn_plugin_proc_get_value_mode (grn_ctx *ctx, grn_obj *value, grn_operator default_mode, const char *tag)
 
GRN_API grn_operator grn_plugin_proc_get_value_operator (grn_ctx *ctx, grn_obj *value, grn_operator default_oeprator, const char *tag)
 

Macro Definition Documentation

◆ GRN_PLUGIN_CALLOC

#define GRN_PLUGIN_CALLOC (   ctx,
  size 
)     grn_plugin_calloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)

◆ GRN_PLUGIN_CLEAR_ERROR

#define GRN_PLUGIN_CLEAR_ERROR (   ctx)
Value:
do { \
grn_plugin_clear_error((ctx)); \
} while (0)

◆ GRN_PLUGIN_DECLARE_FUNCTIONS

#define GRN_PLUGIN_DECLARE_FUNCTIONS (   tag)
Value:
extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(init, tag)(grn_ctx * ctx); \
extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(register, tag)(grn_ctx * ctx); \
extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(fin, tag)(grn_ctx * ctx)
grn_rc
Definition groonga.h:61
#define GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)
Definition plugin.h:31
Definition groonga.h:351

◆ GRN_PLUGIN_ERROR

#define GRN_PLUGIN_ERROR (   ctx,
  error_code,
  ... 
)     GRN_PLUGIN_SET_ERROR(ctx, GRN_LOG_ERROR, error_code, __VA_ARGS__)

◆ GRN_PLUGIN_EXPORT

#define GRN_PLUGIN_EXPORT

◆ GRN_PLUGIN_FIN

#define GRN_PLUGIN_FIN   GRN_PLUGIN_IMPL_NAME(fin)

◆ GRN_PLUGIN_FREE

#define GRN_PLUGIN_FREE (   ctx,
  ptr 
)     grn_plugin_free((ctx), (ptr), __FILE__, __LINE__, __FUNCTION__)

◆ GRN_PLUGIN_IMPL_NAME

#define GRN_PLUGIN_IMPL_NAME (   type)    GRN_PLUGIN_IMPL_NAME_RAW(type)

◆ GRN_PLUGIN_IMPL_NAME_RAW

#define GRN_PLUGIN_IMPL_NAME_RAW (   type)    grn_plugin_impl_##type

◆ GRN_PLUGIN_IMPL_NAME_TAGGED

#define GRN_PLUGIN_IMPL_NAME_TAGGED (   type,
  tag 
)     GRN_PLUGIN_IMPL_NAME_RAW(type##_##tag)

◆ GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE

#define GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE (   type,
  tag 
)     GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)

◆ GRN_PLUGIN_INIT

#define GRN_PLUGIN_INIT   GRN_PLUGIN_IMPL_NAME(init)

◆ GRN_PLUGIN_LOG

#define GRN_PLUGIN_LOG (   ctx,
  level,
  ... 
)    GRN_LOG((ctx), (level), __VA_ARGS__)

◆ GRN_PLUGIN_MALLOC

#define GRN_PLUGIN_MALLOC (   ctx,
  size 
)     grn_plugin_malloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)

◆ GRN_PLUGIN_MALLOCN

#define GRN_PLUGIN_MALLOCN (   ctx,
  type,
 
)
Value:
((type *)(grn_plugin_malloc((ctx), \
sizeof(type) * (n), \
__FILE__, \
__LINE__, \
__FUNCTION__)))
GRN_API void * grn_plugin_malloc(grn_ctx *ctx, size_t size, const char *file, int line, const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(2)

◆ GRN_PLUGIN_REALLOC

#define GRN_PLUGIN_REALLOC (   ctx,
  ptr,
  size 
)     grn_plugin_realloc((ctx), (ptr), (size), __FILE__, __LINE__, __FUNCTION__)

◆ GRN_PLUGIN_REGISTER

#define GRN_PLUGIN_REGISTER   GRN_PLUGIN_IMPL_NAME(register)

◆ GRN_PLUGIN_SET_ERROR

#define GRN_PLUGIN_SET_ERROR (   ctx,
  level,
  error_code,
  ... 
)
Value:
do { \
grn_plugin_set_error(ctx, \
level, \
error_code, \
__FILE__, \
__LINE__, \
__FUNCTION__, \
__VA_ARGS__); \
} while (0)

Typedef Documentation

◆ grn_plugin_mutex

typedef struct _grn_plugin_mutex grn_plugin_mutex

Function Documentation

◆ grn_plugin_backtrace()

GRN_API void grn_plugin_backtrace ( grn_ctx ctx)

◆ grn_plugin_calloc()

GRN_API void * grn_plugin_calloc ( grn_ctx ctx,
size_t  size,
const char *  file,
int  line,
const char *  func 
)

◆ grn_plugin_charlen()

GRN_API int grn_plugin_charlen ( grn_ctx ctx,
const char *  str_ptr,
unsigned int  str_length,
grn_encoding  encoding 
)

◆ grn_plugin_clear_error()

GRN_API void grn_plugin_clear_error ( grn_ctx ctx)

◆ grn_plugin_command_create()

GRN_API grn_obj * grn_plugin_command_create ( grn_ctx ctx,
const char *  name,
int  name_size,
grn_proc_func  func,
unsigned int  n_vars,
grn_expr_var vars 
)

◆ grn_plugin_expr_var_init()

GRN_API grn_rc grn_plugin_expr_var_init ( grn_ctx ctx,
grn_expr_var var,
const char *  name,
int  name_size 
)

◆ GRN_PLUGIN_FIN()

GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_FIN ( grn_ctx ctx)

◆ grn_plugin_free()

GRN_API void grn_plugin_free ( grn_ctx ctx,
void *  ptr,
const char *  file,
int  line,
const char *  func 
)

◆ GRN_PLUGIN_INIT()

GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_INIT ( grn_ctx ctx)

◆ grn_plugin_isspace()

GRN_API int grn_plugin_isspace ( grn_ctx ctx,
const char *  str_ptr,
unsigned int  str_length,
grn_encoding  encoding 
)

◆ grn_plugin_logtrace()

GRN_API void grn_plugin_logtrace ( grn_ctx ctx,
grn_log_level  level 
)

◆ grn_plugin_malloc()

GRN_API void * grn_plugin_malloc ( grn_ctx ctx,
size_t  size,
const char *  file,
int  line,
const char *  func 
)

◆ grn_plugin_mutex_close()

GRN_API void grn_plugin_mutex_close ( grn_ctx ctx,
grn_plugin_mutex mutex 
)

◆ grn_plugin_mutex_create()

GRN_API grn_plugin_mutex * grn_plugin_mutex_create ( grn_ctx ctx)

◆ grn_plugin_mutex_destroy()

GRN_API void grn_plugin_mutex_destroy ( grn_ctx ctx,
grn_plugin_mutex mutex 
)

◆ grn_plugin_mutex_lock()

GRN_API void grn_plugin_mutex_lock ( grn_ctx ctx,
grn_plugin_mutex mutex 
)

◆ grn_plugin_mutex_open()

GRN_API grn_plugin_mutex * grn_plugin_mutex_open ( grn_ctx ctx)

Create a new object of grn_plugin_mutex.

Memory for the new object is obtained with GRN_PLUGIN_MALLOC.

Parameters
ctxThe context object.
Returns
A newly created grn_plugin_mutex object on success, NULL if sufficient memory is not available. The returned grn_plugin_mutex object must be freed by grn_plugin_mutex_close. See ctx->rc (grn_ctx::rc) for error details.

◆ grn_plugin_mutex_unlock()

GRN_API void grn_plugin_mutex_unlock ( grn_ctx ctx,
grn_plugin_mutex mutex 
)

◆ grn_plugin_proc_alloc()

GRN_API grn_obj * grn_plugin_proc_alloc ( grn_ctx ctx,
grn_user_data user_data,
grn_id  domain,
unsigned char  flags 
)

◆ grn_plugin_proc_get_caller()

GRN_API grn_obj * grn_plugin_proc_get_caller ( grn_ctx ctx,
grn_user_data user_data 
)

◆ grn_plugin_proc_get_value_bool()

GRN_API bool grn_plugin_proc_get_value_bool ( grn_ctx ctx,
grn_obj value,
bool  default_value,
const char *  tag 
)

◆ grn_plugin_proc_get_value_double()

GRN_API double grn_plugin_proc_get_value_double ( grn_ctx ctx,
grn_obj value,
double  default_value_raw,
const char *  tag 
)

◆ grn_plugin_proc_get_value_int32()

GRN_API int32_t grn_plugin_proc_get_value_int32 ( grn_ctx ctx,
grn_obj value,
int32_t  default_value_raw,
const char *  tag 
)

◆ grn_plugin_proc_get_value_int64()

GRN_API int64_t grn_plugin_proc_get_value_int64 ( grn_ctx ctx,
grn_obj value,
int64_t  default_value_raw,
const char *  tag 
)

◆ grn_plugin_proc_get_value_mode()

GRN_API grn_operator grn_plugin_proc_get_value_mode ( grn_ctx ctx,
grn_obj value,
grn_operator  default_mode,
const char *  tag 
)

◆ grn_plugin_proc_get_value_operator()

GRN_API grn_operator grn_plugin_proc_get_value_operator ( grn_ctx ctx,
grn_obj value,
grn_operator  default_oeprator,
const char *  tag 
)

◆ grn_plugin_proc_get_var()

GRN_API grn_obj * grn_plugin_proc_get_var ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size 
)

◆ grn_plugin_proc_get_var_bool()

GRN_API bool grn_plugin_proc_get_var_bool ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
bool  default_value 
)

◆ grn_plugin_proc_get_var_by_offset()

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

◆ grn_plugin_proc_get_var_content_type()

GRN_API grn_content_type grn_plugin_proc_get_var_content_type ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
grn_content_type  default_value 
)

◆ grn_plugin_proc_get_var_double()

GRN_API double grn_plugin_proc_get_var_double ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
double  default_value 
)

◆ grn_plugin_proc_get_var_int32()

GRN_API int32_t grn_plugin_proc_get_var_int32 ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
int32_t  default_value 
)

◆ grn_plugin_proc_get_var_log_level()

GRN_API grn_log_level grn_plugin_proc_get_var_log_level ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
grn_log_level  default_value 
)

Get the specified command argument value as grn_log_level.

Parameters
ctxThe context object.
user_dataThe data passed to the command.
nameThe argument name.
name_sizeThe size of name in bytes. If name is a NUL terminated string, you can use -1 to compute this automatically.
default_valueThe default value that is used when the named argument isn't specified.
Returns
If a user specified a log level, it's returned.
    If a user didn't specify a log level, `default_value` is
    returned.

    If a user specified an invalid log level, `default_value`
    is returned.
Since
14.1.3

◆ grn_plugin_proc_get_var_string()

GRN_API const char * grn_plugin_proc_get_var_string ( grn_ctx ctx,
grn_user_data user_data,
const char *  name,
int  name_size,
size_t *  size 
)

◆ grn_plugin_proc_get_vars()

GRN_API grn_obj * grn_plugin_proc_get_vars ( grn_ctx ctx,
grn_user_data user_data 
)

◆ grn_plugin_realloc()

GRN_API void * grn_plugin_realloc ( grn_ctx ctx,
void *  ptr,
size_t  size,
const char *  file,
int  line,
const char *  func 
)

◆ GRN_PLUGIN_REGISTER()

GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_REGISTER ( grn_ctx ctx)

◆ grn_plugin_set_error()

GRN_API void grn_plugin_set_error ( grn_ctx ctx,
grn_log_level  level,
grn_rc  error_code,
const char *  file,
int  line,
const char *  func,
const char *  format,
  ... 
)

◆ grn_plugin_win32_base_dir()

GRN_API const char * grn_plugin_win32_base_dir ( void  )

◆ grn_plugin_windows_base_dir()

GRN_API const char * grn_plugin_windows_base_dir ( void  )