1. Still stuck in an infinite loop
- Posted by dstanger at belco.bc.ca May 17, 2001
- 419 views
Hello again, Well, Ctrl + C did nothing and we have established that Ctrl + Break overruns the computers memory. I still have no way to exit a Euphoria program without it ending on its own. I am working on a program with several loops in it and I am a very green novice so I am risking a crash (Having to press ctrl + break) each time I run the program after adding or changing code. Any more ideas on how to exit a program in mid stride? Thanks, David
2. Re: Still stuck in an infinite loop
- Posted by Travis Beaty <travisbeaty at arn.net> May 18, 2001
- 403 views
Howdy, David! What you may want to do is scan the keyboard buffer at some point in each loop and make sure the user hasn't mashed a button. For instance, you could do this ... procedure killProggieNow() -- Did the user press a key? If not, exit the procedure. if get_key() = -1 then return end if -- User must have pressed a key. Do stuff to shut down program nicely abort(0) end procedure And then, somewhere in each of the loops, put in a call to the above function. If you've only got a couple of loops to monitor, then it would be better to just insert the function's code into the loop (inlining it), as it would make your program run a tad faster. Hope this helps a little, anyway ... Travis Beaty Claude, Texas.
3. Re: Still stuck in an infinite loop
- Posted by Euman <euman at bellsouth.net> May 18, 2001
- 373 views
How many loops (while and for)? Try to use FLUSH( ) but contain it to only running once with an if statement like this: integer run_once, fn run_once = 0 fn = open("logfile", "w") -- inside your loops for x = 1 to length(something) do *or* while true do if not run_once then puts(fn, "Im in _blank_ procedure") flush(fn) -- This forces "Im in _blank_ procedure" -- into "logfile" on disk. run_once = 1 -- make sure to do this only once.... end if end for *or* while Make sure that each "Im in _blank_ procedure" that _blank_ is a unique name so you can track down the nasty loop....... Useing this routine you'll only need to do this once because the last line in "logfile" will tell you where your problem area is. Sure this will take a few minutes to do, but it will work. First, I suggest renameing the original .ex or .exw as looptst.ex or .exw so you can save your work and come back to it later without spending extra time takeing all of the routines to track the problem down out. run looptst.ex or .exw after rebooting your machine for the last time look at "logfile" what procedure does it point to? FIX IT! Hope this helps! Euman ----- Original Message ----- From: <dstanger at belco.bc.ca> To: "EUforum" <EUforum at topica.com> Sent: Thursday, May 17, 2001 09:45 Subject: Still stuck in an infinite loop > > > Hello again, > > Well, Ctrl + C did nothing and we have established that Ctrl + Break > overruns the computers memory. I still have no way to exit a Euphoria > program without it ending on its own. I am working on a program with several > loops in it and I am a very green novice so I am risking a crash (Having to > press ctrl + break) each time I run the program after adding or changing > code. Any more ideas on how to exit a program in mid stride? > > Thanks, > David > > > > >
4. Re: Still stuck in an infinite loop
- Posted by Euman <euman at bellsouth.net> May 18, 2001
- 394 views
Sorry, forget that last post. I fudged it alittle but this one will work. How many loops (while and for)? Try to use FLUSH( ) but contain it to only running once with an if statement like this: integer loop_one, loop_two, fn loop_one = 0 loop_two = 0 fn = open("logfile", "w") -- inside your loops for x = 1 to length(something) do *or* while true do if not loop_one then -- have to keep track of these for each loop puts(fn, loop_one) -- points to the nasty loop flush(fn) -- This forces "Im in _blank_ procedure" -- into "logfile" on disk. loop_one = 1 -- make sure to do this only once.... end if end for *or* while Make sure that each "Im in _blank_ procedure" that _blank_ is a unique name so you can track down the nasty loop....... Useing this routine you'll only need to do this once because the last line in "logfile" will tell you where your problem area is. Sure this will take a few minutes to do, but it will work. First, I suggest renameing the original .ex or .exw as looptst.ex or .exw so you can save your work and come back to it later without spending extra time takeing all of the routines to track the problem down out. run looptst.ex or .exw after rebooting your machine for the last time look at "logfile" what procedure does it point to? FIX IT! Hope this helps! Euman ----- Original Message ----- > From: <dstanger at belco.bc.ca> > To: "EUforum" <EUforum at topica.com> > Sent: Thursday, May 17, 2001 09:45 > Subject: Still stuck in an infinite loop > > > > > > > > Hello again, > > > > Well, Ctrl + C did nothing and we have established that Ctrl + Break > > overruns the computers memory. I still have no way to exit a Euphoria > > program without it ending on its own. I am working on a program with several > > loops in it and I am a very green novice so I am risking a crash (Having to > > press ctrl + break) each time I run the program after adding or changing > > code. Any more ideas on how to exit a program in mid stride? > > > > Thanks, > > David > > > > > > > > > > >
5. Re: Still stuck in an infinite loop
- Posted by Irv Mullins <irvm at ellijay.com> May 18, 2001
- 391 views