Files
mercury/extras/logged_output/README
Peter Ross ae43e3ec1d Change the MercuryFile structure so that it now contains pointers to
Estimated hours taken: 20

Change the MercuryFile structure so that it now contains pointers to
functions which operate on the MercuryFile.  This allows us, for
example, to create a MercuryFile structure which operates on sockets and
use the predicates in io.m to operate on the socket stream.


runtime/mercury_library_types.h:
    Define the new implementation of MercuryFile structure.
    The MercuryFile structure now contains pointers to functions to do
    all the basic I/O operations.
    Define macros to access all the different parts of the MercuryFile
    structure.

runtime/mercury_file.h:
runtime/mercury_file.c:
    Implement a MercuryFile structure which operates on C FILE *'s.

library/io.m:
    Call the basic I/O operations from the MercuryFile structure.
    Explicitly check that we are using a file stream when required.
    As we cannot supply a variable number of arguments to a macro,
    define a new function ML_fprintf() to provide fprintf functionality.
    Hide all direct access to the MercuryFile data structure behind
    macros.

browser/util.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
    Hide all direct access to the MercuryFile data structure behind
    macros.

extras/logged_output/Mmakefile:
extras/logged_output/README:
extras/logged_output/logged_output.m:
extras/logged_output/main.m:
    Add an example of defining a new MercuryFile structure.  This new
    structure defines an output stream which writes to stdout and logs
    to a file at the same time.

runtime/Mmakefile:
    Add the new files mercury_file.{c,h}.

runtime/mercury_imp.h:
    Include `mercury_file.h'.
2000-08-11 16:50:24 +00:00

12 lines
409 B
Plaintext

% Copyright (C) 2000 The University of Melbourne.
This directory shows how you can use the MercuryFile structure to change
the behaviour of io.m.
The file logged_output.m implements an io__output_stream which writes to
stdout and also logs all of its output to a file at the same time.
To compile this module you need a mercury compiler which has has been
configured with --enable-new-mercuryfile-struct.