


## 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.
stipulate
package fil = file__premicrothread; # file__premicrothread is from src/lib/std/src/posix/file--premicrothread.pkgherein
api Asm_Stream {
asm_out_stream: Ref( fil::Output_Stream );
with_stream: fil::Output_Stream -> (X -> Y) -> X -> Y;
};
end;
stipulate
package fil = file__premicrothread; # file__premicrothread is from src/lib/std/src/posix/file--premicrothread.pkgherein
package asm_stream
: (weak) Asm_Stream # Asm_Stream is from src/lib/compiler/back/low/emit/asm-stream.pkg {
asm_out_stream = REF fil::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;
};
};
};
end;
## COPYRIGHT (c) 1996 Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


