home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / EXAMPLES.ARC / CH17EX01.PRO < prev    next >
Encoding:
Text File  |  1988-06-21  |  1.1 KB  |  47 lines

  1. /*
  2.    Turbo Prolog 2.0 Chapter 17, Example Program 1
  3.    
  4.    Copyright (c) 1986, 88 by Borland International, Inc
  5.    
  6. */
  7. constants
  8. % To access your BGI drivers and fonts bgi_path may need to equal "..\\BGI".
  9.    bgi_path = ""
  10.  
  11.  
  12. % To access the GRAPDECL.PRO file you may need to add a path: 
  13. % include "..\\programs\\GRAPDECL.PRO" 
  14. include "GRAPDECL.PRO" 
  15.  
  16. predicates
  17.    toText
  18.    tempTextmode
  19.    toGraphic
  20.  
  21. goal
  22.    toGraphic,
  23.    tempTextmode,
  24.    toText.
  25.  
  26. clauses
  27.    toGraphic:-
  28.       % Detect graphics hardware
  29.       detectGraph(G_Driver, G_Mode),
  30.       initGraph(G_Driver,G_Mode, New_Driver,New_Mode, bgi_path),
  31.       write("A look into the BGI"),nl,
  32.       writef("Graph_Driver = %, Graph_Mode = %",G_Driver,G_Mode),nl,
  33.       writef("Newe_Driver = %, New_Mode = %",New_Driver,New_Mode),nl,    
  34.       write("Press key to return:"),
  35.       readchar(_).
  36.  
  37.   TempTextmode:-
  38.       getGraphMode(GraphMode),
  39.       restoreCRTMode,
  40.       write("\nNow you are in text mode.\n\n"),
  41.       write("\nPress any key to go back to graphics ..."),
  42.       readchar(_),
  43.       setGraphMode(GraphMode).
  44.  
  45.    ToText:-
  46.       closegraph().
  47.