RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
query.c File Reference
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <compat/fnmatch.h>
#include <compat/strl.h>
#include "libretrodb.h"
#include "query.h"
#include "rmsgpack_dom.h"
Include dependency graph for query.c:

Classes

struct  buffer
 
struct  invocation
 
struct  argument
 
struct  query
 
struct  registered_func
 

Macros

#define MAX_ERROR_LEN   256
 
#define QUERY_MAX_ARGS   50
 

Typedefs

typedef struct rmsgpack_dom_value(* rarch_query_func) (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 

Enumerations

enum  argument_type { AT_FUNCTION, AT_VALUE }
 

Functions

static struct buffer query_parse_method_call (struct buffer buff, struct invocation *invocation, const char **error)
 
static struct buffer query_parse_table (struct buffer buff, struct invocation *invocation, const char **error)
 
static void query_raise_too_many_arguments (const char **error)
 
static struct rmsgpack_dom_value query_func_is_true (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static struct rmsgpack_dom_value func_equals (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static struct rmsgpack_dom_value query_func_operator_or (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static struct rmsgpack_dom_value query_func_operator_and (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static struct rmsgpack_dom_value query_func_between (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static struct rmsgpack_dom_value query_func_glob (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
static void query_raise_expected_number (ssize_t where, const char **error)
 
static void query_raise_expected_string (ssize_t where, const char **error)
 
static void query_raise_unexpected_eof (ssize_t where, const char **error)
 
static void query_raise_enomem (const char **error)
 
static void query_raise_unknown_function (ssize_t where, const char *name, ssize_t len, const char **error)
 
static void query_raise_expected_eof (ssize_t where, char found, const char **error)
 
static void query_raise_unexpected_char (ssize_t where, char expected, char found, const char **error)
 
static void query_argument_free (struct argument *arg)
 
static struct buffer query_parse_integer (struct buffer buff, struct rmsgpack_dom_value *value, const char **error)
 
static struct buffer query_chomp (struct buffer buff)
 
static struct buffer query_expect_eof (struct buffer buff, const char **error)
 
static int query_peek (struct buffer buff, const char *data)
 
static int query_is_eot (struct buffer buff)
 
static struct buffer query_get_char (struct buffer buff, char *c, const char **error)
 
static struct buffer query_parse_string (struct buffer buff, struct rmsgpack_dom_value *value, const char **error)
 
static struct buffer query_parse_value (struct buffer buff, struct rmsgpack_dom_value *value, const char **error)
 
static void query_peek_char (struct buffer buff, char *c, const char **error)
 
static struct buffer query_get_ident (struct buffer buff, const char **ident, size_t *len, const char **error)
 
static struct buffer query_expect_char (struct buffer buff, char c, const char **error)
 
static struct buffer query_parse_argument (struct buffer buff, struct argument *arg, const char **error)
 
static struct rmsgpack_dom_value query_func_all_map (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
 
void libretrodb_query_free (void *q)
 
voidlibretrodb_query_compile (libretrodb_t *db, const char *query, size_t buff_len, const char **error_string)
 
void libretrodb_query_inc_ref (libretrodb_query_t *q)
 
int libretrodb_query_filter (libretrodb_query_t *q, struct rmsgpack_dom_value *v)
 

Variables

static char tmp_error_buff [MAX_ERROR_LEN] = {0}
 
struct registered_func registered_functions [100]
 

Macro Definition Documentation

◆ MAX_ERROR_LEN

#define MAX_ERROR_LEN   256

◆ QUERY_MAX_ARGS

#define QUERY_MAX_ARGS   50

Typedef Documentation

◆ rarch_query_func

typedef struct rmsgpack_dom_value(* rarch_query_func) (struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)

Enumeration Type Documentation

◆ argument_type

Enumerator
AT_FUNCTION 
AT_VALUE 

Function Documentation

◆ func_equals()

static struct rmsgpack_dom_value func_equals ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_query_compile()

void* libretrodb_query_compile ( libretrodb_t db,
const char *  query,
size_t  buff_len,
const char **  error_string 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_query_filter()

int libretrodb_query_filter ( libretrodb_query_t q,
struct rmsgpack_dom_value v 
)
Here is the caller graph for this function:

◆ libretrodb_query_free()

void libretrodb_query_free ( void q)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_query_inc_ref()

void libretrodb_query_inc_ref ( libretrodb_query_t q)
Here is the caller graph for this function:

◆ query_argument_free()

static void query_argument_free ( struct argument arg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_chomp()

static struct buffer query_chomp ( struct buffer  buff)
static
Here is the caller graph for this function:

◆ query_expect_char()

static struct buffer query_expect_char ( struct buffer  buff,
char  c,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_expect_eof()

static struct buffer query_expect_eof ( struct buffer  buff,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_func_all_map()

static struct rmsgpack_dom_value query_func_all_map ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_func_between()

static struct rmsgpack_dom_value query_func_between ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:

◆ query_func_glob()

static struct rmsgpack_dom_value query_func_glob ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:

◆ query_func_is_true()

static struct rmsgpack_dom_value query_func_is_true ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the caller graph for this function:

◆ query_func_operator_and()

static struct rmsgpack_dom_value query_func_operator_and ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:

◆ query_func_operator_or()

static struct rmsgpack_dom_value query_func_operator_or ( struct rmsgpack_dom_value  input,
unsigned  argc,
const struct argument argv 
)
static
Here is the call graph for this function:

◆ query_get_char()

static struct buffer query_get_char ( struct buffer  buff,
char *  c,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_get_ident()

static struct buffer query_get_ident ( struct buffer  buff,
const char **  ident,
size_t *  len,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_is_eot()

static int query_is_eot ( struct buffer  buff)
static
Here is the caller graph for this function:

◆ query_parse_argument()

static struct buffer query_parse_argument ( struct buffer  buff,
struct argument arg,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_parse_integer()

static struct buffer query_parse_integer ( struct buffer  buff,
struct rmsgpack_dom_value value,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_parse_method_call()

static struct buffer query_parse_method_call ( struct buffer  buff,
struct invocation invocation,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_parse_string()

static struct buffer query_parse_string ( struct buffer  buff,
struct rmsgpack_dom_value value,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_parse_table()

static struct buffer query_parse_table ( struct buffer  buff,
struct invocation invocation,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_parse_value()

static struct buffer query_parse_value ( struct buffer  buff,
struct rmsgpack_dom_value value,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_peek()

static int query_peek ( struct buffer  buff,
const char *  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_peek_char()

static void query_peek_char ( struct buffer  buff,
char *  c,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_enomem()

static void query_raise_enomem ( const char **  error)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_expected_eof()

static void query_raise_expected_eof ( ssize_t  where,
char  found,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_expected_number()

static void query_raise_expected_number ( ssize_t  where,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_expected_string()

static void query_raise_expected_string ( ssize_t  where,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_too_many_arguments()

static void query_raise_too_many_arguments ( const char **  error)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_unexpected_char()

static void query_raise_unexpected_char ( ssize_t  where,
char  expected,
char  found,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_unexpected_eof()

static void query_raise_unexpected_eof ( ssize_t  where,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ query_raise_unknown_function()

static void query_raise_unknown_function ( ssize_t  where,
const char *  name,
ssize_t  len,
const char **  error 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ registered_functions

struct registered_func registered_functions[100]
Initial value:
= {
{"is_true", query_func_is_true},
{"between", query_func_between},
{"glob", query_func_glob},
}
static struct rmsgpack_dom_value query_func_operator_or(struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
Definition: query.c:156
static struct rmsgpack_dom_value query_func_operator_and(struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
Definition: query.c:186
static struct rmsgpack_dom_value query_func_between(struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
Definition: query.c:216
static struct rmsgpack_dom_value query_func_glob(struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
Definition: query.c:254
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static struct rmsgpack_dom_value query_func_is_true(struct rmsgpack_dom_value input, unsigned argc, const struct argument *argv)
Definition: query.c:109

◆ tmp_error_buff

char tmp_error_buff[MAX_ERROR_LEN] = {0}
static