|
navit 0.5.3-trunk
|
#include <stdio.h>#include <string.h>#include <stdarg.h>#include <stdlib.h>#include <glib.h>#include "item.h"#include "xmlconfig.h"#include "main.h"#include "navit.h"#include "vehicle.h"#include "speech.h"#include "gui.h"#include "debug.h"#include "callback.h"#include "command.h"#include "event.h"#include "navit_nls.h"Data Structures | |
| struct | result |
| struct | result_list |
| struct | context |
| struct | command_saved_cb |
| struct | command_saved |
Enumerations | |
| enum | error { no_error =0 , missing_double_quote , missing_opening_parenthesis , missing_closing_parenthesis , missing_closing_brace , missing_colon , missing_semicolon , wrong_type , illegal_number_format , illegal_character , missing_closing_bracket , invalid_type , not_ready , internal , eof_reached } |
| enum | op_type { op_type_binary , op_type_prefix , op_type_suffix } |
| enum | set_type { set_type_symbol , set_type_string , set_type_integer , set_type_float } |
Functions | |
| static void | eval_comma (struct context *ctx, struct result *res) |
| static struct attr ** | eval_list (struct context *ctx) |
| char * | command_error_to_text (int err) |
| Converts an error to human-readable text. | |
| static void | result_free (struct result *res) |
| static int | command_register_callbacks (struct command_saved *cs) |
| Registers callbacks for a saved command. | |
| static const char * | get_op (struct context *ctx, int test,...) |
| static int | is_double (struct result *res) |
| static void | dump (struct result *res) |
| static enum attr_type | command_attr_type (struct result *res) |
| static int | command_object_get_attr (struct context *ctx, struct attr *object, enum attr_type attr_type, struct attr *ret) |
| Retrieves an attribute from an object. | |
| static int | command_object_add_attr (struct context *ctx, struct attr *object, struct attr *attr) |
| static int | command_object_remove_attr (struct context *ctx, struct attr *object, struct attr *attr) |
| static void | command_get_attr (struct context *ctx, struct result *res) |
Retrieves the current value of an attribute and stores it in res. | |
| static void | command_set_attr (struct context *ctx, struct result *res, struct result *newres) |
| static void | resolve_object (struct context *ctx, struct result *res) |
| Resolves an object reference. | |
| static void | resolve (struct context *ctx, struct result *res) |
Resolves and retrieves an object and stores it in res. | |
| static double | get_double (struct context *ctx, struct result *res) |
| static int | get_int_bool (struct context *ctx, int is_bool, struct result *res) |
| Returns an integer or bool representation of the result of an expression. | |
| static int | get_int (struct context *ctx, struct result *res) |
| Returns an integer representation of the result of an expression. | |
| static int | get_bool (struct context *ctx, struct result *res) |
| Returns a boolean representation of the result of an expression. | |
| static char * | get_string (struct context *ctx, struct result *res) |
| static void | set_double (struct result *res, double val) |
| static void | set_int (struct result *res, int val) |
| static void | result_op (struct context *ctx, enum op_type op_type, const char *op, struct result *inout, struct result *in) |
| static void | result_set (struct context *ctx, enum set_type set_type, const char *op, int len, struct result *out) |
| static void | eval_value (struct context *ctx, struct result *res) |
| Evaluates a value and stores its result. | |
| static int | get_next_object (struct context *ctx, struct result *res) |
| Retrieves the next object reference from an expression. | |
| static void | eval_brace (struct context *ctx, struct result *res) |
| static void | command_call_function (struct context *ctx, struct result *res) |
| static void | eval_postfix (struct context *ctx, struct result *res) |
| static void | eval_unary (struct context *ctx, struct result *res) |
| static void | eval_multiplicative (struct context *ctx, struct result *res) |
| static void | eval_additive (struct context *ctx, struct result *res) |
| static void | eval_equality (struct context *ctx, struct result *res) |
| static void | eval_bitwise_and (struct context *ctx, struct result *res) |
| static void | eval_bitwise_xor (struct context *ctx, struct result *res) |
| static void | eval_bitwise_or (struct context *ctx, struct result *res) |
| static void | eval_logical_and (struct context *ctx, struct result *res) |
| static void | eval_logical_or (struct context *ctx, struct result *res) |
| static void | eval_conditional (struct context *ctx, struct result *res) |
| static void | eval_assignment (struct context *ctx, struct result *res) |
| static void | command_evaluate_to (struct attr *attr, const char *expr, struct context *ctx, struct result *res) |
| enum attr_type | command_evaluate_to_attr (struct attr *attr, char *expr, int *error, struct attr *ret) |
| void | command_evaluate_to_void (struct attr *attr, char *expr, int *error) |
| char * | command_evaluate_to_string (struct attr *attr, char *expr, int *error) |
| int | command_evaluate_to_int (struct attr *attr, char *expr, int *error) |
| int | command_evaluate_to_boolean (struct attr *attr, const char *expr, int *error) |
| int | command_evaluate_to_length (const char *expr, int *error) |
| static int | command_evaluate_single (struct context *ctx) |
| void | command_evaluate (struct attr *attr, const char *expr) |
| static void | command_table_call (struct command_table *table, int count, void *data, char *command, struct attr **in, struct attr ***out, int *valid) |
| void | command_add_table_attr (struct command_table *table, int count, void *data, struct attr *attr) |
| void | command_add_table (struct callback_list *cbl, struct command_table *table, int count, void *data) |
| void | command_saved_set_cb (struct command_saved *cs, struct callback *cb) |
| int | command_saved_get_int (struct command_saved *cs) |
| Returns an integer representation of the evaluation result of a saved command. | |
| int | command_saved_error (struct command_saved *cs) |
| static void | command_saved_evaluate_idle (struct command_saved *cs) |
| Idle function to evaluate a command. | |
| static void | command_saved_evaluate (struct command_saved *cs) |
| Evaluates a command. | |
| static void | command_saved_callbacks_changed (struct command_saved *cs) |
| Recreates all callbacks for a saved command. | |
| struct command_saved * | command_saved_attr_new (char *command, struct attr *attr, struct callback *cb, int async) |
| Creates a new saved command. | |
| struct command_saved * | command_saved_new (char *command, struct navit *navit, struct callback *cb, int async) |
| void | command_saved_destroy (struct command_saved *cs) |
| enum error |
| enum op_type |
| enum set_type |
| void command_add_table | ( | struct callback_list * | cbl, |
| struct command_table * | table, | ||
| int | count, | ||
| void * | data | ||
| ) |
References attr::callback, callback_list_add(), cbl, command_add_table_attr(), data, and attr::u.
Referenced by graphics_android_new(), gui_internal_command_init(), gui_qml_new(), navit_command_add_table(), navit_new(), and osd_rocket_init().
| void command_add_table_attr | ( | struct command_table * | table, |
| int | count, | ||
| void * | data, | ||
| struct attr * | attr | ||
| ) |
References attr::callback, callback_cast, callback_new_attr_3, command_table_call(), data, attr::type, and attr::u.
Referenced by command_add_table(), dbus_main_navit(), and win32_main_navit().
References attr_from_name(), result::attrn, and result::attrnlen.
Referenced by command_evaluate_single(), command_evaluate_to_attr(), command_get_attr(), command_set_attr(), and eval_postfix().
References result::allocated, result::attr, attr_dup_content(), attr_from_name(), ATTR_IS_INT, ATTR_IS_OBJECT, ATTR_IS_STRING, attr_list_free(), attr_to_name(), result::attrn, result::attrnlen, callback_list_call_attr_4, cbl, command_object_add_attr(), command_object_get_attr(), command_object_remove_attr(), object_func::create, attr::data, dbg, context::error, eval_list(), context::expr, get_op(), lvl_debug, lvl_error, missing_closing_parenthesis, navit_nls_gettext(), attr::num, object_func_lookup(), result_free(), context::skip, attr::str, attr::type, type, attr::u, result::var, and result::varlen.
Referenced by eval_postfix().
| char * command_error_to_text | ( | int | err | ) |
Converts an error to human-readable text.
| err | The error code |
g_free() when it is no longer needed. References eof_reached, err(), illegal_character, illegal_number_format, internal, invalid_type, missing_closing_brace, missing_closing_bracket, missing_closing_parenthesis, missing_colon, missing_double_quote, missing_opening_parenthesis, missing_semicolon, no_error, not_ready, and wrong_type.
Referenced by command_evaluate(), osd_std_config(), and osd_std_reconfigure().
| void command_evaluate | ( | struct attr * | attr, |
| const char * | expr | ||
| ) |
References context::attr, command_error_to_text(), command_evaluate_single(), dbg, eof_reached, err(), context::error, context::expr, and lvl_error.
Referenced by NGQProxyNavit::command(), gui_internal_button(), gui_internal_cmd2_set(), gui_internal_evaluate(), gui_internal_setup(), j1850_idle(), Java_org_navitproject_navit_NavitCallbackHandler_callbackMessageChannel(), main_real(), osd_cmd_interface_draw(), osd_evaluate_command(), and win32_wm_copydata().
|
static |
References result::attr, command_attr_type(), command_evaluate_single(), command_set_attr(), attr::data, dbg, context::error, eval_comma(), eval_conditional(), context::expr, object_func::get_attr, get_bool(), get_op(), attr_iter::iter, object_func::iter_destroy, object_func::iter_new, lvl_error, missing_closing_parenthesis, missing_opening_parenthesis, missing_semicolon, object_func_lookup(), resolve(), resolve_object(), result_free(), context::skip, attr::type, and attr::u.
Referenced by command_evaluate(), and command_evaluate_single().
|
static |
References context::attr, eval_comma(), context::expr, context::res, and result_free().
Referenced by command_evaluate_to_attr(), command_evaluate_to_boolean(), command_evaluate_to_int(), command_evaluate_to_length(), command_evaluate_to_string(), command_evaluate_to_void(), and command_saved_evaluate_idle().
| enum attr_type command_evaluate_to_attr | ( | struct attr * | attr, |
| char * | expr, | ||
| int * | error, | ||
| struct attr * | ret | ||
| ) |
References result::attr, attr_to_name(), command_attr_type(), command_evaluate_to(), dbg, context::error, context::expr, lvl_debug, context::res, and resolve_object().
Referenced by gui_internal_set_refresh_callback().
| int command_evaluate_to_boolean | ( | struct attr * | attr, |
| const char * | expr, | ||
| int * | error | ||
| ) |
References result::attr, command_evaluate_to(), attr::data, context::error, context::expr, get_int(), context::res, resolve(), result_free(), attr::type, and attr::u.
Referenced by eval_postfix(), and gui_internal_html_start().
| int command_evaluate_to_int | ( | struct attr * | attr, |
| char * | expr, | ||
| int * | error | ||
| ) |
References command_evaluate_to(), context::error, context::expr, get_int(), context::res, resolve(), and result_free().
| int command_evaluate_to_length | ( | const char * | expr, |
| int * | error | ||
| ) |
References command_evaluate_to(), attr::data, context::error, context::expr, context::res, result_free(), attr::type, and attr::u.
Referenced by eval_postfix().
| char * command_evaluate_to_string | ( | struct attr * | attr, |
| char * | expr, | ||
| int * | error | ||
| ) |
References command_evaluate_to(), context::error, context::expr, get_string(), context::res, resolve(), and result_free().
Referenced by request_navit_evaluate().
| void command_evaluate_to_void | ( | struct attr * | attr, |
| char * | expr, | ||
| int * | error | ||
| ) |
References command_evaluate_to(), context::error, context::expr, context::res, resolve(), and result_free().
Referenced by script_run().
Retrieves the current value of an attribute and stores it in res.
If ctx->skip is true, the function aborts and no action is taken.
Before calling this function, object references in res must be resolved. That is, res->attr holds a copy of ctx->attr and the first res->attrnlen characters of res->attrn correspond to the object name.
After this function completes, res->allocated is true, and res->attrn and res->attrnlen are reset.
If the attribute was successfully retrieved, the first res->varlen characters of res->var correspond to an object name and res->attr holds the attribute.
If the attribute could not be retrieved, res->attr.type is set to attr_none, and res->var and res->varlen are reset.
| ctx | The context |
| res | The result |
References result::allocated, result::attr, attr_to_name(), result::attrn, result::attrnlen, command_attr_type(), command_object_get_attr(), dbg, dump(), lvl_debug, lvl_warning, result_free(), context::skip, attr::type, result::var, and result::varlen.
Referenced by resolve().
|
static |
References object_func::add_attr, attr::data, object_func_lookup(), attr::type, and attr::u.
Referenced by command_call_function().
|
static |
Retrieves an attribute from an object.
This function will retrieve the first matching attribute by calling the get_attr method for the object type. If object does not refer to a valid object, or the get_attr method for the object type could not be defined, the function fails and zero is returned.
| ctx | The context (ignored) |
| object | The object for which the attribute is to be retrieved. |
| attr_type | The type of attribute to retrieve |
| ret | Points to a struct attr to which the attribute will be copied |
References attr_dup_content(), attr_to_name(), attr::data, dbg, object_func::dup, object_func::get_attr, lvl_warning, object_func_lookup(), attr::type, and attr::u.
Referenced by command_call_function(), and command_get_attr().
|
static |
References attr::data, object_func_lookup(), object_func::remove_attr, attr::type, and attr::u.
Referenced by command_call_function().
|
static |
Registers callbacks for a saved command.
This function registers callbacks for each attribute used in a saved command, causing the command to be re-evaluated whenever its value might change.
This function will fail if an object used in the expression could not be resolved. This may happen during startup if this function is called before all objects have been created. In this case, the caller should schedule the function to be called again at a later time.
It will also fail if an error is encountered. This can be determined by examining cs->ctx.error after the function returns.
| cs | The command |
References command_saved::async, result::attr, context::attr, command_saved_cb::attr, attr::callback, callback_cast, callback_new_attr_1, command_saved_cb::cb, command_saved::cbs, command_saved::command, command_saved_callbacks_changed(), command_saved_evaluate(), command_saved_evaluate_idle(), command_saved::context_attr, command_saved::ctx, attr::data, dbg, context::error, context::expr, callback::func, get_next_object(), lvl_debug, lvl_error, command_saved::num_cbs, object_func_lookup(), command_saved::res, resolve(), attr::type, attr::u, and result::var.
Referenced by command_saved_attr_new(), and command_saved_callbacks_changed().
| struct command_saved * command_saved_attr_new | ( | char * | command, |
| struct attr * | attr, | ||
| struct callback * | cb, | ||
| int | async | ||
| ) |
Creates a new saved command.
| command | The command string |
| attr | The context attribute for the saved command |
| cb | The callback to call whenver the command is re-evaluated |
| async | Whether the saved command should be flagged as asynchronous, causing it to be evaluated in an idle callback |
References command_saved::async, callback_cast, callback_new_1, command_saved::cb, command_saved::command, command_register_callbacks(), command_saved_callbacks_changed(), command_saved::context_attr, dbg, command_saved::error, event_add_idle(), lvl_debug, not_ready, command_saved::register_cb, and command_saved::register_ev.
Referenced by command_saved_new(), and script_set_attr_int().
|
static |
Recreates all callbacks for a saved command.
| cs | The saved command |
References command_saved::async, command_saved_cb::attr, attr::callback, callback_destroy(), command_saved_cb::cb, command_saved::cbs, command_saved::command, command_register_callbacks(), attr::data, dbg, event_remove_idle(), lvl_debug, lvl_error, command_saved::num_cbs, object_func_lookup(), command_saved::register_ev, object_func::remove_attr, attr::type, and attr::u.
Referenced by command_register_callbacks(), and command_saved_attr_new().
| void command_saved_destroy | ( | struct command_saved * | cs | ) |
References command_saved::command.
Referenced by script_destroy(), and script_set_attr_int().
| int command_saved_error | ( | struct command_saved * | cs | ) |
References command_saved::error.
Referenced by osd_std_config(), and osd_std_reconfigure().
|
static |
Evaluates a command.
This function examines cs->async to determine if the command should be evaluated immediately. If cs->async is true, an idle event is registered to register the command. Else the command is evaluated immediately and the result can be retrieved immediately after this function returns.
See command_saved_evaluate_idle(struct command_saved *) for details.
| cs | The command to evaluate |
References command_saved::async, callback_cast, callback_new_1, command_saved::command, command_saved_evaluate_idle(), dbg, event_add_idle(), command_saved::idle_cb, command_saved::idle_ev, and lvl_debug.
Referenced by command_register_callbacks().
|
static |
Idle function to evaluate a command.
This function is called from an idle loop for asynchronous evaluation but may also be called in-line.
The result of the evaluation can be retrieved from cs->res after this function returns. If an error occurred, it will be stored in cs->error.
| cs | The command to evaluate |
References callback_call_1, command_saved::cb, command_saved::command, command_evaluate_to(), command_saved::context_attr, command_saved::ctx, dbg, context::error, command_saved::error, event_remove_idle(), command_saved::idle_ev, lvl_debug, and command_saved::res.
Referenced by command_register_callbacks(), and command_saved_evaluate().
| int command_saved_get_int | ( | struct command_saved * | cs | ) |
Returns an integer representation of the evaluation result of a saved command.
This function is a wrapper around get_int(). It is equivalent to get_int(&cs->ctx, &cs->res). See get_int() for a description.
References command_saved::ctx, get_int(), and command_saved::res.
Referenced by osd_std_config(), and osd_std_reconfigure().
| struct command_saved * command_saved_new | ( | char * | command, |
| struct navit * | navit, | ||
| struct callback * | cb, | ||
| int | async | ||
| ) |
References ATTR_OBJECT, and command_saved_attr_new().
Referenced by osd_set_std_attr().
| void command_saved_set_cb | ( | struct command_saved * | cs, |
| struct callback * | cb | ||
| ) |
References command_saved::cb.
Referenced by osd_std_config().
|
static |
References result::allocated, result::attr, attr_new_from_text(), result::attrn, result::attrnlen, command_attr_type(), attr::data, object_func_lookup(), result_free(), object_func::set_attr, context::skip, attr::str, attr::type, and attr::u.
Referenced by command_evaluate_single(), and eval_assignment().
|
static |
References command_table::command, data, and command_table::func.
Referenced by command_add_table_attr().
|
static |
References result::attr, attr_to_name(), result::attrn, result::attrnlen, dbg, lvl_debug, attr::type, result::var, and result::varlen.
Referenced by command_get_attr(), eval_postfix(), and maptool_dump().
References context::error, eval_multiplicative(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_equality().
References command_set_attr(), context::error, eval_conditional(), get_op(), resolve(), resolve_object(), and result_free().
Referenced by eval_comma(), and eval_list().
References context::error, eval_equality(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_bitwise_xor().
References context::error, eval_bitwise_xor(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_logical_and().
References context::error, eval_bitwise_and(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_bitwise_or().
References context::error, eval_comma(), eval_value(), get_op(), and missing_closing_parenthesis.
Referenced by eval_postfix().
References context::error, eval_assignment(), get_op(), and result_free().
Referenced by command_evaluate_single(), command_evaluate_to(), and eval_brace().
References dbg, context::error, eval_logical_or(), get_bool(), get_op(), lvl_debug, missing_colon, result_free(), and context::skip.
Referenced by command_evaluate_single(), and eval_assignment().
References context::error, eval_additive(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_bitwise_and().
References result::attr, attr_generic_add_attr(), attr_list_free(), context::error, eval_assignment(), get_op(), resolve(), and result_free().
Referenced by command_call_function().
References context::error, eval_bitwise_or(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_logical_or().
References context::error, eval_logical_and(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_conditional().
References context::error, eval_unary(), get_op(), op_type_binary, result_free(), and result_op().
Referenced by eval_additive().
References result::attr, result::attrn, result::attrnlen, command_attr_type(), command_call_function(), command_evaluate_to_boolean(), command_evaluate_to_length(), attr::data, dbg, dump(), context::error, eval_brace(), context::expr, object_func::get_attr, get_op(), attr_iter::iter, object_func::iter_destroy, object_func::iter_new, lvl_debug, lvl_error, missing_closing_bracket, object_func_lookup(), resolve(), resolve_object(), result_free(), context::skip, attr::type, attr::u, result::var, and result::varlen.
Referenced by eval_unary().
References context::error, eval_postfix(), eval_unary(), get_op(), op_type_prefix, and result_op().
Referenced by eval_multiplicative(), and eval_unary().
Evaluates a value and stores its result.
This function evaluates the first value in ctx->expr. A value can be either an object name (such as vehicle.position_speed) or a literal value.
If evaluation is successful, the result is stored in res->attr.
If an object name is encountered, the result has an attribute type of attr_none and the first res->varlen characters of res->var will point to the object name.
If a literal value is encountered, the result's attribute type is set to the corresponding generic data type and its value is stored with the attribute.
After this function returns, ctx->expr contains the rest of the expression string, which was not evaluated. Leading spaces before the value will be discarded with the value.
If ctx->expr, after eliminating any leading whitespace, does not begin with a valid value, one of the following errors is stored in ctx->error:
illegal_number_format An illegal number format, such as a second decimal dot, was encountered. missing_double_quote A double quote without a matching second double quote was found. eof_reached The expression string is empty. illegal_character The expression string begins with a character which is illegal in a value. This may happen when the expression string begins with an operator. | ctx | The context to evaluate |
| res | Points to a struct res in which the result will be stored |
References result::attrn, result::attrnlen, dbg, eof_reached, context::error, context::expr, illegal_character, illegal_number_format, lvl_debug, missing_double_quote, result_free(), result_set(), set_type_float, set_type_integer, set_type_string, set_type_symbol, result::var, and result::varlen.
Referenced by eval_brace(), and get_next_object().
Returns a boolean representation of the result of an expression.
This function is a wrapper around get_int_bool(). It is equivalent to get_int_bool(ctx, 1, res). See get_int_bool() for a description.
References get_int_bool().
Referenced by command_evaluate_single(), eval_conditional(), and result_op().
References resolve(), and result::val.
Referenced by result_op().
Returns an integer representation of the result of an expression.
This function is a wrapper around get_int_bool(). It is equivalent to get_int_bool(ctx, 0, res). See get_int_bool() for a description.
References get_int_bool().
Referenced by command_evaluate_to_boolean(), command_evaluate_to_int(), command_saved_get_int(), and result_op().
Returns an integer or bool representation of the result of an expression.
This function evaluates the result of an expression (res->attr).
If res->attr is of a numeric type, its integer part is returned.
If is_bool is false and res->attr is not of a numeric type, 0 is returned.
If is_bool is true and res->attr is of an object or string type, true is returned for non-null, false otherwise.
For all other types of res->attr, 0 (false) is returned.
| ctx | The context for the expression |
| is_bool | If true, return boolean representation, else return integer representation. See description. |
| res | The result of the evaluation |
References result::attr, ATTR_IS_OBJECT, ATTR_IS_STRING, attr_to_name(), attr::data, dbg, context::error, lvl_debug, attr::num, attr::numd, resolve(), attr::type, attr::u, and wrong_type.
Referenced by get_bool(), and get_int().
Retrieves the next object reference from an expression.
This function scans the expression string ctx->expr for the next object reference. Anything other than an object reference (whitespace characters, literal values, operators and even illegal characters) is discarded until either the end of the string is reached or an object reference is encountered.
After this function completes successfully, res->attr.type is attr_none and the first res->varlen characters of res->var point to the object name.
Object names retrieved by this function are unqualified, i.e. vehicle.position_speed will be retrieved as vehicle on the first call (return value 2) and position_speed on the second call (return value 1).
| ctx | The context |
| res | Points to a struct result where the result will be stored. |
vehicle from vehicle.position_speed), the return value is 2. If no object references were found, the return value is 0. References result::attr, context::error, eval_value(), context::expr, attr::type, and result::varlen.
Referenced by command_register_callbacks().
|
static |
References context::expr.
Referenced by command_call_function(), command_evaluate_single(), eval_additive(), eval_assignment(), eval_bitwise_and(), eval_bitwise_or(), eval_bitwise_xor(), eval_brace(), eval_comma(), eval_conditional(), eval_equality(), eval_list(), eval_logical_and(), eval_logical_or(), eval_multiplicative(), eval_postfix(), and eval_unary().
References result::attr, attr_to_text(), and resolve().
Referenced by block_setup_tags(), command_evaluate_to_string(), result_op(), street_name_get(), street_name_number_get(), street_name_numbers_get(), town_get_data(), and town_search_compare().
|
static |
Referenced by result_op().
Resolves and retrieves an object and stores it in res.
Prior to calling this function, res must contain a valid, unresolved object reference: res->attr.type must be attr_none, and the first res->varlen characters of res->var must correspond to an object name.
If ctx->skip is true, the object reference will be resolved but the object will not be retrieved: the first res->attrnlen characters of res->attrn correspond to the object name after the function returns, while res->var and res->varlen are reset.
If ctx->skip is false, res->allocated is true after this function completes. The object is stored in res->attr if it was successfully retrieved, otherwise res->var and res->varlen are reset.
| ctx | The context |
| res | The result |
References result::attrn, command_get_attr(), and resolve_object().
Referenced by ch_process(), ch_process_node(), ch_process_nodes(), command_evaluate_single(), command_evaluate_to_boolean(), command_evaluate_to_int(), command_evaluate_to_string(), command_evaluate_to_void(), command_register_callbacks(), eval_assignment(), eval_list(), eval_postfix(), get_double(), get_int_bool(), get_string(), and result_op().
Resolves an object reference.
Prior to calling this function, res must contain a valid, unresolved object reference: res->attr.type must be attr_none, and the first res->varlen characters of res->var must correspond to an object name.
After the function returns, res->attr holds a copy of ctx->attr and the first res->attrnlen characters of res->attrn correspond to the object name. res->var and res->varlen are reset.
| ctx | The context |
| res | The result |
References result::attr, context::attr, result::attrn, result::attrnlen, attr::type, result::var, and result::varlen.
Referenced by command_evaluate_single(), command_evaluate_to_attr(), eval_assignment(), eval_postfix(), and resolve().
|
static |
References result::allocated, result::attr, attr_free_content(), attr::data, attr::type, and attr::u.
Referenced by command_call_function(), command_evaluate_single(), command_evaluate_to(), command_evaluate_to_boolean(), command_evaluate_to_int(), command_evaluate_to_length(), command_evaluate_to_string(), command_evaluate_to_void(), command_get_attr(), command_set_attr(), eval_additive(), eval_assignment(), eval_bitwise_and(), eval_bitwise_or(), eval_bitwise_xor(), eval_comma(), eval_conditional(), eval_equality(), eval_list(), eval_logical_and(), eval_logical_or(), eval_multiplicative(), eval_postfix(), eval_value(), result_op(), set_double(), and set_int().
|
static |
References result::allocated, result::attr, ATTR_IS_OBJECT, ATTR_IS_STRING, attr::data, dbg, context::error, get_bool(), get_double(), get_int(), get_string(), internal, is_double(), lvl_error, op_type_binary, op_type_prefix, resolve(), result_free(), s1, set_double(), set_int(), context::skip, attr::str, attr::type, and attr::u.
Referenced by eval_additive(), eval_bitwise_and(), eval_bitwise_or(), eval_bitwise_xor(), eval_equality(), eval_logical_and(), eval_logical_or(), eval_multiplicative(), and eval_unary().
|
static |
References result::allocated, result::attr, dbg, context::error, context::expr, internal, lvl_error, attr::num, attr::numd, set_type_float, set_type_integer, set_type_string, set_type_symbol, context::skip, attr::str, attr::type, attr::u, result::val, result::var, and result::varlen.
Referenced by eval_value().
|
static |
References result::attr, attr::numd, result_free(), attr::type, attr::u, and result::val.
Referenced by result_op().
|
static |
References result::attr, attr::num, result_free(), attr::type, and attr::u.
Referenced by result_op().