% localfile.min - applet reads a file and loads program % from file system of local machine % (Example for Windows, JDK1.3 VM) main(_Args) :- test. % for use as application main(_Applet,_Args) :- test. % for use as applet test :- localfile_read, localfile_load. localfile_read :- % try to read a file try(read1('file:///C:/minlocal/hi_world.min')), true. localfile_load :- % try to load a program try(load('file:///C:/minlocal/hi_world.mbc')), true. read1(Filename) :- % read first line of a text file open(Filename,read,In), get_line(In,Line), close(In), writeq(Line),nl,flush_output. try(Goal) :- % call and report writeq(calling(Goal)),nl,flush_output, catch(Goal,Error,(writeq(Error),nl,flush_output)), !.