John E. Davis wrote:
G. Milde <g.milde@xxxxxx> wrote: [...]So, here is my feature request for an improved autoload(): SYNOPSIS Load functions from a file USAGE autoload(String funct, [String funct2 , ...], String file);I will look into extending autoload to support this, but do not look for it anytime soon.
Maybe you can use this code:
% ------- slstd.c -----------------
static void autoloads_intrinsic ()
{
int num_args;
char *fname;
char *macro;
num_args = SLang_Num_Function_Args;
if (-1 == SLang_pop_slstring (&fname))
return;
num_args -= 1;
while (num_args)
{
if (-1 == SLang_pop_slstring (¯o))
break;
else
{
SLang_autoload (macro, fname);
SLang_free_slstring (macro);
}
num_args--;
}
SLang_free_slstring (fname);
}
// ...
MAKE_INTRINSIC_0("autoloads", autoloads_intrinsic, SLANG_VOID_TYPE),
% --------------------------------
Test results:
0.006475 1000 times autoload
0.001287 100 times _autoload(10)
0.001209 100 times autoloads (C version)
0.007521 100 times autoloads2 (speedy version with 10 functions)
0.007669 100 times autoloads4 (explicit version )
Marko
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.