ldmud-3.2.9/doc/
ldmud-3.2.9/doc/efun/
ldmud-3.2.9/mud/
ldmud-3.2.9/mud/heaven7/
ldmud-3.2.9/mud/heaven7/lib/
ldmud-3.2.9/mud/lp-245/
ldmud-3.2.9/mud/lp-245/banish/
ldmud-3.2.9/mud/lp-245/doc/
ldmud-3.2.9/mud/lp-245/doc/examples/
ldmud-3.2.9/mud/lp-245/doc/sefun/
ldmud-3.2.9/mud/lp-245/log/
ldmud-3.2.9/mud/lp-245/obj/Go/
ldmud-3.2.9/mud/lp-245/players/lars/
ldmud-3.2.9/mud/lp-245/room/death/
ldmud-3.2.9/mud/lp-245/room/maze1/
ldmud-3.2.9/mud/lp-245/room/sub/
ldmud-3.2.9/mud/lp-245/secure/
ldmud-3.2.9/mud/morgengrauen/
ldmud-3.2.9/mud/morgengrauen/lib/
ldmud-3.2.9/mud/sticklib/
ldmud-3.2.9/mud/sticklib/src/
ldmud-3.2.9/mudlib/uni-crasher/
ldmud-3.2.9/pkg/
ldmud-3.2.9/pkg/debugger/
ldmud-3.2.9/pkg/diff/
ldmud-3.2.9/pkg/misc/
ldmud-3.2.9/src/autoconf/
ldmud-3.2.9/src/bugs/
ldmud-3.2.9/src/bugs/MudCompress/
ldmud-3.2.9/src/bugs/b-020916-files/
ldmud-3.2.9/src/bugs/doomdark/
ldmud-3.2.9/src/bugs/ferrycode/ferry/
ldmud-3.2.9/src/bugs/ferrycode/obj/
ldmud-3.2.9/src/bugs/psql/
ldmud-3.2.9/src/done/
ldmud-3.2.9/src/done/order_alist/
ldmud-3.2.9/src/done/order_alist/obj/
ldmud-3.2.9/src/done/order_alist/room/
ldmud-3.2.9/src/gcc/
ldmud-3.2.9/src/gcc/2.7.0/
ldmud-3.2.9/src/gcc/2.7.1/
ldmud-3.2.9/src/hosts/
ldmud-3.2.9/src/hosts/GnuWin32/
ldmud-3.2.9/src/hosts/amiga/NetIncl/
ldmud-3.2.9/src/hosts/amiga/NetIncl/netinet/
ldmud-3.2.9/src/hosts/amiga/NetIncl/sys/
ldmud-3.2.9/src/hosts/i386/
ldmud-3.2.9/src/hosts/msdos/byacc/
ldmud-3.2.9/src/hosts/msdos/doc/
ldmud-3.2.9/src/hosts/os2/
ldmud-3.2.9/src/hosts/win32/
ldmud-3.2.9/src/util/
ldmud-3.2.9/src/util/erq/
ldmud-3.2.9/src/util/indent/hosts/next/
ldmud-3.2.9/src/util/xerq/
ldmud-3.2.9/src/util/xerq/lpc/
ldmud-3.2.9/src/util/xerq/lpc/www/
Short: New efun: previous_program(), program_stack()
From: Daniel Sloan <sloand@alphalink.com.au>
From: Michael <virus@mpinet.net>
Date: Tue, 23 Mar 1999 15:29:14 +0000
Type: Feature
State: Unclassified

Maybe also an efun program_stack()?

Daniel writes:

A 'previous_program' efun, parallel to previous_object().  Real handy for
tracing certain things and working out where a call was *really* made from.
I've not implemented this in the current driver I use, only an old 3.1.2
driver =-)

Michael writes:

After looking through a DGD driver source code, there is something
similar to the previous_object() function, but called
previous_program(). I don't have that much knowledge of the DGD driver,
but from what I found, this previous_program() could be used as a good
base for making a better security system for alot of mudlibs.

Excerpt from kfun/std.c under the DGD src directory:

/*
 * NAME:        kfun->previous_program()
 * DESCRIPTION: return the previous program in the function call chain
 */
int kf_previous_program(nargs)
int nargs;
{
    char *prog;
    register string *str;

    if (nargs == 0) {
        (--sp)->type = T_INT;
        sp->u.number = 0;
    } else if (sp->u.number < 0) {
        return 1;
    }

    prog = i_prev_program((int) sp->u.number);
    if (prog != (char *) NULL) {
        sp->type = T_STRING;
        str = str_new((char *) NULL, strlen(prog) + 1L);
        str->text[0] = '/';
        strcpy(str->text + 1, prog);
        str_ref(sp->u.string = str);
    } else {
        sp->u.number = 0;
    }
    return 0;
}

Think something like this would be viable for the LD project/driver?
I found the DGD driver from ftp.imaginary.com server if you wish to
follow up on it more.

-- Michael

Rodney writes:

> When you use extern_call() within a module which is inherited, it is
> difficult to tell when a function is being called externally or not.
> 
> For example, if you had two modules A and B which contained:
> 
>     // File : /obj/modules/a
>     // Module A
> 
>     query_extern() { return extern_call(); }
> 
>     // File : /obj/modules/b
>     // Module B
> 
>     inherit "obj/modules/a";
> 
>     query_extern() { return ::query_extern(); }
> 
> 
> If you call query_extern(), in Module A, it will return 1 or 0 depending on
> whether you used call_other(), or some external function, as documented.
> If you call query_extern() using call_other(), in Module B, it will always
> return 0.
> 
> One possible solution is to modify extern_call() so that its behaviour
> changes depending on the situation. If a function Y calls a function X,
> which calls extern_call(), it should either:
> 
>     (1) KEEPS ITS CURRENT BEHAVIOUR.
>         if X != Y (i.e. X has not got the same name, or is from a
>         different object to Y)
> 
>     (2) BEHAVE AS IF IT WAS CALLED FROM Y.
>         if X == Y (i.e. X has the same name as Y and is from the same
>         object).
> 
> Another solution is to create a new function e.g.
> 
>     extern_func_call()
> 
> which behaves in the manner just described.
> 
> Or yet another solution is to provide a efun which returns a list of
> function names in the current call stack, and the objects they came from.