MODULE jim1foobar Interface;        (* INTERFACE *)
 EXPORT catch22 = (footype,setfoo,getfoo);
  TYPE footype = integer;
 PROCEDURE setfoo(f: footype);
  FUNCTION  getfoo: footype;
END. { module jim1foobar interface }

MODULE jim1foobar Implementation;   (* IMPLEMENTATION *)
 IMPORT StandardInput;
      StandardOutput;
 VAR foo : footype;
 { Note: the effect is the same as the Forward directive would have:
    parameter lists and return types are not "allowed" in the declaration
    of exported routines. }
  PROCEDURE setfoo;
 BEGIN
    foo := f;
 END;
  FUNCTION getfoo;
  BEGIN
    getfoo := foo;
  END;
 TO BEGIN DO
    BEGIN
      foo := 59;
{      writeln ('Just an example of a module initializer. See comment below'); }
   END;
  TO END DO
   BEGIN
     foo := 0;
{     writeln ('Goodbye'); }
   END;
END. { jim1foobar implementation }


Program Jim1 ( Output );

Import
  catch22;

begin
  SetFoo ( 42 );
  if GetFoo = 42 then
    writeln ( 'OK' )
  else
    writeln ( 'failed' );
end.
