DADiSP Worksheet Functions > Function Categories > Macro and Command File Functions > __CALLERFILENAME__

 

__CALLERFILENAME__

Purpose:

Returns the file name of the path of the caller SPL routine.

Syntax:

__CALLERFILENAME__

Example:

// ctest.spl

ctest(x)

{

    return(ctest_div(x));

}

 

ctest_div(x)

{

    local str;

 

    if (argc < 1) x = 1;

 

    if (x == 0)

    {

        str = sprintf(strescape("Divide by 0\nFile: %s\nFunction: %s\nCaller: %s"),

                                __FILENAME__, __FUNC__, __CALLERFILENAME__);

        message(str);

 

        return;

    }

    

    return(1/x);

}

 

ctest(0)

 

displays the message:

 

Divide by 0

File: ctest.spl

Function: ctest_div

Caller: ctest.spl

Remarks:

__CALLERFILENAME__ returns the file name portion of the path of the caller of an SPL routine. An empty string is returned if there is no caller.

 

See __CALLERFILE__ to return the full path of the caller SPL.

See Also:

#DEFAULT

#DEFINE

__CALLER__

__CALLERFILE__

__FILE__

__FILENAME__

__FUNC__

__LINE__