home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / plbin.zip / pl / boot / portray.pl < prev    next >
Text File  |  1992-10-21  |  631b  |  32 lines

  1. /*  portray.pl,v 1.2 1992/10/21 10:42:25 jan Exp
  2.  
  3.     Copyright (c) 1990 Jan Wielemaker. All rights reserved.
  4.     jan@swi.psy.uva.nl
  5.  
  6.     Purpose: portray/1 connection to print/1
  7. */
  8.  
  9. :- module($portray, [$portray/1, $portray_variable/1]).
  10.  
  11. :- user:dynamic(portray/1).
  12. :- user:multifile(portray/1).
  13.  
  14. %   $portray is called from C through print/1.
  15.  
  16. $portray(Var) :-
  17.     $portray_variable(Var), !.
  18. $portray(Term) :-
  19.     user:portray(Term), !.
  20.  
  21.  
  22. $portray_variable($$VAR(N)) :-
  23.     $varname(N, Name), 
  24.     format('~s', [Name]).
  25.  
  26. $varname(N, [C]) :-
  27.     N < 26, !, 
  28.     C is N + 0'A.
  29. $varname(N, [C1, C2]) :-
  30.     C1 is N // 26 + 0'A, 
  31.     C2 is N mod 26 + 0'A.
  32.