home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / EXAMPLES.ARC / CH12EX11.PRO < prev    next >
Encoding:
Prolog Source  |  1988-06-21  |  841 b   |  39 lines

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