(****************************************************************)
(*                                                              *)
(*         Gardens Point Modula-2 Library Definition            *)
(*                                                              *)
(*                                                              *)
(*     (c) Copyright 1996 Faculty of Information Technology     *)
(*              Queensland University of Technology             *)
(*                                                              *)
(*     Permission is granted to use, copy and change this       *)
(*     program as long as the copyright message is left intact  *)
(*                                                              *)
(****************************************************************)

FOREIGN DEFINITION MODULE Coroutines;   (* coroutines as in PIM *)

  IMPORT IMPLEMENTATION FROM "coroutines.o";
  FROM SYSTEM IMPORT ADDRESS;

  TYPE Coroutine = ADDRESS;  (* use of this type avoids SYSTEM import *)

  PROCEDURE NEWPROCESS (code  : PROC;		(* body of coroutine  *)	
			space : ADDRESS;	(* ptr to workspace   *)
			size  : CARDINAL;	(* size of workspace  *)
		    VAR this  : Coroutine);	(* returned coroutine *)

  PROCEDURE TRANSFER (VAR thisCo : Coroutine;	(* current saved here *)
		      VAR destCo : Coroutine);  (* target to activate *)

END Coroutines.
