work@dragos.UUCP (Dragos Ruiu) (04/24/88)
In article <2200@louie.udel.EDU>, new@udel.EDU (Darren New) writes: .> .> How about: (pseudocode) .> for (i = 0; i < max_in_table && key != name[i]; ++i) .> if (keypressed()) goto handle_key; .> seek(helpfile, offset[i]); .> if (keypressed()) goto handle_key; .> linecount = 0; .> do { .> read_line_from_file(); .> ++linecount; .> if (keypressed()) goto handle_key; .> if (read_line[0] == special_flag_char) goto handle_key; .> insert_spaces_and_color_codes(); .> if (keypressed()) goto handle_key; .> display_text_line(); .> if (keypressed()) goto handle_key; .> } while (linecount < 24); .> handle_key: .> c = wait_for_key_then_read_it(); .> switch (c) { .> case 'A': ... .> ... .> } .> .> I contend that if the reading and formatting and displaying are sufficiently .> slow, such behaviour can be desirable (i.e., on microcomputers). .> I would like to see a goto-less version of this that is easier to understand. .> - Darren New .> Graduate Student .> University of Delaware. .> done_reading = FALSE; linecount = 0; do_what_ever_seeks(); while(!done_reading) { if(!keypressed()) { read_line(); linecount++; } if(!keypressed()) do_what_ever_stuff(); if(!keypressed()) print_that_sucker(); if(keypressed() || linecount >= 24) done_reading = TRUE; } c = wait_for_key_then_read_it(); switch (c) { case 'A': ... ... } Really, this is getting boring. Would all the goto fans please go get themselves a BASIC compiler to write software and let us talk about something else. :-) -- Dragos Ruiu ruiu@dragos.UUCP ...alberta!dragos!ruiu "cat ansi.c | grep -v noalias >proper.c"