gotos

Peter da Silva peter at sugar.UUCP
Mon Apr 25 01:48:16 AEST 1988


I think you're both hosed...

In article ... campbell at maynard.BSW.COM (Larry Campbell) writes:
> In article <2200 at louie.udel.EDU> new at udel.EDU (Darren New) writes:
> <>How about: (pseudocode)
> <>   for (i = 0; i < max_in_table && key != name[i]; ++i) 
> <>      if (keypressed()) goto handle_key;
	...
> <>   handle_key:
> <>   c = wait_for_key_then_read_it();
> <>   switch (c) {

> Use a signal handler.  Example:

> handle_key()
> {
> c = wait_for_key_then_read_it();
> switch (c)
>     {
	...
> ... main body of code:

>     signal(SIGIO, handler);
>     for (i = 0; i < max_in_table && key != name[i]; ++i) 
>         ;

Who's got SIGIO?

And why do you need SIGIO?

Instead of
	if(key_pressed()) goto handle_key;

You can do
	if(key_pressed()) handle_key();

Personally I'd do this in a real operating system that supports lightweight
processes, like AmigaDOS, instead of an old monolithic monitor :->.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These aren't mere opinions, these are *values*.



More information about the Comp.lang.c mailing list