function al (newline, varargin);

% Usage al ('PS code','PS comment');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% al.m                                             %
% written 2/24/00 by ben olding                    %
% this function takes a new string and appends it  %
% to the bottom of a matrix of text                %
% the key is to make sure every line has the same  %
% length                                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global PSText PSComment

nlen = length(newline);
[ohi olen] = size(PSText);

if nlen<=olen,                 % the newline is shorter
  newline(1,nlen+1:olen) = ... % than the current text
    repmat (' ',1,olen-nlen);
else
  PSText (:,1+olen:nlen) = ... % the newline is longer 
    repmat (' ',ohi,nlen-olen);% than the current text
end

PSText(ohi+1,:)=newline;

%%% The following is the exact same as above, only
%%% with the text stream PSComment

[ohi olen] = size(PSComment);
if isempty(varargin),
  newline = repmat(' ',1,olen);
else
  newline = varargin{1};
  nlen = length(newline);
  if nlen<=olen,                    % the newline is shorter
    newline(1,nlen+1:olen) = ...    % than the current text
      repmat (' ',1,olen-nlen);
  else
    PSComment (:,1+olen:nlen) = ... % the newline is longer 
      repmat (' ',ohi,nlen-olen);   % than the current text
  end
end

PSComment(ohi+1,:)=newline;

