/* BEWARE: this is a generated file, DO NOT EDIT THIS FILE MANUALLY!!! */

/* ### BEWARE ### Ugly workaround needed for old cygwin with perl-5.10.0 */
#if !defined(MUTABLE_PTR)
#define MUTABLE_PTR(p) ((void *) (p))
#endif
/* end-of-workaround */

SV* ihandle2SV_nocreate(Ihandle* ih) {  
  SV *ptrSV, **ref;
  HV* globreg;
  char* hkey; /*string with numeric representation of canvas pointer*/

  ptrSV = newSViv(PTR2IV(ih)); 
  hkey = SvPV_nolen(ptrSV); /*xxxCHECKLATER find more effective way of converting ih > hkey*/
  
  globreg = get_hv("IUP::Internal::LibraryIup::ih_register", 0);
  /*### check if canvas pointer is present in global hash 'ih_register' */
  ref = hv_fetch(globreg, hkey, strlen(hkey), 0);
  if (ref != NULL)
    if (SvOK(*ref)) return *ref; /* return $IUP::Internal::LibraryIup::ih_register{$hkey} */
  
  /*### if not found in ih_register return undef */
  return &PL_sv_undef;
}

SV* ihandle2SV(Ihandle* ih, SV* element, char* action_related_key) { /*xxxCHECKLATER should be OK but was not tested yet*/
  SV *ptrSV, *obj, **ref;
  HV *globreg, *newhash, *element_hash, *element_cbrelated_hash;
  char* hkey; /*string with numeric representation of canvas pointer*/

  ptrSV = newSViv(PTR2IV(ih));
  hkey = SvPV_nolen(ptrSV); /*xxxCHECKLATER find more effective way of converting ih > hkey*/
  globreg = get_hv("IUP::Internal::LibraryIup::ih_register", 0);

  /*### check if canvas pointer is present in global hash 'ih_register' */
  ref = hv_fetch(globreg, hkey, strlen(hkey), 0);
  if (ref != NULL)
    if (SvOK(*ref)) return *ref; /* return $IUP::Internal::LibraryIup::ch_register{$hkey} */
  
  /*warn("***DEBUG*** need to create IUP::Internal::Element %s\n",hkey);*/
  
  /*### create new IUP::Internal::Element object based on given ihandle*/
  /* see http://stackoverflow.com/questions/1497836/how-do-i-write-a-perl-constructor-in-xs */
  newhash = (HV *)sv_2mortal((SV *)newHV());
  obj = sv_bless( newRV((SV*)newhash), gv_stashpv("IUP::Internal::Element", 1) );
  hv_store(newhash, "!int!ihandle", 12, ptrSV, 0);
  if (!SvOK(obj)) { warn("Warning: This shouldn't happen ih1\n"); return &PL_sv_undef; }

  /*### $IUP::Internal::LibraryIup::ch_register{<hkey>} = newSVsv(obj) */
  /*### weaken($IUP::Internal::LibraryIup::ch_register{<hkey>}) */
  hv_store(globreg, hkey, strlen(hkey), sv_rvweaken(newSVsv(obj)), 0); /* weaken */  

  /*### $element->{'!int!cb!<action>!related'}->{<hkey>} = newSVsv(obj) */
  element_hash = (HV*)MUTABLE_PTR(SvRV(element));
  ref = hv_fetch(element_hash, action_related_key, strlen(action_related_key), 0);
  if (ref == NULL) { warn("Warning: This shouldn't happen ih2\n"); return sv_2mortal(obj); }
  if (!SvOK(*ref)) { warn("Warning: This shouldn't happen ih3\n"); return sv_2mortal(obj); }
  element_cbrelated_hash = (HV*)MUTABLE_PTR(SvRV(*ref));
  hv_store(element_cbrelated_hash, hkey, strlen(hkey), newSVsv(obj), 0); /* nonweaken */
  
  return sv_2mortal(obj);
}

