PreviousUpNext

15.4.242  src/lib/compiler/back/low/emit/asm-stream.pkg

## asm-stream.pkg

# Compiled by:
#     src/lib/compiler/back/low/lib/lowhalf.lib



# asm_stream - this package is available to all codererators.
#             Typically asm_out_stream is rebound to a file.

api Asm_Stream {
    asm_out_stream:  Ref(  file::Output_Stream );
    with_stream:     file::Output_Stream -> (X -> Y) -> X -> Y;
};



package   asm_stream
: (weak)  Asm_Stream                                    # Asm_Stream    is from   src/lib/compiler/back/low/emit/asm-stream.pkg
{
    asm_out_stream = REF file::stdout;                  # More icky thread-hostile global mutable state. XXX SUCKO FIXME. 

    fun with_stream  stream  body  x
        =
        {   s = *asm_out_stream; 

            asm_out_stream := stream;

            (   body x
                before
                    asm_out_stream := s
            )
            except e
                =
                {   asm_out_stream := s;
                    raise exception e;
                };
        };   
};





## COPYRIGHT (c) 1996 Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext