Re: Adding another language to the fray
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Adriaan de Groot wrote:
> On Wed, 3 Sep 2003, Bram Moolenaar wrote:
> > When your support for "d" is working, please consider submitting it for
> > inclusion. I intend to support as many languages as possible, so that
> > Aap works right away for most people.
>
> Sounds like another module just waiting for :import to me. I suppose the
> module itself can contain the code for the exists() function for the given
> toolset?
If you are writing a recipe using the "D" language it would indeed be
logical to add a command like: ":import d" or perhaps ":import lang_d".
That's not different from the previously proposed ":import libtool".
The main advantage is that Aap doesn't have to load support for dozens
of languages when starting up (well, by the time we have support for a
dozen of languages).
Now that we are thinking about this, we should verify that this
mechanism works for selecting the tool to use. Suppose there are
various "D" compilers available. Then ":import d" should invoke a check
to find the compiler that can be used on the current system. If no "D"
compiler can be found Aap should probably abort with an error message.
I suppose this mostly can work like the code in default.aap that
searches for a C compiler. Thus go through a list of tools that provide
the exists() and define_actions() methods. Something like:
for c in ["dcc", "msdcc" ]:
exec "import tools.%s" % c
if eval("tools.%s.exists()" % c):
exec "tools.%s.define_actions()" % c
if not didone:
didone = 1
exec "tools.%s.use_actions(_top)" % c
Hmm, this looks pretty standard. If exactly the same thing is used in
several ":import"ed recipes we better make a Python function for it.
--
This is the polymorph virus! Follow these instructions carefully:
1. Send this message to everybody you know.
2. Format your harddisk.
Thank you for your cooperation in spreading the most powerful virus ever!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf