Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
calculator.c File Reference
#include <glib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+ Include dependency graph for calculator.c:

Data Structures

union  token_data_t
 
struct  token_t
 
struct  parser_state_t
 

Typedefs

typedef enum token_types_t token_types_t
 
typedef enum operators_t operators_t
 
typedef union token_data_t token_data_t
 
typedef struct token_t token_t
 
typedef struct parser_state_t parser_state_t
 

Enumerations

enum  token_types_t {
  T_NUMBER ,
  T_OPERATOR
}
 
enum  operators_t {
  O_PLUS ,
  O_INC ,
  O_MINUS ,
  O_DEC ,
  O_MULTIPLY ,
  O_DIVISION ,
  O_MODULO ,
  O_POWER ,
  O_LEFTROUND ,
  O_RIGHTROUND
}
 

Functions

static float read_number (parser_state_t *self)
 
static token_tget_token (parser_state_t *self)
 
static float parse_expression (parser_state_t *self)
 
static float parse_additive_expression (parser_state_t *self)
 
static float parse_multiplicative_expression (parser_state_t *self)
 
static float parse_power_expression (parser_state_t *self)
 
static float parse_unary_expression (parser_state_t *self)
 
static float parse_primary_expression (parser_state_t *self)
 
float dt_calculator_solve (const float x, const char *formula)
 

Typedef Documentation

◆ operators_t

typedef enum operators_t operators_t

◆ parser_state_t

◆ token_data_t

typedef union token_data_t token_data_t

◆ token_t

typedef struct token_t token_t

◆ token_types_t

Enumeration Type Documentation

◆ operators_t

Enumerator
O_PLUS 
O_INC 
O_MINUS 
O_DEC 
O_MULTIPLY 
O_DIVISION 
O_MODULO 
O_POWER 
O_LEFTROUND 
O_RIGHTROUND 

◆ token_types_t

Enumerator
T_NUMBER 
T_OPERATOR 

Function Documentation

◆ dt_calculator_solve()

◆ get_token()

◆ parse_additive_expression()

◆ parse_expression()

static float parse_expression ( parser_state_t self)
static

◆ parse_multiplicative_expression()

◆ parse_power_expression()

◆ parse_primary_expression()

◆ parse_unary_expression()

◆ read_number()

static float read_number ( parser_state_t self)
static

the scanner

References parser_state_t::p.

Referenced by get_token().