Kestrel Interface
Loading...
Searching...
No Matches
kest_expression.c File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <math.h>
#include "kest_int.h"

Go to the source code of this file.

Macros

#define PRINTLINES_ALLOWED   0
#define KEST_EXPRESSION_CONST(x)

Functions

 IMPLEMENT_PTR_LIST (kest_expression)
 IMPLEMENT_LINKED_PTR_LIST (kest_named_expression)
char * kest_expression_type_to_str (int type)
int kest_expression_form (kest_expression *expr)
int kest_expression_arity (kest_expression *expr)
int kest_expression_refers_constant (kest_expression *expr)
int kest_expression_is_constant (kest_expression *expr)
int kest_expression_detect_constants_rec (kest_expression *expr, int depth)
int kest_expression_detect_constants (kest_expression *expr)
float kest_expression_evaluate (kest_expression *expr, kest_expr_scope *scope)
int kest_expression_references_param_rec (kest_expression *expr, kest_parameter *param, int depth)
int kest_expression_references_param (kest_expression *expr, kest_parameter *param)
kest_expression kest_expression_const (float v)
kest_expressionnew_m_expression_const (float v)
kest_expressionnew_m_expression_unary (int unary_type, kest_expression *rhs)
kest_expressionnew_m_expression_binary (int binary_type, kest_expression *arg_1, kest_expression *arg_2)
kest_expressionnew_m_expression_reference (char *ref_name)
kest_interval kest_interval_real_line ()
kest_interval kest_interval_ab (float a, float b)
kest_interval kest_interval_a_ (float a)
kest_interval kest_interval__b (float b)
kest_interval kest_interval_singleton (float v)
kest_interval kest_expression_compute_range_rec (kest_expression *expr, kest_expr_scope *scope, int depth)
kest_interval kest_expression_compute_range (kest_expression *expr, kest_expr_scope *scope)
const char * kest_expression_function_string (kest_expression *expr)
const char * kest_expression_infix_operator_string (kest_expression *expr)
int kest_expression_print_rec (kest_expression *expr, char *buf, int buf_len, int depth)
int kest_expression_print (kest_expression *expr)
const char * kest_expression_to_string (kest_expression *expr)

Variables

kest_expression kest_expression_standard_gain_min = KEST_EXPRESSION_CONST(KEST_STANDARD_GAIN_MIN)
kest_expression kest_expression_standard_gain_max = KEST_EXPRESSION_CONST(KEST_STANDARD_GAIN_MAX)
kest_expression kest_expression_zero = KEST_EXPRESSION_CONST(0)
kest_expression kest_expression_one = KEST_EXPRESSION_CONST(1)
kest_expression kest_expression_minus_one = KEST_EXPRESSION_CONST(-1)
kest_expression kest_expression_pi = KEST_EXPRESSION_CONST(M_PI)
kest_expression kest_expression_e = KEST_EXPRESSION_CONST(exp(1))
kest_expression kest_expression_sample_rate = KEST_EXPRESSION_CONST(KEST_FPGA_SAMPLE_RATE)
kest_expression kest_expression_int_max = KEST_EXPRESSION_CONST( pow(2, KEST_FPGA_DATA_WIDTH - 1) - 1)
kest_expression kest_expression_int_min = KEST_EXPRESSION_CONST(-pow(2, KEST_FPGA_DATA_WIDTH - 1))
kest_expression kest_expression_freq_max = KEST_EXPRESSION_CONST(KEST_FPGA_SAMPLE_RATE / 2 - 50)
char expr_print_buf [256]

Macro Definition Documentation

◆ KEST_EXPRESSION_CONST

#define KEST_EXPRESSION_CONST ( x)
Value:
{ \
.type = KEST_EXPR_CONST, \
.val = {.val_float = x}, \
.constant = 1, \
.cached = 1, \
.cached_val = x \
};
#define KEST_EXPR_CONST

Definition at line 20 of file kest_expression.c.

◆ PRINTLINES_ALLOWED

#define PRINTLINES_ALLOWED   0

Definition at line 10 of file kest_expression.c.

Function Documentation

◆ IMPLEMENT_LINKED_PTR_LIST()

IMPLEMENT_LINKED_PTR_LIST ( kest_named_expression )

