PROCEDURE Center(Line : String;  VAR xpos : Integer;  ypos : Integer);
(*
  by Erik C. Warren, 14 January, 1987
  for UPDATE...KYAN, Jan./Feb. '87
  Prior to calling this routine, you must have declared:
        CONST MaxString = n; (n is a number of your choice)
         TYPE String = ARRAY[1..MaxString] OF Char;

  You must also have included the files "POSITION.I" and "LENGTH.I"
  from the K.P. disk, side two.

  xpos must be passed by reference as a VARiable, not as a value
     parameter; it will be changed to reflect the horizontal position
     at which the string is written to.

  ypos is the vertical position you want the string to be written at.
*)

CONST MaxCols = 40; (* or 80 if your system has the capability *)

BEGIN
(* Calculate new x *)
  xpos := MaxCols DIV 2 - 1 - (Length(Line) DIV 2);
  IF xpos < 0 THEN xpos := 0; (* range check *)
  Position(xpos,ypos); (* Goto X,Y cursor coordinates *)
  Write(Line) (* Write string, no CR *)
END; (* Center *)
