- Subject: Re: A simpler autoload
- From: Guenter Milde <milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 7 Apr 2003 10:28:33 +0200 (CEST)
On Sat, 29 Mar 2003 10:18:01 +0100 wrote Marko Mahnič <mmarko.dfg@xxxxxxx>:
> Hello!
>
> Here is a short macro that might help when autoloading files.
> You write the filename only once, ant then list all the macros that
> you wish to autoload from it.
>
> Marko
>
> %!% \usage{Void autoload_file (String file, String macro, String macro,
> ...)}
> define autoload_file ()
> {
> variable file = "", macro = "", nmacros = _NARGS-1;
> _stk_roll (-(nmacros + 1));
> file = ();
> loop (nmacros)
> {
> macro = ();
> autoload (macro, file);
> }
> }
>
> site.sl might be much simpler with this
There is already the _autoload function, that works with the drawback that
you need to give the number of macros:
DESCRIPTION
The `_autoload' function is like the `autoload' function except that
it takes `n' pairs of function name (`fun') / filename (`fn') pairs.
For example,
_autoload ("fun_a", "file_a", "fun_b", "file_b", 2);
The above could be even easier if you stick to the file-last convention:
%!% \usage{Void autoloads(String fun, [String fun[, ...]], String file)}
define autoloads()
{
variable file = (), fun;
loop (_NARGS-1)
{
fun = ();
autoload (fun, file);
}
}
However, when trying _autoload in my make_ini skript, I got problems:
% the idea to use _autoload and _add_completion did not work:
% a file with 12 global functions triggered a "line len too long" error
Question: how long can a line be, before the "line len too long" error is
triggered?
Günter
--
Milde at ife.et.tu-dresden.de
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]