#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
BinaryOperator | find_operator_function_by_string (const size_t number_of_operator_functions, const OperatorFunction *const operator_functions, const char *const operator_string) |
|
int | perform_operation (int number_of_arguments, char *arguments[], const size_t number_of_operator_functions, const OperatorFunction *const operator_functions, int *const number_of_intermediate_values, int **const intermediate_values, int *const error_occurred) |
|
static int | add (int a, int b) |
|
static int | subtract (int a, int b) |
|
static int | multiply (int a, int b) |
|
static int | divide (int a, int b) |
|
int | main (int argc, char *argv[]) |
|
◆ BinaryOperator
typedef int(* BinaryOperator) (int a, int b) |
◆ OperatorFunction
◆ add()
static int add |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
◆ divide()
static int divide |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
◆ find_operator_function_by_string()
BinaryOperator find_operator_function_by_string |
( |
const size_t |
number_of_operator_functions, |
|
|
const OperatorFunction *const |
operator_functions, |
|
|
const char *const |
operator_string |
|
) |
| |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
◆ multiply()
static int multiply |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
◆ perform_operation()
int perform_operation |
( |
int |
number_of_arguments, |
|
|
char * |
arguments[], |
|
|
const size_t |
number_of_operator_functions, |
|
|
const OperatorFunction *const |
operator_functions, |
|
|
int *const |
number_of_intermediate_values, |
|
|
int **const |
intermediate_values, |
|
|
int *const |
error_occurred |
|
) |
| |
Definition at line 175 of file calculator.c.
References find_operator_function_by_string(), and free.
Referenced by main(), test_perform_operation(), test_perform_operation_first_arg_not_integer(), test_perform_operation_missing_argument(), test_perform_operation_no_arguments(), test_perform_operation_no_integer_after_operator(), test_perform_operation_null_args(), test_perform_operation_null_intermediate_values(), test_perform_operation_null_number_of_intermediate_values(), test_perform_operation_null_operator_functions(), and test_perform_operation_unknown_operator().
◆ subtract()
static int subtract |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
◆ operator_function_map
Initial value:= {
}
static int add(int a, int b)
static int divide(int a, int b)
static int subtract(int a, int b)
static int multiply(int a, int b)
Definition at line 115 of file calculator.c.