anchor.diff:  spec_tab(Type, Tab, FieldSpec, Limit, Opts) ->
       ds_opts:setopts(Opts),
       fold_tab(fun ds:add/2, ds:new(), Type, Tab, FieldSpec, Limit).
  +
  +
  +%% Spec a disk_log; works similar to spec_tab.
  +
  +spec_disk_log(Filename, FieldSpec, Limit) ->
  +    fold_disk_log(fun ds:add/2, ds:new(), Filename, FieldSpec, Limit).
  +
  +spec_disk_log(Filename, FieldSpec, Limit, Opts) ->
  +    ds_opts:setopts(Opts),
  +    fold_disk_log(fun ds:add/2, ds:new(), Filename, FieldSpec, Limit).
  +
  +
  +%% Backend function for folding through disk_log files
  +%% Useful for Mnesia .DCD and .DCL
  +fold_disk_log(Fun, Acc0, Filename, Spec0, Limit) ->
  +    {ok, dlog} = disk_log:open([ {name, dlog}
  +                               , {file, Filename}
  +                               , {mode, read_only}
  +                               , {repair, false}
  +                               ]),
  +    Progress = progress_new(),
  +    progress_init_output(Progress),
  +    Spec = normalize_spec(Spec0),
  +    fold_disk_log(Fun, Acc0, Spec, Limit, Progress, start).
  +
  +fold_disk_log(_Fun, Acc, _Spec, 0, Progress, _Cont) ->
  +    progress_final_output(Progress),
  +    dump_acc(Acc),
  +    ok = disk_log:close(dlog),
  +    Acc;
  +fold_disk_log(Fun, Acc0, Spec, Limit, Progress0, Cont0) ->
  +    case disk_log:chunk(dlog, Cont0) of
  +        {Cont, RecL} ->
  +            RecN = length(RecL),
  +            Progress = progress_update(Progress0, Acc0, RecN),
  +            Acc = fold_kernel(Fun, Acc0, RecL, Spec),
  +            fold_disk_log(Fun, Acc, Spec, counter_dec(Limit, RecN), Progress, Cont);
  +        {Cont, RecL, BadBytes} ->
  +            io:format("disk_log: skipped ~B bad bytes~n", [BadBytes]),
  +            RecN = length(RecL),
  +            Progress = progress_update(Progress0, Acc0, RecN),
  +            Acc = fold_kernel(Fun, Acc0, RecL, Spec),
  +            fold_disk_log(Fun, Acc, Spec, counter_dec(Limit, RecN), Progress, Cont);
  +        eof -> %% trigger end clause by setting Limit to 0
  +            fold_disk_log(Fun, Acc0, Spec, 0, Progress0, undefined)
  +    end.
   
   
   %% tuple of accessor funs to iterate tables:
  
positive.code:     end.
  
  %% decrement counters that might be disabled by being set to an atom
  counter_dec(N) when is_integer(N) -> N-1;
  counter_dec(A)                    -> A.
  
  
  %% Tests
  
negative.code:     , fun mnesia:dirty_next/2
      }.
  
  %% Generic backend function for folding through tables via accessors
  fold_tab(Fun, Acc0, Type, Tab, Spec0, Limit) ->
      {FirstF, _ReadF, _NextF} = Accessors = accessors(Type),
      Progress = progress_new(),
      progress_init_output(Progress),
      Spec = normalize_spec(Spec0),
      fold_tab(Fun, Acc0, Accessors, Tab, Spec, Limit, Progress, FirstF(Tab)).
  
  fold_tab(_Fun, Acc, _Accessors, _Tab, _Spec, 0, Progress, _Key) ->
      progress_final_output(Progress),
      dump_acc(Acc),
      Acc;
  fold_tab(_Fun, Acc, _Accessors, _Tab, _Spec, _Limit, Progress, '$end_of_table') ->
      progress_final_output(Progress),
      dump_acc(Acc),
      Acc;
  fold_tab(Fun, Acc0, {_FirstF, ReadF, NextF} = Accessors,
           Tab, Spec, Limit, Progress0, Key) ->
      RecL = ReadF(Tab, Key),
      RecN = length(RecL),
      Progress = progress_update(Progress0, Acc0, RecN),
      Acc = fold_kernel(Fun, Acc0, RecL, Spec),
      fold_tab(Fun, Acc, Accessors, Tab, Spec,
               counter_dec(Limit, RecN), Progress, NextF(Tab, Key)).
  
  %% The kernel for folding a list of records into the accumulated spec
  fold_kernel(Fun, Acc0, RecL, {FieldSpec, AttrSpecs}) ->
      FoldF =
          fun(Rec, FoldAcc) ->
              %% The element accessor might crash or throw an error
              %% to exclude this instance from the spec.
              try Field = elem(FieldSpec, Rec),
                   Attrs = [{Attr, elem(AttrSpec, Rec)} || {Attr, AttrSpec} <- AttrSpecs],
                   Fun({Field, Attrs}, FoldAcc)
              catch _:_ -> FoldAcc
              end
          end,
      lists:foldl(FoldF, Acc0, RecL).
  
  elem(0, Rec) -> Rec;
  elem(F, Rec) when is_integer(F) -> element(F, Rec);
  