◆ IMPLEMENT_PTR_LIST()

IMPLEMENT_PTR_LIST ( kest_expression )

◆ kest_expression_arity()

int kest_expression_arity ( kest_expression * expr)

Definition at line 110 of file kest_expression.c.

Referenced by kest_expression_compute_range_rec(), kest_expression_detect_constants_rec(), and kest_expression_references_param_rec().

Here is the caller graph for this function:

◆ kest_expression_compute_range()

kest_interval kest_expression_compute_range ( kest_expression * expr,
kest_expr_scope * scope )

Definition at line 1206 of file kest_expression.c.

Referenced by kest_expression_compute_format().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_compute_range_rec()

kest_interval kest_expression_compute_range_rec ( kest_expression * expr,
kest_expr_scope * scope,
int depth )

Definition at line 637 of file kest_expression.c.

Referenced by kest_expression_compute_range(), and kest_expression_compute_range_rec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_const()

kest_expression kest_expression_const ( float v)

Definition at line 502 of file kest_expression.c.

Referenced by new_m_expression_const().

Here is the caller graph for this function:

◆ kest_expression_detect_constants()

int kest_expression_detect_constants ( kest_expression * expr)

Definition at line 221 of file kest_expression.c.

Referenced by kest_parse_expression().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_detect_constants_rec()

int kest_expression_detect_constants_rec ( kest_expression * expr,
int depth )

Definition at line 165 of file kest_expression.c.

Referenced by kest_expression_detect_constants(), and kest_expression_detect_constants_rec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_evaluate()

float kest_expression_evaluate ( kest_expression * expr,
kest_expr_scope * scope )

◆ kest_expression_form()

int kest_expression_form ( kest_expression * expr)

Definition at line 71 of file kest_expression.c.

Referenced by kest_expression_print_rec().

Here is the caller graph for this function:

◆ kest_expression_function_string()

const char * kest_expression_function_string ( kest_expression * expr)

Definition at line 1211 of file kest_expression.c.

Referenced by kest_expression_print_rec().

Here is the caller graph for this function:

◆ kest_expression_infix_operator_string()

const char * kest_expression_infix_operator_string ( kest_expression * expr)

Definition at line 1236 of file kest_expression.c.

Referenced by kest_expression_print_rec().

Here is the caller graph for this function:

◆ kest_expression_is_constant()

int kest_expression_is_constant ( kest_expression * expr)

Definition at line 157 of file kest_expression.c.

Referenced by kest_extract_int_setting_from_dict(), kest_extract_parameter_from_dict(), and kest_extract_setting_from_dict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_print()

int kest_expression_print ( kest_expression * expr)

Definition at line 1372 of file kest_expression.c.

Here is the call graph for this function:

◆ kest_expression_print_rec()

int kest_expression_print_rec ( kest_expression * expr,
char * buf,
int buf_len,
int depth )

Definition at line 1254 of file kest_expression.c.

Referenced by kest_expression_print(), kest_expression_print_rec(), and kest_expression_to_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_references_param()

int kest_expression_references_param ( kest_expression * expr,
kest_parameter * param )

Definition at line 497 of file kest_expression.c.

Here is the call graph for this function:

◆ kest_expression_references_param_rec()

int kest_expression_references_param_rec ( kest_expression * expr,
kest_parameter * param,
int depth )

Definition at line 464 of file kest_expression.c.

Referenced by kest_expression_references_param(), and kest_expression_references_param_rec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_refers_constant()

int kest_expression_refers_constant ( kest_expression * expr)

Definition at line 133 of file kest_expression.c.

Referenced by kest_expression_compute_range_rec(), kest_expression_detect_constants_rec(), and kest_expression_is_constant().

Here is the caller graph for this function:

◆ kest_expression_to_string()

const char * kest_expression_to_string ( kest_expression * expr)

Definition at line 1385 of file kest_expression.c.

Referenced by kest_dict_entry_to_string(), kest_expression_compute_format(), kest_expression_compute_range_rec(), kest_extract_biquad_from_dict(), kest_extract_filter_from_dict(), kest_extract_parameter_from_dict(), and kest_parse_asm_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_expression_type_to_str()

char * kest_expression_type_to_str ( int type)

Definition at line 40 of file kest_expression.c.

