gotos

Every system needs one terry at wsccs.UUCP
Sat Apr 30 14:37:31 AEST 1988


In article <3490 at bunker.UUCP>, garys at bunker.UUCP (Gary M. Samuelson) writes:
[...]
> What you really want is to get an interrupt if a key is pressed.
> If you can do that, then the code becomes much simpler.  If you
> can't get either a "key pressed" interrupt or an interval timer
> interrupt, then use a state machine.  (Credit has to go to Dave
> Burton; although I frequently use state machines, I hadn't thought of it
> in the previous case.)

how's about:

extern volatile key_interrupt;

for( ;;) {

	switch( whatever) {
	case 1:
	...
	case 2:
	...
	default:
	...
	}
	if( key_interrupt)
		break;
}


| Terry Lambert           UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry |
| @ Century Software        OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry    |
| SLC, Utah                                                                   |
|                   These opinions are not my companies, but if you find them |
|                   useful, send a $20.00 donation to Brisbane Australia...   |
| 'Admit it!  You're just harrasing me because of the quote in my signature!' |



More information about the Comp.lang.c mailing list