Posts: 6,419
Threads: 74
Joined: Mar 2002
Code:
case "IF A<B THEN A = C+B * (CalculateFirstPrime(B^2))":
...
...
Y'know...
Posts: 293
Threads: 31
Joined: Nov 2004
Hmmm...
Well you could have your program output the code you want to be executed to a text file, SHELL "FB " + filewhatever$ and then chain to the program that is output by FB then chain back to the original program. You'd still need to figure out how to get the program to return to the point right after where you had chained away once you returned.
Messy but I bet that might just work.
his sig left intentionally blank
Posts: 293
Threads: 31
Joined: Nov 2004
Code:
const program1$="jumper1"
const program2$="jumper2"
PRINT "Program 1"
IF jump = 1 THEN GOTO returnfromchain
OPEN program2$+".bas" FOR OUTPUT AS #1
PRINT #1, "Print " + CHR$(34) + "Program 2" + CHR$(34)
PRINT #1, "jump = 1"
PRINT #1, "chain " + CHR$(34) + program1$+".exe" + CHR$(34)
CLOSE #1
SHELL "FBC "+program2$+".bas"
CHAIN program2$+".exe"
returnfromchain:
print "done"
do
loop
That should do the trick, I think, haven't tested it.
Cool hack if it works though
his sig left intentionally blank
Posts: 121
Threads: 20
Joined: Sep 2004
It actually works! BTW, you don't need the chain argument in program two. When program 2 finishes, control is automatically returned to program 1 (at least when I try it). How about adding a function that does this automatically, and includes a copy of the fb compiler in your exe if the function is used?
8% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Posts: 142
Threads: 6
Joined: Aug 2001
Quote:How about adding a function that does this automatically, and includes a copy of the fb compiler in your exe if the function is used?
How about no? Adding 250KiB to the executable for just one function is completely pointless and utterly silly. Dinosaur had the most useful idea here. Not to mention it is far smaller at that. :wink:
Posts: 6,419
Threads: 74
Joined: Mar 2002
Yeah, it's something that less than 0.00000001% of people will use.