Referenced by kest_extract_parameter_from_dict().

Here is the caller graph for this function:

◆ kest_interval__b()

kest_interval kest_interval__b ( float b)

Definition at line 621 of file kest_expression.c.

◆ kest_interval_a_()

kest_interval kest_interval_a_ ( float a)

Definition at line 613 of file kest_expression.c.

◆ kest_interval_ab()

kest_interval kest_interval_ab ( float a,
float b )

Definition at line 605 of file kest_expression.c.

Referenced by kest_expression_compute_range_rec().

Here is the caller graph for this function:

◆ kest_interval_real_line()

kest_interval kest_interval_real_line ( )

Definition at line 597 of file kest_expression.c.

Referenced by kest_expression_compute_range_rec().

Here is the caller graph for this function:

◆ kest_interval_singleton()

kest_interval kest_interval_singleton ( float v)

Definition at line 629 of file kest_expression.c.

Referenced by kest_expression_compute_range_rec().

Here is the caller graph for this function:

◆ new_m_expression_binary()

kest_expression * new_m_expression_binary ( int binary_type,
kest_expression * arg_1,
kest_expression * arg_2 )

Definition at line 548 of file kest_expression.c.

Referenced by kest_parse_expression_rec_pratt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_m_expression_const()

kest_expression * new_m_expression_const ( float v)

Definition at line 513 of file kest_expression.c.

Referenced by kest_parse_asm_arg_2(), and kest_parse_expression_rec_pratt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_m_expression_reference()

kest_expression * new_m_expression_reference ( char * ref_name)

Definition at line 574 of file kest_expression.c.

Referenced by kest_parse_asm_arg_2(), and kest_parse_expression_rec_pratt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_m_expression_unary()

kest_expression * new_m_expression_unary ( int unary_type,
kest_expression * rhs )

Definition at line 524 of file kest_expression.c.

Referenced by kest_parse_expression_rec_pratt().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ expr_print_buf

char expr_print_buf[256]

Definition at line 1370 of file kest_expression.c.

Referenced by kest_expression_to_string().

◆ kest_expression_e

kest_expression kest_expression_e = KEST_EXPRESSION_CONST(exp(1))

Definition at line 34 of file kest_expression.c.

◆ kest_expression_freq_max

kest_expression kest_expression_freq_max = KEST_EXPRESSION_CONST(KEST_FPGA_SAMPLE_RATE / 2 - 50)

Definition at line 38 of file kest_expression.c.

Referenced by init_effect().

◆ kest_expression_int_max

kest_expression kest_expression_int_max = KEST_EXPRESSION_CONST( pow(2, KEST_FPGA_DATA_WIDTH - 1) - 1)

Definition at line 36 of file kest_expression.c.

◆ kest_expression_int_min

kest_expression kest_expression_int_min = KEST_EXPRESSION_CONST(-pow(2, KEST_FPGA_DATA_WIDTH - 1))

Definition at line 37 of file kest_expression.c.

◆ kest_expression_minus_one

kest_expression kest_expression_minus_one = KEST_EXPRESSION_CONST(-1)

Definition at line 32 of file kest_expression.c.

◆ kest_expression_one

kest_expression kest_expression_one = KEST_EXPRESSION_CONST(1)

Definition at line 31 of file kest_expression.c.

Referenced by init_effect().

◆ kest_expression_pi

kest_expression kest_expression_pi = KEST_EXPRESSION_CONST(M_PI)

Definition at line 33 of file kest_expression.c.

◆ kest_expression_sample_rate

Definition at line 35 of file kest_expression.c.

◆ kest_expression_standard_gain_max

kest_expression kest_expression_standard_gain_max = KEST_EXPRESSION_CONST(KEST_STANDARD_GAIN_MAX)

Definition at line 29 of file kest_expression.c.

Referenced by kest_init_context().

◆ kest_expression_standard_gain_min

kest_expression kest_expression_standard_gain_min = KEST_EXPRESSION_CONST(KEST_STANDARD_GAIN_MIN)

Definition at line 28 of file kest_expression.c.

Referenced by kest_init_context().

◆ kest_expression_zero

kest_expression kest_expression_zero = KEST_EXPRESSION_CONST(0)

Definition at line 30 of file kest_expression.c.

Referenced by init_effect().