home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH12EX11.PRO < prev    next >
Encoding:
Prolog Source  |  1990-03-26  |  776 b   |  36 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5. domains
  6.    file = input; output
  7.  
  8. predicates
  9.    convert_file
  10.    repfile(FILE)
  11.  
  12. goal
  13.    write("Which file do you want convert ?"),
  14.    readln(InputFileName),
  15.    write("What is the name of the output file ?"),
  16.    readln(OutputFileName),
  17.    openread(input, InputFileName),
  18.    readdevice(input), 
  19.    openwrite(output, OutputFileName),
  20.    writedevice(output), 
  21.    convert_file,
  22.    closefile(input),
  23.    closefile(output).
  24.  
  25. clauses
  26.    convert_file :-
  27.       repfile(input),
  28.       readln(Ln),
  29.       upper_lower(LnInUpper,Ln),          /* converts the string to upprecase */
  30.       write(LnInUpper),nl,
  31.       fail.
  32.    convert_file.
  33.  
  34.    repfile(_).
  35.    repfile(F):- not(eof(F)),repfile(F).
  36.