Gaspar Chilingarov wrote:
Hi all!


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.


well, I'm going to write if_* script to integrate vim with erlang -- so
I need to pass arguments/variables to erlang runtime sistem, and get
them back -- there is almost one-to-one mapping from erlang data
structures to vim .

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.
---skip---
no, I'm going to write C code :)


Yeah, I saw your other post after posting this answer. Well, Vim (and the vim-script language) defines the following kinds of objects:

- data items
  - Strings and Numbers, which Vim can translate into each other
    - Number to String doesn't lose information
    - String to Number converts only what precedes the first non-number
      (defaul is zero)
    - Booleans are a special kind of Number (zero=FALSE, nonzero=TRUE)
  - Lists
  - Dictionaries
- buffers, windows, tab pages
- functions
  - a function takes a fixed or variable number of arguments
    depending on the function
  - a function may optionally have side-effects within Vim
  - a function returns a value, which may be any data item;
  - by default ("return" without argument, or fall thru to
    "endfunction") the return value is the Number 0
  - a function may trigger an error
- Ex-commands
  - an Ex-command usually does some action
  - see ":help :command" and scroll to "Command attributes" for the
    different kinds of arguments, w/wo range, w/wo count, etc.
  - an Ex-command may trigger an error
  - an Ex-command may optionally display something on the command-line
  - an Ex-command does not return a value.

In the case of the existing interpreted languages (perl, python, ruby, Tcl and Mzscheme):
  - Vim can
    - invoke the interpreter for inline scripts
    - invoke the interpreter for individual commands
    - invoke the interpreter for every line in a range
    - since the interpreter has access to Vim variables, the above can
      change variables and thus return a result
  - The interpreter can access most Vim variables, functions, commands
    and data structures via extensions to the interpreter syntax.

You may want to run Exuberant ctags in the src/ directory containing the Vim source, and possibly in whichever include directories are mentioned on the compile command line (as shown by ":version"). This will allow you to go from any word in the source to its definition, see ":help tagsrch.txt".

To go _from_ the definition _to_ the use(s) you may have to use the ":vimgrep" command (q.v.) (assuming you have Vim 7).

You may also want to read attentively the following, to see how the existing interfaces do it (assuming the src directory is current):

        :help if_perl.txt
        :view if_perl.xs
        :view auto/if_perl.c
        :view if_perlsfio.c
        :view proto/if_perl.pro
        :view proto/if_perlsfio.pro
        " note: if_perl.c is generated from if_perl.xs when you "make"
        " Vim.

        :help if_python.txt
        :view if_python.c
        :view if_python.pro

        :help if_ruby.txt
        :view if_ruby.c
        :view if_ruby.pro

        :help if_tcl.txt
        :view if_tcl.c
        :view if_tcl.pro

        :help if_mzsch.txt
        :view if_mzsch.c
        :view if_mzsch.pro
        :view if_mzsch.h

        :view eval.c

etc.


Best regards,
Tony.

Reply via email to