procedure set_base_unums;
var i,j:unitnum;
being
  if h_unitable<>nil then with h_unitable^ do
    for i:=1 to maxunit do
      for j:=i+1 to maxunit do
        if     (tbl[j].base_unum=j)             {first time to modify this entry}
           and (on_same_medium(i,j) then        {"synonym" units}
             begin
               if   ((not tbl[j].is_hfsunit) and (tbl[i].is_hfsunit))
                 or (tbl[j].is_hfsunit)  then
                 begin
                  tbl[j].base_unum:=i;
                  if (not unitable^[j].uisfixed) and (not tbl[j].is_hfsunit) then
                    tbl[j].tm:=unitable^[j].tm;
                    unitable^[j].tm:=tbl[i].tm;
                 end;
end;
