Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROG() & LINE() from within FUNCTION

Status
Not open for further replies.

mmerlinn

Programmer
Joined
May 20, 2005
Messages
766
Location
US
Does anyone know or know where I can find how, if even possible, to determine the calling program and line number from within a function? It is a royal pain to have to always remember to pass the same parameters when FP should be able to do it automatically.

This occurs in my main on-the-fly debugging routine, which I constantly move & change when I am debugging a program. Can easily be typed in a dozen or more times per day. Due to other changes it is usually easier to type than to cut & paste.

A side advantage would be that I could pass 2 extra parameters when needed, which is rare.


Currently doing this:

= myfunction(prog(), line(), 1st var, ... , Nth var)

FUNCTION myfunction
PARAMETERS varP, varL, var1, ..., varN
prog = varP
line = varL
...
RETURN


Want to do this:

= myfunction(1st var, ... , Nth var)

FUNCTION myfunction
PARAMETERS var1, ..., varN
prog = (calling program name)
line = (calling program line number)
...
RETURN

Using FP 2.6.

Thanks in advance.
 
The following FAQ's contain error handlers which will gather the information you are looking for....

Application Starter which includes Error Handler
faq184-4492
User-friendly Error Handler
faq182-4156

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Geoff:

Thanks. That works. Now to find how to do LINE().

Went to your webpage. Saw this:

"BITLSHIFT(<n1>,<n2>)
return <n1> with all bits shifted <n2> places left. The leftmost <n2> bits are set to 0."

Don't have book here to verify this, but experience says this is probably wrong.

mmerlinnh
 
Tamar & JRB-Bldr:

This function is NOT triggered by ON ERROR. I already use a different function that IS triggered by ON ERROR, and LINENO() works perfectly in that one.

When LINENO() is used within myfunction(), it always returns the line number where LINENO() is located within myfunction() {as it should}, not the line number that calls myfunction(), which is what I want.

mmerlinni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top