%module mpfc
%include "typemaps.i"

/* typemap for WSCvariant*/
%typemap(in, numinputs=0) WSCvariant *OUTPUT(WSCvariant temp),
                          WSCvariant &OUTPUT(WSCvariant temp)
{ $1 = &temp; }
#ifdef SWIGRUBY
%typemap(argout, fragment="output_helper") WSCvariant *OUTPUT,
                                           WSCvariant &OUTPUT
{
  VALUE o = Qnil;
  WSCvariant *val = new WSCvariant(*$1);
  o = SWIG_NewPointerObj((void *)val, SWIGTYPE_p_WSCvariant, 1);
  $result = output_helper($result, o);
}
#elif SWIGPYTHON
%typemap(argout, fragment="t_output_helper") WSCvariant *OUTPUT,
                                             WSCvariant &OUTPUT
{
  PyObject *o;
  WSCvariant *val = new WSCvariant(*$1);
  o = SWIG_NewPointerObj((void *)val, SWIGTYPE_p_WSCvariant, 1);
  /* SWIG_NewPoinsterObj の第三引数が 1 だと GC 時に delete される…らしい */
  $result = t_output_helper($result, o);
}
#elif SWIGPERL
%typemap(argout) WSCvariant *OUTPUT, WSCvariant &OUTPUT {
  if (argvi >= items) {
    EXTEND(sp, 1);
  }
  $result = sv_newmortal();
  WSCvariant *val = new WSCvariant(*$1);
  SWIG_MakePtr($result, (void *)val, SWIGTYPE_p_WSCvariant,
               SWIG_SHADOW|SWIG_OWNER);
               /* swig のバージョンが低い場合は、
                * SWIG_SHADOW|SWIG_OWNER のところは 0 に
                */
  argvi++;
}
#endif

%{
#include "mpfc.h"
%}

%include "mpfc.h"

