#include <config.h>#include "el.h"#include <stdlib.h>Include dependency graph for parse.c:

Go to the source code of this file.
Functions | |
| protected int | parse_line (EditLine *el, const char *line) |
| public int | el_parse (EditLine *el, int argc, const char *argv[]) |
| protected int | parse__escape (const char **const ptr) |
| protected char * | parse__string (char *out, const char *in) |
| protected int | parse_cmd (EditLine *el, const char *cmd) |
Variables | |
| struct { | |
| const char * name | |
| int(* func )(EditLine *, int, const char **) | |
| } | cmds [] |
| public int el_parse | ( | EditLine * | el, | |
| int | argc, | |||
| const char * | argv[] | |||
| ) |
Definition at line 90 of file parse.c.
References cmds, el, el_free, el_malloc, el_match(), editline::el_prog, func, name, NULL, strchr(), and strcmp().
00091 { 00092 const char *ptr; 00093 int i; 00094 00095 if (argc < 1) 00096 return (-1); 00097 ptr = strchr(argv[0], ':'); 00098 if (ptr != NULL) { 00099 char *tprog; 00100 size_t l; 00101 00102 if (ptr == argv[0]) 00103 return (0); 00104 l = ptr - argv[0] - 1; 00105 tprog = (char *) el_malloc(l + 1); 00106 if (tprog == NULL) 00107 return (0); 00108 (void) strncpy(tprog, argv[0], l); 00109 tprog[l] = '\0'; 00110 ptr++; 00111 l = el_match(el->el_prog, tprog); 00112 el_free(tprog); 00113 if (!l) 00114 return (0); 00115 } else 00116 ptr = argv[0]; 00117 00118 for (i = 0; cmds[i].name != NULL; i++) 00119 if (strcmp(cmds[i].name, ptr) == 0) { 00120 i = (*cmds[i].func) (el, argc, argv); 00121 return (-i); 00122 } 00123 return (-1); 00124 }
Here is the call graph for this function:

| protected int parse__escape | ( | const char **const | ptr | ) |
Definition at line 132 of file parse.c.
References p.
Referenced by parse__string().
00133 { 00134 const char *p; 00135 int c; 00136 00137 p = *ptr; 00138 00139 if (p[1] == 0) 00140 return (-1); 00141 00142 if (*p == '\\') { 00143 p++; 00144 switch (*p) { 00145 case 'a': 00146 c = '\007'; /* Bell */ 00147 break; 00148 case 'b': 00149 c = '\010'; /* Backspace */ 00150 break; 00151 case 't': 00152 c = '\011'; /* Horizontal Tab */ 00153 break; 00154 case 'n': 00155 c = '\012'; /* New Line */ 00156 break; 00157 case 'v': 00158 c = '\013'; /* Vertical Tab */ 00159 break; 00160 case 'f': 00161 c = '\014'; /* Form Feed */ 00162 break; 00163 case 'r': 00164 c = '\015'; /* Carriage Return */ 00165 break; 00166 case 'e': 00167 c = '\033'; /* Escape */ 00168 break; 00169 case '0': 00170 case '1': 00171 case '2': 00172 case '3': 00173 case '4': 00174 case '5': 00175 case '6': 00176 case '7': 00177 { 00178 int cnt, ch; 00179 00180 for (cnt = 0, c = 0; cnt < 3; cnt++) { 00181 ch = *p++; 00182 if (ch < '0' || ch > '7') { 00183 p--; 00184 break; 00185 } 00186 c = (c << 3) | (ch - '0'); 00187 } 00188 if ((c & 0xffffff00) != 0) 00189 return (-1); 00190 --p; 00191 break; 00192 } 00193 default: 00194 c = *p; 00195 break; 00196 } 00197 } else if (*p == '^') { 00198 p++; 00199 c = (*p == '?') ? '\177' : (*p & 0237); 00200 } else 00201 c = *p; 00202 *ptr = ++p; 00203 return (c); 00204 }
Here is the caller graph for this function:

