Is there a way to know whether a program was called by entering the call from the command prompt vs. being called from a program line (such as running it or stepping into it)?
Given this program:
10 ! CALLED_PROG
20 ENTER ARG1$
30 IF SOMETHING THEN PRINT "CALLED FROM COMMAND LINE" ELSE PRINT "CALLED FROM PROGRAM"
40 EXIT
Call made from the command prompt:
->CALL "CALLED_PROG","TEST"
Call made from a program:
1010 CALL "CALLED_PROG","TEST"
What would SOMETHING be at line 30 in CALLED_PROG?
Keep in mind that in both cases, the name of the program being called could be referenced in a variable instead of quoted text.
I've played with the stk() function but that doesn't help if the call from the command line is done while stepping through a program because stk(-1) references the line/program stepped to.
I considered parsing the code pointed to by stk(-1) using lst(pgm(num(mid(stk(-1),1,5)),tcb(12)-1)), but even if the code at that line does in fact call the program, it still may have been called from the command prompt.
The one difference I am sure of is that when calling from a command prompt, there is no "next" statement to execute. Is there a way to know this?