function [res, flopcnt, err] = gen_proccall (what, how, how_init);
%GEN_PROCCALL
%       [res, flopcnt, err] = gen_proccall (what, how, how_init);
%
%       gets test data, init data, and calls the appropriate procedure.
%       assumes err = TRUE if step > 99.
%
  X = gen_points (what);
  [z, a, b, alpha] = gen_initdata (X, how_init);

  flops (0);
  if     (strcmp(how, 'pare_gauss')),
    [z, a, b, alpha, phi, step] = pare (X, z, a, b, alpha, 0, 0);
  elseif (strcmp(how, 'pare_newton')),
    [z, a, b, alpha, phi, step] = pare (X, z, a, b, alpha, 1, 0);
  elseif (strcmp(how, 'pare_marq')),
    [z, a, b, alpha, phi, step] = pare (X, z, a, b, alpha, 2, 0);
  elseif (strcmp(how, 'pare_varpro')),
    [z, a, b, alpha, phi, step] = pare_varpro (X, z, a, b, alpha, 0);
  elseif (strcmp(how, 'alge_odr')),
    [z, a, b, alpha, step] = alge_odr (X, z, a, b, alpha, 0);
  else
    error ('unknown procedure');
  end
  
  if (step > 99),
    flopcnt = -1;
    err = 1;
    res = -1;
  else
    flopcnt = flops;
    err = 0;
    res = norm (ellipse_residual (X, z, a, b, alpha));
  end

end % gen_proccall    

