/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include <stdarg.h>

double sum2(int param, ...) {
  va_list ap;

  int ii, ii2;
  float ff, ff2;
  double dd, dd2, retval = 0;

  if (param <= 0) return retval;
  va_start(ap, param);
  if (param >= 1) {
     ii = va_arg(ap, int);
     retval += ii;
   }
   if (param >= 2) {
     ii2 = va_arg(ap, int);
     retval += ii2;
   }
   if (param >= 3) {
     ff = va_arg(ap, double);
     retval += ff;
   }
   if (param >= 4) {
     ff2 = va_arg(ap, double);
     retval += ff2;
   }
   if (param >= 5) {
     dd = va_arg(ap, double);
     retval += dd;
   }
   if (param >= 6) {
     dd2 = va_arg(ap, double);
     retval += dd2;
   }
  va_end(ap);
  return retval;
}

