# location splitting code
  # Note that line number must start with digit,
  # while the text unit code must start with letter:
  match(lin, /^<f[0-9]+[vr]?[0-9]?[.](|[A-Z]|[A-Za-z][A-Za-z0-9]?[.])[0-9]+[a-f]?;[A-Z]>/);
  if (RSTART != 1) 
    { format_error("bad location format"); res = 0; }
  else
    { 
      loc = substr(lin,RSTART+1,RLENGTH-2);
      if (substr(lin,RLENGTH+1, 19-RLENGTH) != substr(blanks, 1, 19-RLENGTH))
        { format_error("too few blanks"); res = 0; }
      if (substr(lin,20,1) == " ")
        { format_error("too many blanks"); res = 0; }

      # Validate location code
      # Split location into fields:
      tmp = length(loc);
      trc = substr(loc, tmp,1);
      if (substr(loc, tmp-1, 1) != ";")  { fatal_error("program error: semicolon"); }
      loc = substr(loc, i, tmp-2);

      nf = split(loc, tmp, /[.]/);
      if (nf == 3) 
        { un = (tmp[1] "." tmp[2] "."); ln = tmp[3]; }
      else if (nf == 2) 
        { if (tmp[2] ~ /^[0-9]/)
            { un = (tmp[1] "."); ln = tmp[2]; }
          else if (tmp[2] ~ /^[A_Z]/)
            { un = (tmp[1] "." substr(tmp[2],1,1)); ln = substr(tmp[2],2); } 
          else
            { fatal_error("program error: tmp[2]"); }
        }
      else
        { fatal_error("program error: nf"); }

      # Check for non-decreasing lines
      if (un == cur_un)
        { if (numeric_line(ln) <= numeric_line(cur_ln))
            { format_error("lines out of order, or interloping comments"); }
        }

function numeric_line(n, m,i)
{
  # Converts a line number "n" to an integer, for sorting purposes.
  if (n ~ /^[0-9]+$/)
    { n = 10*n; }
  else if (n ~ /^[0-9]+[a-e]$/)
    { m = length(n);
      i = index("abcde", substr(n,m,1));
      if (i == 0) { fatal_error("program error: let->num"); }
      n = 10*substr(n,1,m-1) + i;
    }
  else
    { fatal_error("program error: line num"); }
  return n;
}

function remove_redundant_spaces(lin)
{
  # Supress redundant spaces:
  gsub(/[-\/=., ]*[=][-\/=., ]*/, "=", lin);
  gsub(/[-\/., ]*[-][-\/., ]*/, "-", lin);
  gsub(/[\/., ]*[\/][\/., ]*/, "/", lin);
  gsub(/[., ]*[., ][., ]*/, ".", lin);
  return lin;
}