IUP

 view release on metacpan or  search on metacpan

lib/IUP/Internal/LibraryIup.xs  view on Meta::CPAN

static int cb_idle_action() {  
  dMY_CXT;
  dSP;
  int count, ret;
  
  ENTER;
  SAVETMPS;
    
  PUSHMARK(SP);  
  count = call_sv(MY_CXT.idle_action,G_SCALAR|G_NOARGS);

  SPAGAIN;

  if (count != 1) croak("Error: Idle's action has not returned single scalar value!\n");
  ret = POPi;

  PUTBACK;

  FREETMPS;
  LEAVE;

  return ret;
}


#include "Callback.c.inc"
#include "Canvas.c.inc"

MODULE = IUP        PACKAGE = IUP

#XXX-TODO move some functions from IUP.pm here

INCLUDE: Callback.xs.inc
INCLUDE: Canvas.xs.inc
INCLUDE: Canvas_Bitmap.xs.inc
INCLUDE: Canvas_Palette.xs.inc
INCLUDE: Canvas_Pattern.xs.inc
INCLUDE: Canvas_Stipple.xs.inc 
INCLUDE: Canvas_InternalServerImage.xs.inc

MODULE = IUP::Internal::LibraryIup        PACKAGE = IUP::Internal::LibraryIup

BOOT:
    {
        MY_CXT_INIT;
        MY_CXT.idle_action = newSVsv(&PL_sv_undef);
    }

void
CLONE(...)
    CODE:
    {
        MY_CXT_CLONE;
        MY_CXT.idle_action = newSVsv(&PL_sv_undef);
    }

################################################################################
void
_SetIdle(func)
                SV* func;
        PPCODE:
        {
                dMY_CXT;
                XPUSHs(sv_2mortal(newSVsv(MY_CXT.idle_action))); /* return the old value */
                SvSetSV(MY_CXT.idle_action, func);
                if (SvOK(func)) {
                  IupSetFunction("IDLE_ACTION", (Icallback)cb_idle_action);
                }
                else {
                  IupSetFunction("IDLE_ACTION", (Icallback)NULL);
                }
        }

################################################################################ iup.h

#### Original C function from <iup.h>
# void IupClose (void);
void
_IupClose()
        CODE:
                IupClose();

#### Original C function from <iup.h>
# IupOpen(NULL, NULL);
int
_IupOpen()
        CODE:
                RETVAL = IupOpen(NULL,NULL);
                IupSetGlobal("UTF8MODE", "YES");
                IupSetGlobal("UTF8MODE_FILE", "YES");
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# void IupImageLibOpen (void);
void
_IupImageLibOpen()
        CODE:
#ifdef HAVELIB_IUPIMGLIB
                IupImageLibOpen();
#endif

#### Original C function from <iup.h>
# int IupMainLoop (void);
int
_IupMainLoop()
        CODE:
                RETVAL = IupMainLoop();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupLoopStep (void);
int
_IupLoopStep()
        CODE:
                RETVAL = IupLoopStep();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>

lib/IUP/Internal/LibraryIup.xs  view on Meta::CPAN

                RETVAL

#### Original C function from <iup.h>
# void IupSetAttributeHandle(Ihandle* ih, const char* name, Ihandle* ih_named);
void
_IupSetAttributeHandle(ih,name,ih_named)
                Ihandle* ih;
                const char* name;
                Ihandle* ih_named;
        CODE:
                //xxx warn("#XS# ih='%p' name='%s' ih_named='%p'", ih, name, ih_named);
                IupSetAttributeHandle(ih,name,ih_named);

#### Original C function from <iup.h>
# Ihandle* IupGetAttributeHandle(Ihandle* ih, const char* name);
Ihandle*
_IupGetAttributeHandle(ih,name)
                Ihandle* ih;
                const char* name;
        CODE:
                RETVAL = IupGetAttributeHandle(ih,name);                
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# char* IupGetClassName(Ihandle* ih);
char*
_IupGetClassName(ih)
                Ihandle* ih;
        CODE:
                RETVAL = IupGetClassName(ih);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# char* IupGetClassType(Ihandle* ih);
char*
_IupGetClassType(ih)
                Ihandle* ih;
        CODE:
                RETVAL = IupGetClassType(ih);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# void IupCopyClassAttributes(Ihandle* src_ih, Ihandle* dst_ih);
