Author Topic: Retrieving Current Function Name to Pass in a Parameter  (Read 7249 times)

JPN

  • Community Member
  • Posts: 9
  • Hero Points: 0
Retrieving Current Function Name to Pass in a Parameter
« on: October 25, 2007, 01:16:22 PM »
Using a Slick-C Macro, Is it possible to retrieve the current function name and pass it in a parameter to another app. I already pass the filename and line number to an app I have, now if I could just get the function name passed I would be in business.

"C:\Inetpub\VMS.exe"  "%f" %M current-line-number%

If not a direct method, even just grabbing the active list item from the Defs window I think would work. Maybe this is something with _mdi? I am not familiar with macro programming.


Thanks!



Ivan N. Zlatev

  • Community Member
  • Posts: 87
  • Hero Points: 5
Re: Retrieving Current Function Name to Pass in a Parameter
« Reply #1 on: October 25, 2007, 02:05:04 PM »
Quote
_command _str current_proc(boolean dosticky_message=true)

Returns the name of the current procedure. This function also will return the name of the current class name, type definition, #define, any definition that is tagged. If display_message is true or not specified, the current function name is displayed on the message line.

Parameters:
    dosticky_message - Display message on message line, remember to pass "false" if you are calling this just to get the current proc name.

Returns: _str
    the name of the current procedure or "" if it can't be found

Applies To:
    Edit Window, Editor Control

Categories:
    Edit Window Methods, Editor Control Methods

JPN

  • Community Member
  • Posts: 9
  • Hero Points: 0
Re: Retrieving Current Function Name to Pass in a Parameter
« Reply #2 on: October 29, 2007, 05:39:15 PM »
Perfect  ;D

I put this in a macro file .e extension...

_str get_function_name()
{
    _str sFunctionName = current_proc(false);
    if (!sFunctionName)
        sFunctionName = "";
    //say 'functionanme='sFunctionName;
    return sFunctionName;
}
Loaded Macro.

Added parameter %M get-function-name%

"C:\VMS.exe" %M get-function-name%

To projects-->Tools path

%M calls macros.. get-function-name is name of above function.

And this returned function name no problems. Thanks!