SV* canvas2SV(cdCanvas* canvas, SV* element, char* action_related_key) {
  SV *ptrSV, *obj, **ref;
  HV *globreg, *newhash, *element_hash, *element_cbrelated_hash;
  char* hkey; /*string with numeric representation of canvas pointer*/
  
  ptrSV = newSViv(PTR2IV(canvas));
  hkey = SvPV_nolen(ptrSV); /*xxxCHECKLATER find more effective way of converting ih > hkey*/
  globreg = get_hv("IUP::Internal::LibraryIup::ch_register", 0);

  /*### check if canvas pointer is present in global hash 'ch_register' */  
  ref = hv_fetch(globreg, hkey, strlen(hkey), 0);
  if (ref != NULL) 
    if (SvOK(*ref)) return *ref; /* return $IUP::Internal::LibraryIup::ch_register{<hkey>} */
  
  /*warn("***DEBUG*** need to create IUP::Internal::Canvas %s\n",hkey);*/
  
  /*### create new IUP::Internal::Canvas object based on given canvas handle*/
  /* see http://stackoverflow.com/questions/1497836/how-do-i-write-a-perl-constructor-in-xs */
  newhash = (HV *)sv_2mortal((SV *)newHV());
  obj = sv_bless( newRV((SV*)newhash), gv_stashpv("IUP::Internal::Canvas", 1) );
  hv_store(newhash, "!int!cnvhandle", 14, ptrSV, 0);
  if (!SvOK(obj)) { warn("Warning: This shouldn't happen cv1\n"); return &PL_sv_undef; }

  /*### $IUP::Internal::LibraryIup::ch_register{<hkey>} = newSVsv(obj) */
  /*### weaken($IUP::Internal::LibraryIup::ch_register{<hkey>}) */
  hv_store(globreg, hkey, strlen(hkey), sv_rvweaken(newSVsv(obj)), 0); /* weaken */  

  /*### $element->{'!int!cb!<action>!related'}->{<hkey>} = newSVsv(obj) */
  element_hash = (HV*)MUTABLE_PTR(SvRV(element));
  ref = hv_fetch(element_hash, action_related_key, strlen(action_related_key), 0);
  if (ref == NULL) { warn("Warning: This shouldn't happen cv2\n"); return sv_2mortal(obj); }
  if (!SvOK(*ref)) { warn("Warning: This shouldn't happen cv3\n"); return sv_2mortal(obj); }
  element_cbrelated_hash = (HV*)MUTABLE_PTR(SvRV(*ref));
  hv_store(element_cbrelated_hash, hkey, strlen(hkey), newSVsv(obj), 0); /* nonweaken */

  return sv_2mortal(obj);
}

int call_cb_func(SV* element, char *actionkey) {
  HV *hash;
  SV **ref;

  /* call_pv(element->{actionkey},G_ARRAY) */
  hash = (HV*)MUTABLE_PTR(SvRV(element));
  ref = hv_fetch(hash, actionkey, strlen(actionkey), 0);
  if (ref != NULL)
    if (SvOK(*ref)) return call_sv(*ref,G_ARRAY); /*xxxCHECKLATER better would be to test blessed(*ref)*/
  warn("Warning: callback failed, $element->{'%s'} undefined\n");
  return 0;
}

