Return-Path: <John.Harrison-request@cl.cam.ac.uk>
Delivery-Date: 
Received: from leopard.cs.byu.edu (no rfc931) by swan.cl.cam.ac.uk 
          with SMTP (PP-6.5) outside ac.uk; Tue, 4 Oct 1994 16:55:30 +0100
Received: by leopard.cs.byu.edu (1.38.193.4/16.2) id AA26907;
          Tue, 4 Oct 1994 09:42:58 -0600
Sender: info-hol-request@lal.cs.byu.edu
Errors-To: info-hol-request@lal.cs.byu.edu
Precedence: bulk
Received: from tuminfo2.informatik.tu-muenchen.de by leopard.cs.byu.edu 
          with SMTP (1.38.193.4/16.2) id AA26893;
          Tue, 4 Oct 1994 09:42:41 -0600
Received: from sunbroy14.informatik.tu-muenchen.de ([131.159.0.114]) 
          by tuminfo2.informatik.tu-muenchen.de with SMTP id <326626>;
          Tue, 4 Oct 1994 16:36:27 +0100
Received: by sunbroy14.informatik.tu-muenchen.de id <8067>;
          Tue, 4 Oct 1994 16:32:36 +0100
From: Konrad Slind <slind@informatik.tu-muenchen.de>
To: reetz@ira.uka.de, info-hol@leopard.cs.byu.edu
In-Reply-To: <"i80fs2.ira.526:30.09.94.14.00.33"@ira.uka.de> (message from reetz on Fri, 30 Sep 1994 21:00:23 +0100)
Subject: Re: redirect print_theory from screen into file
Message-Id: <94Oct4.163236met.8067@sunbroy14.informatik.tu-muenchen.de>
Date: Tue, 4 Oct 1994 16:32:28 +0100


Ralph Reetz asks:

> Does anybody know a fast and easy way to redirect the output of
> print_theory "xxxx" from the screen into a file for HOL90.6? I just
> don't want to start trying to "hack around" redirecting std_out or
> something similiar...

You could use the following, although it does work by temporarily
redirecting the compiler's output stream:

    fun theory_to_file {theory, file} = 
       let val ostrm = open_out file
           val old = !System.Print.out
       in System.Print.out := ostrm;
          Theory.print_theory theory handle e => (close_out ostrm;
                                                  System.Print.out := old;
                                                  raise e); 
          flush_out ostrm; (* Maybe overkill *)
          close_out ostrm;
          System.Print.out := old
       end;

A better solution would be to have a visible, but abstract, type of
theories. Then the standard prettyprinting tools could be used.


> Theories are sometimes too large to simply use cut and paste and just
> a command would be easier, too. In general, it IMHO might be nice to
> have a changeable io-stream, where HOL90 emits its ``messages'' like
> in print_theory, theorems, definitions, and so on.

HOL interaction can be viewed as a "multiplexing" of various different
interaction channels. Right now, everything is basically being forced
through std_in and std_out. Separating the different dialogues, perhaps
by use of the ML type system, might be a useful idea.

Konrad.
