Re: Need some advice on project
- Posted by Irv Mullins <irv at ELLIJAY.COM> Oct 03, 1999
- 497 views
On Sun, 3 Oct 1999 07:51:08 EDT, Ben Logan <wbljr79 at HOTMAIL.COM> wrote: >Hmmm...Sounds good. >Would you mind describing how it would work? Better than that, here's the code. I'll leave it up to you to decide how to skip over the case where it returns the _complete_ list of routes. Hint: if length(found) = length(routes) then... include get.e include wildcard.e sequence routes,found, result constant ID = 1, ROUTE = 2 -- refer to fields of structure below: routes ={{1,"H604-H440",0,0,0}, -- naturally, this should really {2,"H043-H433",0,1,0}, -- be loaded from a file {3,"604-443",1,0,1}} function select(sequence list, sequence pattern) object temp temp = {} pattern = upper(pattern & '*') for i = 1 to length(list) do if wildcard_match(pattern,upper(list[i][ROUTE])) > 0 then temp = append(temp,list[i]) end if end for return temp end function procedure display(object list) clear_screen() for i = 1 to length(list) do printf(1,"%d %s %d %d %d\n",list[i]) end for end procedure function get_input() object search, key, found search = "" found = {} while 1 do key = wait_key() if key = 27 then exit -- escape else search = search & key found = select(routes,search) display(found) end if end while return found end function puts(1,"Enter your route code, or ESC to quit\n") result = get_input()