void
_IupCopyClassAttributes(src_ih,dst_ih)
                Ihandle* src_ih;
                Ihandle* dst_ih;
        CODE:
                IupCopyClassAttributes(src_ih,dst_ih);

#### Original C function from <iup.h>
# int IupGetAllClasses(char** names, int max_n);
void
_IupGetAllClasses(...)
        INIT:
                int i, rv, count, max_n;
                char** list = NULL;                  
        PPCODE:
                max_n = myST2INT(1);
                count = IupGetAllClasses(NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetAllClasses(list,count);
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<count; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# void IupSaveClassAttributes(Ihandle* ih);
void
_IupSaveClassAttributes(ih)
                Ihandle* ih;
        CODE:
                IupSaveClassAttributes(ih);

#### Original C function from <iup.h>
# void IupSetClassDefaultAttribute(const char* classname, const char *name, const char* value);
void
_IupSetClassDefaultAttribute(classname,name,value)
                char* classname;
                char* name;
                char* value;
        CODE:
                IupSetClassDefaultAttribute(classname,name,value);

#### Original C function from <iup.h>
# Ihandle* IupFill (void);
Ihandle*
_IupFill()
        CODE:
                RETVAL = IupFill();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupRadio (Ihandle* child);
Ihandle*
_IupRadio(child)
                Ihandle* child;
        CODE:
                RETVAL = IupRadio(child);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupNormalizer (Ihandle* ih_first, ...);
Ihandle*
_IupNormalizer(...)
        PREINIT:
                int i;
        CODE:
                if (items>1) {
                  Ihandle** pointers = malloc( (items+1) * sizeof(void*) );                  
                  for(i=0; i<items; i++) pointers[i] = mySV2IHN(ST(i));

lib/IUP/Internal/LibraryIup.xs  view on Meta::CPAN

                  for(i=0; i<items; i++) pointers[i] = mySV2IHN(ST(i));
                  pointers[i] = NULL;
                  RETVAL = IupTabsv(pointers);
                  free(pointers);                  
                }
                else if (items==1) RETVAL = SvOK(ST(0)) ? IupTabs(mySV2IHN(ST(0)), NULL) : NULL;
                else RETVAL = IupTabs(NULL);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupTree (void);
Ihandle*
_IupTree()
        CODE:
                RETVAL = IupTree();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupSpin (void);
Ihandle*
_IupSpin()
        CODE:
                RETVAL = IupSpin();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupSpinbox (Ihandle* child);
Ihandle*
_IupSpinbox(child)
                Ihandle* child;
        CODE:
                RETVAL = IupSpinbox(child);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupSaveImageAsText(Ihandle* ih, const char* file_name, const char* format, const char* name);
int
_IupSaveImageAsText(ih,file_name,format,name)
                Ihandle* ih;
                const char* file_name;
                const char* format;
                const char* name;
        CODE:
                RETVAL = IupSaveImageAsText(ih,file_name,format,name);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# void IupTextConvertLinColToPos(Ihandle* ih, int lin, int col, int *pos);
void
_IupTextConvertLinColToPos(ih,lin,col,pos)
                Ihandle* ih;
                int lin;
                int col;
        INIT:
                int pos;
        PPCODE:
                IupTextConvertLinColToPos(ih,lin,col,&pos);
                XPUSHs(sv_2mortal(newSViv(pos)));

#### Original C function from <iup.h>
# void IupTextConvertPosToLinCol(Ihandle* ih, int pos, int *lin, int *col);
void
_IupTextConvertPosToLinCol(ih,pos)
                Ihandle* ih;
                int pos;
        INIT:
                int lin;
                int col;
        PPCODE:
                IupTextConvertPosToLinCol(ih,pos,&lin,&col);
                XPUSHs(sv_2mortal(newSViv(lin)));
                XPUSHs(sv_2mortal(newSViv(col)));


#### Original C function from <iup.h>
# int IupConvertXYToPos(Ihandle* ih, int x, int y);
int
_IupConvertXYToPos(ih,x,y)
                Ihandle* ih;
                int x;
                int y;
        CODE:
                RETVAL = IupConvertXYToPos(ih,x,y);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupTreeSetUserId(Ihandle* ih, int id, void* userid);
int
_IupTreeSetUserId(ih,id,userid)
                Ihandle* ih;
                int id;
                SV* userid;
        CODE:
                RETVAL = IupTreeSetUserId(ih,id,INT2PTR(void*, SvIVX(userid)));
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# void* IupTreeGetUserId(Ihandle* ih, int id);
void
_IupTreeGetUserId(ih,id)
                Ihandle* ih;
                int id;
        INIT:
                void* ptr;
        PPCODE:
                ptr = IupTreeGetUserId(ih,id);
                if (ptr==NULL) XPUSHs(sv_2mortal(newSVpv(NULL,0))); /* undef xxxcheckthis */ 
                else XPUSHs(sv_2mortal(newSViv(PTR2IV(ptr))));

#### Original C function from <iup.h>
# int IupTreeGetId(Ihandle* ih, void *userid);
int
_IupTreeGetId(ih,userid)
                Ihandle* ih;
                SV* userid;
        CODE:
                RETVAL = IupTreeGetId(ih,INT2PTR(void*, SvIVX(userid)));
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupLayoutDialog(Ihandle* dialog);
Ihandle*
_IupLayoutDialog(dialog)
                Ihandle* dialog;
        CODE:
                RETVAL = IupLayoutDialog(dialog);
        OUTPUT:
                RETVAL


#### Original C function from <iup.h>
# Ihandle* IupFileDlg(void);
Ihandle*
_IupFileDlg()
        CODE:
                RETVAL = IupFileDlg();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupMessageDlg(void);
Ihandle*
_IupMessageDlg()
        CODE:
                RETVAL = IupMessageDlg();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupColorDlg(void);
Ihandle*
_IupColorDlg()
        CODE:
                RETVAL = IupColorDlg();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupFontDlg(void);
Ihandle*
_IupFontDlg()
        CODE:
                RETVAL = IupFontDlg();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# Ihandle* IupProgressDlg(void);
Ihandle*
_IupProgressDlg()
        CODE:
                RETVAL = IupProgressDlg();
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupGetFile(char *arq);
void
_IupGetFile(arq)
                char* arq;
        INIT:
                int rv;
                char tmp[MAXPATHLEN];
                /* somehow handle the situation when arq is longer then MAXPATHLEN-1 */
                tmp[MAXPATHLEN-1] = 0;
                if (arq) strncpy(tmp,arq,MAXPATHLEN-1);
        PPCODE:
                rv = IupGetFile(tmp);
                /*warn("rv=%d a=%s", rv, tmp);*/
                /* gonna return array: (retval, filename) */
                XPUSHs(sv_2mortal(newSViv(rv)));
                if (rv == -1)
                  XPUSHs(sv_2mortal(newSVpv(NULL,0))); /* undef */
                else
                  XPUSHs(sv_2mortal(newSVpvn_utf8(tmp, strlen(tmp), 1)));  /* XPUSHs(sv_2mortal(newSVpv(tmp,0))); */

#### Original C function from <iup.h>
# void IupMessage(const char *title, const char *msg);
void
_IupMessage(title,msg)
                const char* title;
                const char* msg;
        CODE:
                IupMessage(title,msg);

#### Original C function from <iup.h>
# int IupAlarm(const char *title, const char *msg, const char *b1, const char *b2, const char *b3);
int
_IupAlarm(title,msg,b1,b2,b3)
                const char* title;
                const char* msg;
                const char* b1;
                const char* b2;
                const char* b3;
        CODE:
                RETVAL = IupAlarm(title,msg,b1,b2,b3);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupGetText(const char* title, char* text);
void
_IupGetText(title,text)
                char* title;
                char* text;
        INIT:
                int rv;
                char newtext[10001]; /* xxx hardcoded length */ 
        PPCODE:
                strncpy(newtext, text, 10000);
                newtext[10000] = 0;
                rv = IupGetText(title,newtext,10000);
                /* gonna return text or undef */
                XPUSHs(sv_2mortal(newSVpvn_utf8(newtext, strlen(newtext), 1))); /* XPUSHs(sv_2mortal(newSVpv(newtext,0))); */

#### Original C function from <iup.h>
# int IupGetColor(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
void
_IupGetColor(x,y,r,g,b)
                int x;
                int y;
                unsigned char r;
                unsigned char g;
                unsigned char b;
        INIT:
                int rv;
                unsigned char newr = r; /* xxx check this assignment newr=r or newr=*r ? */
                unsigned char newg = g;
                unsigned char newb = b;
        PPCODE:
                rv = IupGetColor(x,y,&newr,&newg,&newb);
                if (rv == 1) {
                  /* gonna return array: (newr, newg, newb) */
                  XPUSHs(sv_2mortal(newSViv(newr)));
                  XPUSHs(sv_2mortal(newSViv(newg)));
                  XPUSHs(sv_2mortal(newSViv(newb)));
                }
                else {
                  /* gonna return array: (undef, undef, undef) */
                  /* xxxcheckthis is 3x udef necessary? */
                  XPUSHs(&PL_sv_undef);
                  XPUSHs(&PL_sv_undef);
                  XPUSHs(&PL_sv_undef);
                }

#### Original C function from <iup.h>
# int IupGetParam(const char* title, Iparamcb action, void* user_data, const char* format,...);
void
_IupGetParam(title,action,action_data,format,...)
                char* title;
                SV* action;
                SV* action_data;
                char* format;
        INIT:
                getparam_data gp;
                void* gp_user_data = (void*)&gp;
                int rv, i, size, line_size = 0;
                int param_extra, param_count;                 
                void* param_data[50]; /* xxx why 50? */
                char param_type[50];
                const char* f = format;
                const char* s;
                int varparam = 4; /* position in variable param list */
                
                param_count = iupGetParamCount(format, &param_extra);
                memset(param_data, 0, sizeof(void*)*50);
                memset(param_type, 0, sizeof(char)*50);
                
                /* warn param count mismatch; however no warning if absolutely no defaults given */
                if(param_count != items-4 && items > 4 && param_count > 0) warn("Warning: GetParam() param count mismatch (got %d, expected %d)",items-4,param_count);                  
                
                for (i = 0; i < param_count; i++) {
                  char t = iupGetParamType(f, &line_size);
                  if (t == 't') { /* if separator */
                    f += line_size;
                    i--; /* compensate next increment */
                    continue;
                  }
                  
                  switch(t) {
                    case 'b':
                    case 'i':
                    case 'l':
                      param_data[i] = malloc(sizeof(int));
                      if (varparam > items-1) {
                        // xxx warn("FATAL.i!!! cur=%d items=%d", varparam, items);
                        *(int*)(param_data[i]) = 0;
                      }
                      else *(int*)(param_data[i]) = SvIV(ST(varparam));
                      varparam++;
                      break;
                    case 'a':
                    case 'r':
                      param_data[i] = malloc(sizeof(float));
                      if (varparam > items-1) {
                        // xxx warn("FATAL.f!!! cur=%d items=%d", varparam, items);
                        *(float*)(param_data[i]) = 0.0;
                      }
                      else *(float*)(param_data[i]) = SvNV(ST(varparam));
                      varparam++;
                      break;
                    case 'f':
                    case 'c':
                    case 's':
                    case 'm':
                      if (varparam > items-1)
                        s = "";
                      else
                        s = SvPV_nolen(ST(varparam));
                      varparam++;
                      size = strlen(s);
                      param_data[i] = malloc(10240); /* XXX hardcoded in iup - not nice */
                      if (size > 10240) {
                        warn("Warning: initial string size %d too big, truncating", size);
                        size = 1024-1;
                      }
                      memcpy(param_data[i], s, size+1);
                      break;
                  }

                  param_type[i] = t;
                  f += line_size;
                }
                
        PPCODE:
                gp.has_func = 0;
                if (SvOK(action)) {
                  gp.has_func = 1;
                  gp.obj_initialized = 0;
                  gp.func_ref = action;
                  gp.obj_ref = action_data;
                }
                
                rv = IupGetParamv(title, cb_param_action, gp_user_data, format, param_count, param_extra, param_data);

                /* gonna return array: (retval, newval1, newval2, ...) */
                XPUSHs(sv_2mortal(newSViv(rv)));
                for (i = 0; i < param_count; i++) {
                  switch(param_type[i]) {
                    case 'b':
                    case 'i':
                    case 'l':
                      XPUSHs(sv_2mortal(newSViv( *(int*)(param_data[i]) )));
                      break;
                    case 'a':
                    case 'r':
                      XPUSHs(sv_2mortal(newSVnv( *(float*)(param_data[i]) )));
                      break;
                    case 'f':
                    case 'c':
                    case 's':
                    case 'm':
                      XPUSHs(sv_2mortal(newSVpvn_utf8(param_data[i], strlen(param_data[i]), 1)));  /* XPUSHs(sv_2mortal(newSVpv( param_data[i], 0 ))); */
                      break;
                  }
                }
                for (i = 0; i < param_count; i++) free(param_data[i]);

#### Original C function from <iup.h>
# int IupListDialog(int type, const char *title, int size, const char** list, int op, int max_col, int max_lin, int* marks);
void
_IupListDialog_single(title,list,SV_op,SV_max_lin,SV_max_col)
                char *title;
                SV* list;
                SV* SV_op;
                SV* SV_max_lin;
                SV* SV_max_col;
        INIT:
                int i, rv, op, max_col, max_lin;
                int items = -1;
                const char** i_list = NULL;                  
                STRLEN l;
        PPCODE:
                /* convert undef to 0 */
                op = (SvIOK(SV_op)) ? SvIVX(SV_op) : 0;
                /* convert undef to -1 */
                max_col = (SvIOK(SV_max_col)) ? SvIVX(SV_max_col) : -1;
                max_lin = (SvIOK(SV_max_lin)) ? SvIVX(SV_max_lin) : -1;
                
                if ((!SvROK(list)) || (SvTYPE(SvRV(list)) != SVt_PVAV) || ((items = av_len((AV *)SvRV(list))) < 0)) {
                  warn("Warning: invalid 'list' argument of ListDialog()");
                  XSRETURN_UNDEF;
                }                
                items++;
                i_list = malloc( (items) * sizeof(void*) );                  
                
                /* create i_list array */
                for(i=0; i<items; i++) i_list[i] = SvPV(*av_fetch((AV *)SvRV(list), i, 0), l);
                
                /* xxx hack: converting perl's 0-based index to iup's 1-based index*/
                if (op>=0) op++;

                /* call IUP function */
                rv = IupListDialog(1,title,items,i_list,op,max_col,max_lin,NULL);
                
                /* arrange return values */
                XPUSHs(sv_2mortal(newSViv(rv)));
                if (i_list != NULL) free(i_list);

#### Original C function from <iup.h>
# int IupListDialog(int type, const char *title, int size, const char** list, int op, int max_col, int max_lin, int* marks);
void
_IupListDialog_multi(title,list,marks,SV_max_lin,SV_max_col)
                char *title;
                SV* list;
                SV* marks;
                SV* SV_max_lin;
                SV* SV_max_col;
        INIT:
                int i, rv, max_col, max_lin;
                int items1 = -1, items2 = -1, items = -1;
                const char** i_list = NULL;                  
                int* i_marks = NULL;
                STRLEN l;
                AV* retmarks;
        PPCODE:
                /* convert undef to -1 */
                max_col = (SvIOK(SV_max_col)) ? SvIVX(SV_max_col) : -1;
                max_lin = (SvIOK(SV_max_lin)) ? SvIVX(SV_max_lin) : -1;

                if ((!SvROK(list)) || (SvTYPE(SvRV(list)) != SVt_PVAV) || ((items1 = av_len((AV *)SvRV(list))) < 0)) {
                  warn("Warning: invalid 'list' argument of ListDialog()");
                  XSRETURN_UNDEF;
                }

                if (SvOK(marks) && ((!SvROK(marks)) || (SvTYPE(SvRV(marks)) != SVt_PVAV) || ((items2 = av_len((AV *)SvRV(marks))) < 0))) {
                  warn("Warning: invalid 'marks' argument of ListDialog()");
                  XSRETURN_UNDEF;
                }
                
                items = items1+1;
                i_marks = malloc( (items) * sizeof(int) );
                i_list = malloc( (items) * sizeof(void*) );                  
                
                /* create i_marks array */
                if (items2 >= 0) {
                  if (items1 != items2)
                    warn("Warning: 'list' and 'marks' arrays have different size(%d vs. %d) in ListDialog()",items1+1, items2+1);
                  if (items2 > items1)
                    items2 = items1;
                  for(i=0; i<=items2; i++) i_marks[i]= SvIV(*av_fetch((AV *)SvRV(marks), i, 0));
                  for(   ; i<=items1; i++) i_marks[i]= 0;
                }

                /* create i_list array */
                for(i=0; i<items; i++) i_list[i] = SvPV(*av_fetch((AV *)SvRV(list), i, 0), l);
                
                /* call IUP function */
                rv = IupListDialog(2,title,items,i_list,-1,max_col,max_lin,i_marks);                
                
                //xxx /* return error code */
                //xxx XPUSHs(sv_2mortal(newSViv(rv)));
        
                /* arrange return values - returning array */
                if (rv < 0) { /* cancel */
                  for(i=0; i<items; i++) XPUSHs(sv_2mortal(newSViv(rv)));
                }
                else {
                  for(i=0; i<items; i++) XPUSHs(sv_2mortal(newSViv(i_marks[i])));
                }
                
                /* arrange return values - returning array ref*/
                //xxx retmarks = newAV();
                //xxx for(i=0; i<items; i++) av_store(retmarks, i, newSViv(i_marks[i]));                  
                //xxx XPUSHs(sv_2mortal(retmarks);
                
                if (i_list != NULL) free(i_list);
                if (i_marks != NULL) free(i_marks);

#### Original C function from <iup.h>
#int IUP::GetClassCallbacks(const char* classname, char** names, int max_n);
void
_IupGetClassCallbacks(...)
        INIT:
                int i, rv, count, max_n;
                int items = -1;
                char* classname;
                char** list = NULL;                  
        PPCODE:
                classname = myST2STR(0);
                max_n = myST2INT(1);
                count = IupGetClassCallbacks(classname,NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetClassCallbacks(classname,list,count);
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<count; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# int IupGetAllNames(char** names, int max_n);
void
_IupGetAllNames(...)
        INIT:
                int i, rv, count, max_n;
                int items = -1;
                char** list = NULL;                  
        PPCODE:
                max_n = myST2INT(0);
                count = IupGetAllNames(NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetAllNames(list,count);
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<count; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# int IupGetAllDialogs(char** names, int max_n);
void
_IupGetAllDialogs(...)
        INIT:
                int i, rv, count, max_n;
                char** list = NULL;                  
        PPCODE:
                max_n = myST2INT(0);
                count = IupGetAllDialogs(NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetAllDialogs(list,count);
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<count; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# int IupGetClassAttributes(const char* classname, char** names, int max_n);
void
_IupGetClassAttributes(classname,...)
                const char* classname;
        INIT:
                int i, rv, count, max_n;
                char** list = NULL;                  
        PPCODE:
                max_n = myST2INT(1);
                count = IupGetClassAttributes(classname,NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetClassAttributes(classname,list,count);
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<count; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# int IupGetAllAttributes(Ihandle* ih, char** names, int max_n);
void
_IupGetAllAttributes(ih,...)
                Ihandle* ih;
        INIT:
                int i, rv, count, max_n;
                char** list = NULL;                  
        PPCODE:
                max_n = myST2INT(1);
                count = IupGetAllAttributes(ih,NULL,0);
                if (max_n > 0) count = max_n;
                list = malloc( count * sizeof(void*) );
                rv = IupGetAllAttributes(ih,list,count);
                #warn("[DEBUG.XS] rv=%d count=%d\n", rv, count); /* xxx why are these values different? */
                if(GIMME_V == G_ARRAY) {
                  for(i=0; i<rv; i++) XPUSHs(sv_2mortal(newSVpv(list[i],0)));
                }
                else {
                  XPUSHs(sv_2mortal(newSViv(rv)));
                }
                if (list != NULL) free(list);

#### Original C function from <iup.h>
# int IupRecordInput(const char* filename, int mode);
int
_IupRecordInput(filename,mode)
                const char* filename;
                int mode;
        CODE:
                RETVAL = IupRecordInput(filename,mode);
        OUTPUT:
                RETVAL

#### Original C function from <iup.h>
# int IupPlayInput(const char* filename);
int
_IupPlayInput(filename)
                const char* filename;
        CODE:
                RETVAL = IupPlayInput(filename);
        OUTPUT:
                RETVAL
                
################################################################################ iup_scintilla.h

# void IupScintillaOpen(void);
void
_IupScintillaOpen()
        CODE:
#ifdef HAVELIB_IUP_SCINTILLA
                IupScintillaOpen();
#endif


# Ihandle *IupScintilla(void);
Ihandle*
_IupScintilla()
        CODE:
#ifdef HAVELIB_IUP_SCINTILLA
                RETVAL = IupScintilla();
#else
                RETVAL = 0;
#endif
        OUTPUT:
                RETVAL

################################################################################ iupcontrols.h



( run in 0.448 second using v1.01-cache-2.11-cpan-5511b514fd6 )