| protected char* parse__string | ( | char * | out, | |
| const char * | in | |||
| ) |
Definition at line 210 of file parse.c.
References n, NULL, and parse__escape().
Referenced by map_bind().
00211 { 00212 char *rv = out; 00213 int n; 00214 00215 for (;;) 00216 switch (*in) { 00217 case '\0': 00218 *out = '\0'; 00219 return (rv); 00220 00221 case '\\': 00222 case '^': 00223 if ((n = parse__escape(&in)) == -1) 00224 return (NULL); 00225 *out++ = n; 00226 break; 00227 00228 case 'M': 00229 if (in[1] == '-' && in[2] != '\0') { 00230 *out++ = '\033'; 00231 in += 2; 00232 break; 00233 } 00234 /*FALLTHROUGH*/ 00235 00236 default: 00237 *out++ = *in++; 00238 break; 00239 } 00240 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int parse_cmd | ( | EditLine * | el, | |
| const char * | cmd | |||
| ) |
Definition at line 248 of file parse.c.
References el, editline::el_map, el_bindings_t::func, el_map_t::help, el_bindings_t::name, NULL, and strcmp().
Referenced by map_bind().
00249 { 00250 el_bindings_t *b; 00251 00252 for (b = el->el_map.help; b->name != NULL; b++) 00253 if (strcmp(b->name, cmd) == 0) 00254 return (b->func); 00255 return (-1); 00256 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected int parse_line | ( | EditLine * | el, | |
| const char * | line | |||
| ) |
Definition at line 72 of file parse.c.
References el, el_parse(), NULL, tok_end(), tok_init(), and tok_str().
Referenced by ed_command(), and el_source().
00073 { 00074 const char **argv; 00075 int argc; 00076 Tokenizer *tok; 00077 00078 tok = tok_init(NULL); 00079 tok_str(tok, line, &argc, &argv); 00080 argc = el_parse(el, argc, argv); 00081 tok_end(tok); 00082 return (argc); 00083 }
Here is the call graph for this function:

Here is the caller graph for this function:

| private { ... } cmds[] |
Referenced by el_parse().
Referenced by _rl_dispatch_subseq(), udf_handler::add(), Item_equal::add(), add_ft_keys(), allow_break(), change_cond_ref_to_const(), udf_handler::clear(), JOIN::clear(), com_help(), const_expression_in_where(), copy_funcs(), deflateParams(), el_get(), el_parse(), el_set(), eval_aggregate(), eval_arith(), eval_cmp(), eval_func(), eval_logical(), eval_predefined(), eval_predefined_2(), execute_commands(), find_command(), get_func_mm_tree(), get_mm_tree(), init_tmptable_sum_functions(), main(), JOIN::make_sum_func_list(), my_xpath_parse_FunctionCall(), pars_resolve_func_data_type(), prioTransporterTest(), propagate_cond_constants(), JOIN::reinit(), remove_eq_conds(), rl_bind_key(), rl_bind_keyseq_if_unbound_in_map(), rl_unbind_command_in_map(), JOIN::rollup_make_fields(), Item_in_subselect::select_in_like_transformer(), setup_sum_funcs(), Item_in_subselect::single_value_transformer(), sym_tab_free_private(), update_sum_func(), update_tmptable_sum_func(), udf_handler::val(), and udf_handler::val_int().
| const char* name |
Definition at line 54 of file parse.c.
Referenced by MgmtSrvr::alloc_node_id(), ha_myisammrg::append_create_info(), append_table_headings(), applyDefaultValues(), backward(), check_reserved_words(), checkMandatory(), close_connection(), com_help(), Dbdict::create_fg_prepare_start(), Dbdict::create_file_prepare_complete(), Dbdict::create_file_prepare_start(), create_string(), Table_triggers_list::create_trigger(), AsyncFile::createDirectories(), Dbdict::createIndex_toCreateTable(), Dbdict::createTrigger_slaveCreate(), db_drop_routine(), db_find_event(), db_find_routine(), db_find_routine_aux(), db_load_routine(), db_update_routine(), debug_write_type(), decode_symbol(), define(), dict_check_tablespaces_and_store_max_id(), dict_load_columns(), dict_load_fields(), dict_load_indexes(), do_source(), Table_triggers_list::drop_trigger(), NdbDictionaryImpl::dropTable(), NdbDictionaryImpl::dropTableGlobal(), el_get(), el_parse(), el_set(), event_timed_name_equal(), examine_log(), Dbdict::execDUMP_STATE_ORD(), Dbdict::execLIST_TABLES_REQ(), Dblqh::execSTTOR(), Instance_options::fill_log_options(), Instance_map::find(), sp_pcontext::find_cond(), sp_pcontext::find_cursor(), find_field_in_tables(), sp_pcontext::find_variable(), fixDepricated(), get_actual_table_name(), get_all_items_for_category(), get_file_name(), get_key_map_from_key_list(), MgmApiSession::get_nodeid(), get_system_var(), get_topics_for_keyword(), get_var_with_binlog(), get_variable(), ConfigInfo::getAlias(), GrepError::getErrorDesc(), Dbdict::getIndexAttr(), PropertiesImpl::getPackedSize(), NdbDictInterface::getTable(), gzdopen(), ha_create_table(), ha_resolve_by_name(), ha_show_status(), hack_special_boolean_var(), handle_parser_directive(), Dbdict::handleTabInfo(), Dbdict::handleTabInfoInit(), ieee_builtin_type(), ieee_read_cxx_class(), ieee_read_cxx_misc(), ieee_read_reference(), ClusterConfiguration::init(), init_server_components(), initBlockNames(), initSignalNames(), Instance_name::Instance_name(), ip_to_hostname(), Instance::is_mysqld_compatible_name(), Instance::is_name_valid(), lex_init(), main(), make_unique_view_field_name(), LocalConfig::makeConnectString(), memorize_variant_topic(), mi_check_print_msg(), my_close(), my_dup(), my_fclose(), my_filename(), my_fopen(), my_register_filename(), my_tz_find(), my_tz_find_with_opening_tz_tables(), mysql_drop_view(), mysql_execute_command(), mysql_ha_open(), mysql_install_plugin(), mysql_load(), mysql_sql_stmt_close(), mysql_sql_stmt_execute(), mysql_sql_stmt_prepare(), mysql_uninstall_plugin(), mysqld_help(), NDB_COMMAND(), ndb_mgm_call(), ndb_mgm_get_event_category_string(), ndb_mgm_get_event_severity_string(), ndb_mgm_match_event_category(), open_binary_frm(), open_or_create_data_files(), open_or_create_log_file(), PropertiesImpl::pack(), Dbdict::packTableIntoPages(), parse_ieee_atn(), parse_ieee_bb(), parse_ieee_nn(), parse_ieee_ty(), InitConfigFileParser::parse_mycnf(), parse_stab_cpp_abbrev(), parse_stab_enum_type(), parse_stab_members(), parse_stab_one_struct_field(), parse_stab_string(), plugin_add(), plugin_del(), plugin_find_internal(), plugin_is_ready(), plugin_load(), plugin_lock(), Prepared_statement::prepare(), print_index(), print_table_data_xml(), Config::printConfigFile(), Dbdict::printTables(), proc_analyse_init(), pstack_install_segv_action(), sp_pcontext::push_cond(), sp_pcontext::push_cursor(), sp_pcontext::push_variable(), read_texts(), Dbdict::release_object(), Dbdict::releaseTableObject(), rename_tables(), reopen_closed_file(), resolve_const_item(), rl_function_dumper(), rl_get_keymap_name(), rl_initialize_funmap(), rl_named_function(), rl_variable_dumper(), row_create_index_for_mysql(), search_topics(), select_connection(), Prepared_statement::set_name(), yaSSL::SSL_CTX::SetCipherList(), BackupFile::setCtlFile(), BackupFile::setDataFile(), BackupFile::setLogFile(), show_var_cmp(), sp_cache_lookup(), sp_cache_routines_and_add_tables_aux(), sp_drop_function(), sp_drop_procedure(), sp_exist_routines(), sp_find_routine(), sp_routine_exists_in_table(), sp_show_create_function(), sp_show_create_procedure(), sp_update_function(), sp_update_procedure(), split_file_name(), yaSSL::SSL_CTX_load_verify_locations(), stab_demangle_function_name(), stab_demangle_fund_type(), stab_demangle_qualified(), stab_demangle_type(), stab_find_tagged_type(), stab_xcoff_builtin_type(), str_list_find(), BackupRestore::table(), test_multi_stmt(), test_ts(), transformSystem(), tty_stty(), ha_myisammrg::update_create_info(), Instance_options::update_var(), ConfigRetriever::verifyConfig(), Show_instance_log_files::write_data(), Show_instance_log_files::write_header(), Show_instance_log::write_header(), Show_instance_options::write_header(), Show_instance_status::write_header(), Show_instances::write_header(), yaSSL::X509_NAME_get_entry(), yaSSL::X509_NAME_get_index_by_NID(), and yaSSL::X509_NAME_oneline().
1.4.7

