(*$Foreign *)
DEFINITION MODULE EM;
(*
  Module:	Interface to some EM instructions and data
  Author:	Ceriel J.H. Jacobs
  Version:	$Id$
*)

	FROM SYSTEM IMPORT ADDRESS;

	TYPE TrapHandler = PROCEDURE(INTEGER);

	PROCEDURE FIF(arg1, arg2: LONGREAL; VAR intres: LONGREAL) : LONGREAL;
	(* multiplies arg1 and arg2, and returns the integer part of the
	   result in "intres" and the fraction part as the function result.
	*)

	PROCEDURE FEF(arg: LONGREAL; VAR exp: INTEGER) : LONGREAL;
	(* splits "arg" in mantissa and a base-2 exponent.
	   The mantissa is returned, and the exponent is left in "exp".
	*)

	PROCEDURE TRP(trapno: INTEGER);
	(* Generate EM trap number "trapno" *)

	PROCEDURE SIG(t: TrapHandler): TrapHandler;
	(* install traphandler t; return previous handler *)

	PROCEDURE FILN(): ADDRESS;
	(* return current program file-name. This only works if file-name
	   and line-number generation is not disabled during compilation
	*)

	PROCEDURE LINO(): INTEGER;
	(* return current program line-number. This only works if file-name
	   and line-number generation is not disabled during compilation
	*)
END EM.