/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
#include <stdio.h>
#include <ch.h>
#include "sampclass.h"

/****** member functions of Class1 ******/

EXPORTCH void Class1_Class1_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;
  class Class1 *c;
  int vacount;
  int i;
  double d;

  Ch_VaStart(interp, ap, varg);
  vacount = Ch_VaCount(interp, ap);
  if(vacount ==0)
      c = new Class1();
  else if(vacount ==1) {
      i = Ch_VaArg(interp, ap, int);
      c = new Class1(i);
  }
  else if(vacount ==2) {
      i = Ch_VaArg(interp, ap, int);
      d = Ch_VaArg(interp, ap, double);
      c = new Class1(i, d);
  }
  Ch_CppChangeThisPointer(interp, c, sizeof(Class1));
  Ch_VaEnd(interp, ap);
}

EXPORTCH void Class1_dClass1_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;
  class Class1 *c;

  Ch_VaStart(interp, ap, varg);
  c = Ch_VaArg(interp, ap, class Class1 *);
  if(Ch_CppIsArrayElement(interp))
    c->~Class1();        
  else
    delete c;
  Ch_VaEnd(interp, ap);
  return;
}
