3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.1 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef __DEF_CALC_EXPRESSION_H_
20 #define __DEF_CALC_EXPRESSION_H_
25 #endif /* __cplusplus */
27 #include "calculator_parser.h"
29 #define IS_SIGN(ch) ((ch) == '+' || (ch) == '-')
30 #define IS_SCIENCE_E(ch) ((ch) == 'E' || (ch) == 'e')
31 #define IS_OPERATOER(ch) ((ch) == '+' || (ch) == '-' || (ch) == 'x' || (ch) == '/' || (ch) == '^')
32 #define IS_DIGITAL(ch) (isdigit((ch)) || (ch) == 'p' || (ch) == 'e')
35 #define FLOAT_EQUAL(a, b) (fabs((a) - (b)) < 0.000000000001)
50 void calc_expr_format_expression(const char *expr_in, char *expr_out);
60 int calc_expr_get_operator_num(const char *expr);
70 int calc_expr_get_left_parentheses_num(const char *expr);
80 void calc_expr_replace_with_special_char(char *expr);
90 void calc_expr_replace_from_special_char(char *expr);
101 void calc_expr_num_format_result(double result, char *text);
112 char *calc_expr_get_current_func_at_cursor(char *expr, int cursor);
125 int calc_expr_get_current_num_at_cursor(char *expr, int cursor,
126 int *begin, int *length);
136 void calc_expr_close_parentheses(char *exp);
146 void calc_expr_preprocess(char *exp);
157 void calc_expr_input_backspace(char *exp, int *cursor);
169 void calc_expr_input_insert(char *exp, int *cursor, char *str);
171 bool calc_select_string_search(char *str);
176 #endif /* __cplusplus */
178 #endif /* __DEF_CALC_EXPRESSION_H_ */