Gaspar Chilingarov wrote:
Hello!
Are there any common method to return values from
ex_func_T type functions which are defined in
CMD_index in ex_cmds.h (external command handlers - say perl/ruby and etc)?
I would like to return function execution result to calling script - say
string, or list.
Thanks in advance,
Gaspar
IIUC, ex_func_t means "void *", i.e., a pointer to anything. You would
still need to know what type of object (a pointer to what) the function
you're calling is actually returning.
If what you are interested in writing is a
Vim/perl/ruby/tcl/python/mzscheme script and not a C/C++ source file,
you should look in the Vim help rather than in the Vim source. If you
are calling a Perl function from Vim, see ":help if_perl.vim". If you
are calling a Vim function from Perl, look there and also in the help
item for the function you're calling. An Ex-command is not the same as a
function: a function _may_ have some side-effects (execute an action),
it _always_ returns a result (which is the number zero if a ":return"
statement without arguments is executed, or if control falls through to
the ":endfunction" statement. An Ex-command may execute some action
and/or display a status message, it does not "return a result." To
intercept errors generated in Vim, you can use the
try/catch/finally/endtry mechanism (see ":help :try"). To ignore them,
use ":silent" (q.v.)
Best regards,
Tony.