Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
Classes | Defines | Enumerations | Functions
tuple_compiler.c File Reference
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "tuple_compiler.h"

Go to the source code of this file.

Classes

struct  TupleEvalNode
struct  TupleEvalVar
struct  TupleEvalContext

Defines

#define MAX_STR   (256)
#define MIN_ALLOC_NODES   (8)
#define MIN_ALLOC_BUF   (64)
#define TUPLEZ_MAX_VARS   (4)
#define tuple_error(ctx,...)   fprintf (stderr, "Tuple compiler: " __VA_ARGS__)

Enumerations

enum  {
  OP_RAW = 0, OP_FIELD, OP_EXISTS, OP_EQUALS,
  OP_NOT_EQUALS, OP_GT, OP_GTEQ, OP_LT,
  OP_LTEQ, OP_IS_EMPTY
}
enum  { TUPLE_VAR_FIELD = 0, TUPLE_VAR_CONST }

Functions

static void tuple_evalctx_free_var (TupleEvalVar *var)
TupleEvalContext * tuple_evalctx_new (void)
void tuple_evalctx_reset (TupleEvalContext *ctx)
void tuple_evalctx_free (TupleEvalContext *ctx)
static int tuple_evalctx_add_var (TupleEvalContext *ctx, const char *name, const int type, const TupleValueType ctype)
static void tuple_evalnode_insert (TupleEvalNode **nodes, TupleEvalNode *node)
static TupleEvalNode * tuple_evalnode_new (void)
void tuple_evalnode_free (TupleEvalNode *expr)
static TupleEvalNode * tuple_compiler_pass1 (int *level, TupleEvalContext *ctx, char **expression)
static bool_t tc_get_item (TupleEvalContext *ctx, char **str, char *buf, gssize max, char endch, bool_t *literal, char *errstr, char *item)
static int tc_get_variable (TupleEvalContext *ctx, char *name, int type)
static bool_t tc_parse_construct (TupleEvalContext *ctx, TupleEvalNode **res, char *item, char **c, int *level, int opcode)
TupleEvalNode * tuple_formatter_compile (TupleEvalContext *ctx, char *expr)
static bool_t tf_get_fieldval (TupleEvalVar *var, const Tuple *tuple)
static TupleValueType tf_get_var (char **tmps, int *tmpi, TupleEvalVar *var, const Tuple *tuple)
static bool_t tuple_formatter_eval_do (TupleEvalContext *ctx, TupleEvalNode *expr, const Tuple *tuple, GString *out)
void tuple_formatter_eval (TupleEvalContext *ctx, TupleEvalNode *expr, const Tuple *tuple, GString *out)

Define Documentation

#define MAX_STR   (256)
#define MIN_ALLOC_BUF   (64)

Definition at line 47 of file tuple_compiler.c.

#define MIN_ALLOC_NODES   (8)

Definition at line 46 of file tuple_compiler.c.

Referenced by tuple_evalctx_add_var().

#define tuple_error (   ctx,
  ... 
)    fprintf (stderr, "Tuple compiler: " __VA_ARGS__)
#define TUPLEZ_MAX_VARS   (4)

Definition at line 48 of file tuple_compiler.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
OP_RAW 
OP_FIELD 
OP_EXISTS 
OP_EQUALS 
OP_NOT_EQUALS 
OP_GT 
OP_GTEQ 
OP_LT 
OP_LTEQ 
OP_IS_EMPTY 

Definition at line 52 of file tuple_compiler.c.

anonymous enum
Enumerator:
TUPLE_VAR_FIELD 
TUPLE_VAR_CONST 

Definition at line 65 of file tuple_compiler.c.


Function Documentation

static bool_t tc_get_item ( TupleEvalContext *  ctx,
char **  str,
char *  buf,
gssize  max,
char  endch,
bool_t literal,
char *  errstr,
char *  item 
) [static]

Definition at line 228 of file tuple_compiler.c.

Referenced by tc_parse_construct(), and tuple_compiler_pass1().

static int tc_get_variable ( TupleEvalContext *  ctx,
char *  name,
int  type 
) [static]

Definition at line 287 of file tuple_compiler.c.

Referenced by tc_parse_construct(), and tuple_compiler_pass1().

static bool_t tc_parse_construct ( TupleEvalContext *  ctx,
TupleEvalNode **  res,
char *  item,
char **  c,
int level,
int  opcode 
) [static]

Definition at line 310 of file tuple_compiler.c.

Referenced by tuple_compiler_pass1().

static bool_t tf_get_fieldval ( TupleEvalVar var,
const Tuple *  tuple 
) [static]

Definition at line 558 of file tuple_compiler.c.

Referenced by tf_get_var(), and tuple_formatter_eval_do().

static TupleValueType tf_get_var ( char **  tmps,
int tmpi,
TupleEvalVar var,
const Tuple *  tuple 
) [static]

Definition at line 586 of file tuple_compiler.c.

Referenced by tuple_formatter_eval_do().

static TupleEvalNode * tuple_compiler_pass1 ( int level,
TupleEvalContext *  ctx,
char **  expression 
) [static]

Definition at line 348 of file tuple_compiler.c.

Referenced by tc_parse_construct(), and tuple_formatter_compile().

static int tuple_evalctx_add_var ( TupleEvalContext *  ctx,
const char *  name,
const int  type,
const TupleValueType  ctype 
) [static]

Definition at line 144 of file tuple_compiler.c.

Referenced by tc_get_variable().

void tuple_evalctx_free ( TupleEvalContext *  ctx)

Definition at line 128 of file tuple_compiler.c.

Referenced by tuple_formatter_process_string().

static void tuple_evalctx_free_var ( TupleEvalVar var) [static]

Definition at line 94 of file tuple_compiler.c.

Referenced by tuple_evalctx_free().

TupleEvalContext* tuple_evalctx_new ( void  )

Definition at line 104 of file tuple_compiler.c.

Referenced by tuple_formatter_process_string().

void tuple_evalctx_reset ( TupleEvalContext *  ctx)

Definition at line 112 of file tuple_compiler.c.

Referenced by tuple_formatter_process_string().

void tuple_evalnode_free ( TupleEvalNode *  expr)
static void tuple_evalnode_insert ( TupleEvalNode **  nodes,
TupleEvalNode *  node 
) [static]

Definition at line 185 of file tuple_compiler.c.

Referenced by tc_parse_construct(), and tuple_compiler_pass1().

static TupleEvalNode* tuple_evalnode_new ( void  ) [static]

Definition at line 200 of file tuple_compiler.c.

Referenced by tc_parse_construct(), and tuple_compiler_pass1().

TupleEvalNode* tuple_formatter_compile ( TupleEvalContext *  ctx,
char *  expr 
)

Definition at line 539 of file tuple_compiler.c.

Referenced by tuple_formatter_process_string().

void tuple_formatter_eval ( TupleEvalContext *  ctx,
TupleEvalNode *  expr,
const Tuple *  tuple,
GString *  out 
)

Definition at line 759 of file tuple_compiler.c.

Referenced by tuple_formatter_process_string().

static bool_t tuple_formatter_eval_do ( TupleEvalContext *  ctx,
TupleEvalNode *  expr,
const Tuple *  tuple,
GString *  out 
) [static]

Definition at line 621 of file tuple_compiler.c.

Referenced by tuple_formatter_eval().