int
internal_cb_ACTION_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BUTTON_CB_iiiis (Ihandle* ih,int button,int pressed,int x,int y,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(button)));
  	XPUSHs(sv_2mortal(newSViv(pressed)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BUTTON_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAW_CB_iiiiiiv (Ihandle* ih,int line,int column,int xmin,int xmax,int ymin,int ymax,cdCanvas* canvas)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_cnv7() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	XPUSHs(sv_2mortal(newSViv(xmin)));
  	XPUSHs(sv_2mortal(newSViv(xmax)));
  	XPUSHs(sv_2mortal(newSViv(ymin)));
  	XPUSHs(sv_2mortal(newSViv(ymax)));
  	XPUSHs(canvas2SV(canvas, element, "!int!cb!DRAW_CB!related"));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_HEIGHT_CB_i (Ihandle* ih,int line)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!HEIGHT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_HSPAN_CB_ii (Ihandle* ih,int line,int column)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!HSPAN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOUSECLICK_CB_iiiiiis (Ihandle* ih,int button,int pressed,int line,int column,int x,int y,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(button)));
  	XPUSHs(sv_2mortal(newSViv(pressed)));
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOUSECLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOUSEMOTION_CB_iiiis (Ihandle* ih,int line,int column,int x,int y,char* r)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(r, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOUSEMOTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_NCOLS_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!NCOLS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_NLINES_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!NLINES_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SCROLLING_CB_ii (Ihandle* ih,int line,int column)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SCROLLING_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_VSPAN_CB_ii (Ihandle* ih,int line,int column)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(line)));
  	XPUSHs(sv_2mortal(newSViv(column)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!VSPAN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_WIDTH_CB_i (Ihandle* ih,int column)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(column)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!WIDTH_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

char*
internal_cb_CELL_CB_i (Ihandle* ih,int cell)
{
	dSP;
	int count;
	char* rv;
	
	SV* element;

  
	rv = NULL;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(cell)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CELL_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  rv = POPpx;
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EXTENDED_CB_i (Ihandle* ih,int cell)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(cell)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EXTENDED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SELECT_CB_ii (Ihandle* ih,int cell,int type)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(cell)));
  	XPUSHs(sv_2mortal(newSViv(type)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SELECT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SWITCH_CB_ii (Ihandle* ih,int prim_cell,int sec_cell)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(prim_cell)));
  	XPUSHs(sv_2mortal(newSViv(sec_cell)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SWITCH_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_CHANGE_CB_ccc (Ihandle* ih,unsigned char r,unsigned char g,unsigned char b)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(r)));
  	XPUSHs(sv_2mortal(newSViv(g)));
  	XPUSHs(sv_2mortal(newSViv(b)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CHANGE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAG_CB_ccc (Ihandle* ih,unsigned char r,unsigned char g,unsigned char b)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(r)));
  	XPUSHs(sv_2mortal(newSViv(g)));
  	XPUSHs(sv_2mortal(newSViv(b)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAG_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_VALUECHANGED_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!VALUECHANGED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BUTTON_PRESS_CB_d (Ihandle* ih,double angle)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVnv(angle)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BUTTON_PRESS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BUTTON_RELEASE_CB_d (Ihandle* ih,double angle)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVnv(angle)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BUTTON_RELEASE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOUSEMOVE_CB_d (Ihandle* ih,double angle)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVnv(angle)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOUSEMOVE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_FILE_CB_ss (Ihandle* ih,const char* file_name,const char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(file_name, 0)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!FILE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_HIGHLIGHT_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!HIGHLIGHT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_s (Ihandle* ih,char* url)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(url, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_sii (Ihandle* ih,char* text,int item,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(text, 0)));
  	XPUSHs(sv_2mortal(newSViv(item)));
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_CARET_CB_iii (Ihandle* ih,int lin,int col,int pos)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(pos)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CARET_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DBLCLICK_CB_is (Ihandle* ih,int item,char* text)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(item)));
  	XPUSHs(sv_2mortal(newSVpv(text, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DBLCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAGDROP_CB_iiii (Ihandle* ih,int drag_id,int drop_id,int isshift,int iscontrol)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(drag_id)));
  	XPUSHs(sv_2mortal(newSViv(drop_id)));
  	XPUSHs(sv_2mortal(newSViv(isshift)));
  	XPUSHs(sv_2mortal(newSViv(iscontrol)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAGDROP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPDOWN_CB_i (Ihandle* ih,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPDOWN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EDIT_CB_is (Ihandle* ih,int c,char* new_value)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(c)));
  	XPUSHs(sv_2mortal(newSVpv(new_value, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EDIT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOTION_CB_iis (Ihandle* ih,int x,int y,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MULTISELECT_CB_s (Ihandle* ih,char* value)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(value, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MULTISELECT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_CB_iiiis (Ihandle* ih,int c,int lin,int col,int edition,char* after)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(c)));
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(edition)));
  	XPUSHs(sv_2mortal(newSVpv(after, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BGCOLOR_CB_iiIII (Ihandle* ih,int lin,int col,unsigned int* red,unsigned int* green,unsigned int* blue)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BGCOLOR_CB!func");

	SPAGAIN;

	if (count != 4) { warn("Warning: callback BGCOLOR_CB has returned %d instead of 4 values!\n",count); }
	else {
	  *blue = POPi;
	  *green = POPi;
	  *red = POPi;
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_CLICK_CB_iis (Ihandle* ih,int lin,int col,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_COLRESIZE_CB_i (Ihandle* ih,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!COLRESIZE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPCHECK_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPCHECK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPSELECT_CB_iinsii (Ihandle* ih,int lin,int col,Ihandle* drop,char* t,int i,int v)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_ih3() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(ihandle2SV(drop, element, "!int!cb!DROPSELECT_CB!related"));
  	XPUSHs(sv_2mortal(newSVpv(t, 0)));
  	XPUSHs(sv_2mortal(newSViv(i)));
  	XPUSHs(sv_2mortal(newSViv(v)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPSELECT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROP_CB_nii (Ihandle* ih,Ihandle* drop,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_ih1() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(ihandle2SV(drop, element, "!int!cb!DROP_CB!related"));
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EDITION_CB_iiii (Ihandle* ih,int lin,int col,int mode,int update)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(mode)));
  	XPUSHs(sv_2mortal(newSViv(update)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EDITION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ENTERITEM_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ENTERITEM_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_FGCOLOR_CB_iiIII (Ihandle* ih,int lin,int col,unsigned int* red,unsigned int* green,unsigned int* blue)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!FGCOLOR_CB!func");

	SPAGAIN;

	if (count != 4) { warn("Warning: callback FGCOLOR_CB has returned %d instead of 4 values!\n",count); }
	else {
	  *blue = POPi;
	  *green = POPi;
	  *red = POPi;
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

char*
internal_cb_FONT_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	char* rv;
	
	SV* element;

  
	rv = NULL;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!FONT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  rv = POPpx;
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LEAVEITEM_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LEAVEITEM_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MARKEDIT_CB_iii (Ihandle* ih,int lin,int col,int marked)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(marked)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MARKEDIT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MARK_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MARK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MENUDROP_CB_nii (Ihandle* ih,Ihandle* drop,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(ihandle2SV(drop, element, "!int!cb!MENUDROP_CB!related"));
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MENUDROP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOUSEMOVE_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOUSEMOVE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_RELEASE_CB_iis (Ihandle* ih,int lin,int col,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!RELEASE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SCROLLTOP_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SCROLLTOP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TOGGLEVALUE_CB_iii (Ihandle* ih,int lin,int col,int status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(status)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TOGGLEVALUE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

char*
internal_cb_TYPE_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	char* rv;
	
	SV* element;

  
	rv = NULL;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TYPE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  rv = POPpx;
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

char*
internal_cb_VALUE_CB_ii (Ihandle* ih,int lin,int col)
{
	dSP;
	int count;
	char* rv;
	
	SV* element;

  
	rv = NULL;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!VALUE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  rv = POPpx;
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_VALUE_EDIT_CB_iis (Ihandle* ih,int lin,int col,char* newval)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(newval, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!VALUE_EDIT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_IMAGEVALUECHANGED_CB_ii (Ihandle* ih,int lin,int imagevalue)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(imagevalue)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!IMAGEVALUECHANGED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTACTION_CB_ii (Ihandle* ih,int item,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(item)));
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTACTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTCLICK_CB_iis (Ihandle* ih,int lin,int col,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTDRAW_CB_iiiiiiv (Ihandle* ih,int lin,int col,int x1,int x2,int y1,int y2,cdCanvas* cnv)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(x1)));
  	XPUSHs(sv_2mortal(newSViv(x2)));
  	XPUSHs(sv_2mortal(newSViv(y1)));
  	XPUSHs(sv_2mortal(newSViv(y2)));
  	XPUSHs(canvas2SV(cnv, element, "!int!cb!LISTDRAW_CB!related"));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTDRAW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTEDITION_CB_iiii (Ihandle* ih,int lin,int col,int mode,int update)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSViv(mode)));
  	XPUSHs(sv_2mortal(newSViv(update)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTEDITION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTINSERT_CB_i (Ihandle* ih,int lin)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTINSERT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTRELEASE_CB_iis (Ihandle* ih,int lin,int col,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTRELEASE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LISTREMOVE_CB_i (Ihandle* ih,int lin)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LISTREMOVE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MENUCLOSE_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MENUCLOSE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_OPEN_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!OPEN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DELETEBEGIN_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DELETEBEGIN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DELETEEND_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DELETEEND_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DELETE_CB_iiff (Ihandle* ih,int index,int sample_index,float x,float y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(index)));
  	XPUSHs(sv_2mortal(newSViv(sample_index)));
  	XPUSHs(sv_2mortal(newSVnv(x)));
  	XPUSHs(sv_2mortal(newSVnv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DELETE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EDITBEGIN_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EDITBEGIN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EDITEND_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EDITEND_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EDIT_CB_iiffFF (Ihandle* ih,int index,int sample_index,float x,float y,float* new_x,float* new_y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(index)));
  	XPUSHs(sv_2mortal(newSViv(sample_index)));
  	XPUSHs(sv_2mortal(newSVnv(x)));
  	XPUSHs(sv_2mortal(newSVnv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EDIT_CB!func");

	SPAGAIN;

	if (count != 3) { warn("Warning: callback EDIT_CB has returned %d instead of 3 values!\n",count); }
	else {
	  *new_y = POPn;
	  *new_x = POPn;
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_POSTDRAW_CB_v (Ihandle* ih,cdCanvas* cnv)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_cnv1() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(canvas2SV(cnv, element, "!int!cb!POSTDRAW_CB!related"));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!POSTDRAW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_PREDRAW_CB_v (Ihandle* ih,cdCanvas* cnv)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_cnv1() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(canvas2SV(cnv, element, "!int!cb!PREDRAW_CB!related"));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!PREDRAW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SELECTBEGIN_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SELECTBEGIN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SELECTEND_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SELECTEND_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SELECT_CB_iiffi (Ihandle* ih,int index,int sample_index,float x,float y,int select)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(index)));
  	XPUSHs(sv_2mortal(newSViv(sample_index)));
  	XPUSHs(sv_2mortal(newSVnv(x)));
  	XPUSHs(sv_2mortal(newSVnv(y)));
  	XPUSHs(sv_2mortal(newSViv(select)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SELECT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_CANCEL_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CANCEL_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_iiis (Ihandle* ih,int insert,int pos,int length,char* text)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(insert)));
  	XPUSHs(sv_2mortal(newSViv(pos)));
  	XPUSHs(sv_2mortal(newSViv(length)));
  	XPUSHs(sv_2mortal(newSVpv(text, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_AUTOCCANCELLED_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!AUTOCCANCELLED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_AUTOCCHARDELETED_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!AUTOCCHARDELETED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_AUTOCSELECTION_CB_is (Ihandle* ih,int pos,char* text)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(pos)));
  	XPUSHs(sv_2mortal(newSVpv(text, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!AUTOCSELECTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPFILES_CB_siii (Ihandle* ih,const char* filename,int num,int x,int y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(filename, 0)));
  	XPUSHs(sv_2mortal(newSViv(num)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPFILES_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_HOTSPOTCLICK_CB_iiis (Ihandle* ih,int pos,int lin,int col,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(pos)));
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSViv(col)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!HOTSPOTCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MARGINCLICK_CB_iis (Ihandle* ih,int margin,int lin,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(margin)));
  	XPUSHs(sv_2mortal(newSViv(lin)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MARGINCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SAVEPOINT_CB_i (Ihandle* ih,int status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(status)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SAVEPOINT_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ZOOM_CB_i (Ihandle* ih,int zoomInPoints)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(zoomInPoints)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ZOOM_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SPIN_CB_i (Ihandle* ih,int inc)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(inc)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SPIN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TABCHANGEPOS_CB_ii (Ihandle* ih,int new_pos,int old_pos)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(new_pos)));
  	XPUSHs(sv_2mortal(newSViv(old_pos)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TABCHANGEPOS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TABCHANGE_CB_nn (Ihandle* ih,Ihandle* new_tab,Ihandle* old_tab)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb_ih12() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(ihandle2SV(new_tab, element, "!int!cb!TABCHANGE_CB!related"));
  	XPUSHs(ihandle2SV(old_tab, element, "!int!cb!TABCHANGE_CB!related"));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TABCHANGE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_is (Ihandle* ih,int c,char* new_value)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(c)));
  	XPUSHs(sv_2mortal(newSVpv(new_value, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_i (Ihandle* ih,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BRANCHCLOSE_CB_i (Ihandle* ih,int id)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BRANCHCLOSE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_BRANCHOPEN_CB_i (Ihandle* ih,int id)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!BRANCHOPEN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_EXECUTELEAF_CB_i (Ihandle* ih,int id)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!EXECUTELEAF_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MULTISELECTION_CB_Ai (Ihandle* ih,int* ids,int n)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  	int loc_i;
  	AV * r_ids;
  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	r_ids = newAV();
  	for(loc_i=0; loc_i<n; loc_i++) av_push(r_ids, newSViv(ids[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_ids)));
  	XPUSHs(sv_2mortal(newSViv(n)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MULTISELECTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MULTIUNSELECTION_CB_Ai (Ihandle* ih,int* ids,int n)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  	int loc_i;
  	AV * r_ids;
  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	r_ids = newAV();
  	for(loc_i=0; loc_i<n; loc_i++) av_push(r_ids, newSViv(ids[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_ids)));
  	XPUSHs(sv_2mortal(newSViv(n)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MULTIUNSELECTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_NODEREMOVED_CB_U (Ihandle* ih,void* userdata)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

	SV * SV_userdata, **SV_ref;
	char * hkey_userdata;
	HV *element_hash;

	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
       /* converting userdata to  $self->{'!int!treedata'}->{$userdata_pointer} */
	SV_userdata = newSViv(PTR2IV(userdata));
	hkey_userdata = SvPV_nolen(SV_userdata); /*xxxCHECKLATER find more effective way*/
	element_hash = (HV*)MUTABLE_PTR(SvRV(element));
	SV_ref = hv_fetch(element_hash, "!int!treedata", 13, 0);
	if ((SV_ref == NULL) || !SvOK(*SV_ref)) {
	  warn("Warning: This shouldn't happen NODEREMOVED_CB/1\n"); 
	  XPUSHs(&PL_sv_undef);
	}
	else {
	  element_hash = (HV*)MUTABLE_PTR(SvRV(*SV_ref));
	  SV_ref = hv_fetch(element_hash, hkey_userdata, strlen(hkey_userdata), 0);
	  if ((SV_ref == NULL) || !SvOK(*SV_ref)) {
	    warn("Warning: This shouldn't happen NODEREMOVED_CB/2\n"); 
	    XPUSHs(&PL_sv_undef);
	  }
          else XPUSHs(*SV_ref);
        }        
        /* converting userdata - done */
	PUTBACK;

	count = call_cb_func(element,"!int!cb!NODEREMOVED_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_RENAME_CB_is (Ihandle* ih,int id,char* title)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	XPUSHs(sv_2mortal(newSVpv(title, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!RENAME_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_RIGHTCLICK_CB_i (Ihandle* ih,int id)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!RIGHTCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SELECTION_CB_ii (Ihandle* ih,int id,int status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	XPUSHs(sv_2mortal(newSViv(status)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SELECTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SHOWRENAME_CB_i (Ihandle* ih,int id)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SHOWRENAME_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TOGGLEVALUE_CB_ii (Ihandle* ih,int id,int status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	XPUSHs(sv_2mortal(newSViv(status)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TOGGLEVALUE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ENTERWINDOW_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ENTERWINDOW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_GETFOCUS_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!GETFOCUS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_HELP_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!HELP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_KILLFOCUS_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!KILLFOCUS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_K_ANY_i (Ihandle* ih,int c)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(c)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!K_ANY!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_LEAVEWINDOW_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!LEAVEWINDOW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MAP_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MAP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TIPS_CB_ii (Ihandle* ih,int x,int y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TIPS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_UNMAP_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!UNMAP_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_ACTION_ff (Ihandle* ih,float posx,float posy)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVnv(posx)));
  	XPUSHs(sv_2mortal(newSVnv(posy)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!ACTION!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_FOCUS_CB_i (Ihandle* ih,int focus)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(focus)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!FOCUS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_KEYPRESS_CB_ii (Ihandle* ih,int c,int press)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(c)));
  	XPUSHs(sv_2mortal(newSViv(press)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!KEYPRESS_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MULTITOUCH_CB_iAAAA (Ihandle* ih,int count_,int* pid,int* px,int* py,int* pstate)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  	int loc_i;
  	AV * r_pid;
  	AV * r_px;
  	AV * r_py;
  	AV * r_pstate;
  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(count_)));
  	r_pid = newAV();
  	r_pid = (AV *)sv_2mortal((SV *)newAV());
  	for(loc_i=0; loc_i<count_; loc_i++) av_push(r_pid, newSViv(pid[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_pid)));
  	r_px = newAV();
  	r_px = (AV *)sv_2mortal((SV *)newAV());
  	for(loc_i=0; loc_i<count_; loc_i++) av_push(r_px, newSViv(px[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_px)));
  	r_py = newAV();
  	r_py = (AV *)sv_2mortal((SV *)newAV());
  	for(loc_i=0; loc_i<count_; loc_i++) av_push(r_py, newSViv(py[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_py)));
  	r_pstate = newAV();
  	r_pstate = (AV *)sv_2mortal((SV *)newAV());
  	for(loc_i=0; loc_i<count_; loc_i++) av_push(r_pstate, newSViv(pstate[loc_i]));
  	XPUSHs(sv_2mortal(newRV_noinc((SV *)r_pstate)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MULTITOUCH_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_RESIZE_CB_ii (Ihandle* ih,int width,int height)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(width)));
  	XPUSHs(sv_2mortal(newSViv(height)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!RESIZE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SCROLL_CB_iff (Ihandle* ih,int op,float posx,float posy)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(op)));
  	XPUSHs(sv_2mortal(newSVnv(posx)));
  	XPUSHs(sv_2mortal(newSVnv(posy)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SCROLL_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TOUCH_CB_iiis (Ihandle* ih,int id,int x,int y,char* state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(id)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(state, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TOUCH_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_WHEEL_CB_fiis (Ihandle* ih,float delta,int x,int y,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVnv(delta)));
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!WHEEL_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_WOM_CB_i (Ihandle* ih,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!WOM_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_CLOSE_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!CLOSE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_COPYDATA_CB_si (Ihandle* ih,char* cmdLine,int size)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(cmdLine, 0)));
  	XPUSHs(sv_2mortal(newSViv(size)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!COPYDATA_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MDIACTIVATE_CB_ (Ihandle* ih)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MDIACTIVATE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_MOVE_CB_ii (Ihandle* ih,int x,int y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!MOVE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_SHOW_CB_i (Ihandle* ih,int state)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(state)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!SHOW_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_TRAYCLICK_CB_iii (Ihandle* ih,int but,int pressed,int dclick)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(but)));
  	XPUSHs(sv_2mortal(newSViv(pressed)));
  	XPUSHs(sv_2mortal(newSViv(dclick)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!TRAYCLICK_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAGBEGIN_CB_ii (Ihandle* ih,int x,int y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAGBEGIN_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAGDATASIZE_CB_s (Ihandle* ih,char* type)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSVpv(type, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAGDATASIZE_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAGDATA_CB_sUi (Ihandle* ih,char* type,void* data,int size)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  	SV * SV_data;
  	char * data_ptr=NULL;
  	STRLEN data_len=0;
  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
	XPUSHs(sv_2mortal(newSVpv(type, 0)));
	XPUSHs(sv_2mortal(newSViv(size)));
	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAGDATA_CB!func");

	SPAGAIN;

	Zero(data, size, void);
	if (count != 2) { warn("Warning: callback DRAGDATA_CB has returned %d instead of 2 values!\n",count); }
	else {
	  SV_data = POPs;
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	  if (SvOK(SV_data)) {
	    data_ptr = SvPVbyte(SV_data, data_len); 
	    Copy(data_ptr, data, data_len > size ? size : data_len, void);
	  }
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DRAGEND_CB_i (Ihandle* ih,int action)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(action)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DRAGEND_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPDATA_CB_sUiii (Ihandle* ih,char* type,void* data,int size,int x,int y)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
	XPUSHs(sv_2mortal(newSVpv(type, 0)));
	XPUSHs(sv_2mortal(newSVpvn(data, size)));
	XPUSHs(sv_2mortal(newSViv(x)));
	XPUSHs(sv_2mortal(newSViv(y)));
	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPDATA_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

int
internal_cb_DROPMOTION_CB_iis (Ihandle* ih,int x,int y,char* status)
{
	dSP;
	int count;
	int rv;
	SV * SV_rv;
	SV* element;

  
	rv = IUP_DEFAULT;
	element = ihandle2SV_nocreate(ih);
	if(!SvOK(element)) {
	  warn("Warning: callback  - cannot convert ihandle!\n");
	  return rv;
	}

	ENTER;
	SAVETMPS;

	/* push params for _execute_cb() */
	PUSHMARK(SP);
	XPUSHs(element);
  	XPUSHs(sv_2mortal(newSViv(x)));
  	XPUSHs(sv_2mortal(newSViv(y)));
  	XPUSHs(sv_2mortal(newSVpv(status, 0)));
  	PUTBACK;

	count = call_cb_func(element,"!int!cb!DROPMOTION_CB!func");

	SPAGAIN;

	if (count != 1) { /* no warning, use default retval */ }
	else {
	  SV_rv = POPs;
	  if (SvOK(SV_rv)) rv = SvIV(SV_rv);
	}

	PUTBACK;
	FREETMPS;
	LEAVE;
	
	return rv;
} 

