ruby-iup 0.0.1-i386-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/README +10 -0
- data/doc/build_install.txt +77 -0
- data/examples/README +16 -0
- data/examples/ctrl/cbox.rb +221 -0
- data/examples/ctrl/checkboard.rb +33 -0
- data/examples/ctrl/degrade.rb +73 -0
- data/examples/ctrl/example1.rb +53 -0
- data/examples/ctrl/example2.rb +39 -0
- data/examples/ctrl/iupcolorbar.rb +95 -0
- data/examples/ctrl/iupcolorbrowser.rb +45 -0
- data/examples/ctrl/iupdial.rb +117 -0
- data/examples/ctrl/iupgauge.rb +242 -0
- data/examples/ctrl/iupgetcolor.rb +8 -0
- data/examples/ctrl/iupgetparam.rb +62 -0
- data/examples/ctrl/iupglcanvas.rb +172 -0
- data/examples/ctrl/iupmask.rb +15 -0
- data/examples/ctrl/iupmatrix.rb +39 -0
- data/examples/ctrl/iupplot2.rb +603 -0
- data/examples/ctrl/iuptabs.rb +22 -0
- data/examples/ctrl/iuptree.rb +190 -0
- data/examples/ctrl/iupval.rb +71 -0
- data/examples/ctrl/numbering.rb +46 -0
- data/examples/ctrl/sample.rb +166 -0
- data/examples/dlg/iupalarm.rb +14 -0
- data/examples/dlg/iupfiledlg.rb +19 -0
- data/examples/dlg/iupgetfile.rb +19 -0
- data/examples/dlg/iuplistdialog.rb +26 -0
- data/examples/dlg/iupmessage.rb +5 -0
- data/examples/dlg/iupscanf.rb +17 -0
- data/examples/elem/iupbutton.rb +197 -0
- data/examples/elem/iupcanvas.rb +27 -0
- data/examples/elem/iupcanvas2.rb +113 -0
- data/examples/elem/iupcanvas3.rb +62 -0
- data/examples/elem/iupdialog.rb +71 -0
- data/examples/elem/iupdialog2.rb +25 -0
- data/examples/elem/iupfill.rb +51 -0
- data/examples/elem/iupframe.rb +25 -0
- data/examples/elem/iuphbox.rb +68 -0
- data/examples/elem/iupimage.rb +113 -0
- data/examples/elem/iupitem.rb +60 -0
- data/examples/elem/iuplabel.rb +57 -0
- data/examples/elem/iuplist.rb +41 -0
- data/examples/elem/iuplist2.rb +125 -0
- data/examples/elem/iupmenu.rb +32 -0
- data/examples/elem/iupmultiline.rb +24 -0
- data/examples/elem/iupmultiline2.rb +156 -0
- data/examples/elem/iupradio.rb +32 -0
- data/examples/elem/iupseparator.rb +81 -0
- data/examples/elem/iupsubmenu.rb +85 -0
- data/examples/elem/iuptext.rb +61 -0
- data/examples/elem/iuptimer.rb +36 -0
- data/examples/elem/iuptoggle.rb +110 -0
- data/examples/elem/iupvbox.rb +87 -0
- data/examples/elem/iupzbox.rb +60 -0
- data/examples/elem/mdisample.rb +376 -0
- data/examples/elem/progressbar.rb +294 -0
- data/examples/elem/scrollbar.rb +66 -0
- data/examples/elem/tray.rb +90 -0
- data/examples/func/iupgetattribute.rb +32 -0
- data/examples/func/iupidle.rb +48 -0
- data/ext/extconf.rb +27 -0
- data/ext/iup-win32/cd.dll +0 -0
- data/ext/iup-win32/cd.lib +0 -0
- data/ext/iup-win32/cdcontextplus.dll +0 -0
- data/ext/iup-win32/cdcontextplus.lib +0 -0
- data/ext/iup-win32/cdlua51.lib +0 -0
- data/ext/iup-win32/cdluacontextplus51.lib +0 -0
- data/ext/iup-win32/cdluaim51.lib +0 -0
- data/ext/iup-win32/cdluapdf51.lib +0 -0
- data/ext/iup-win32/cdpdf.dll +0 -0
- data/ext/iup-win32/cdpdf.lib +0 -0
- data/ext/iup-win32/freetype6.dll +0 -0
- data/ext/iup-win32/freetype6.lib +0 -0
- data/ext/iup-win32/im.dll +0 -0
- data/ext/iup-win32/im_avi.dll +0 -0
- data/ext/iup-win32/im_capture.dll +0 -0
- data/ext/iup-win32/im_ecw.dll +0 -0
- data/ext/iup-win32/im_fftw.dll +0 -0
- data/ext/iup-win32/im_jp2.dll +0 -0
- data/ext/iup-win32/im_process.dll +0 -0
- data/ext/iup-win32/im_wmv.dll +0 -0
- data/ext/iup-win32/iup.dll +0 -0
- data/ext/iup-win32/iup.lib +0 -0
- data/ext/iup-win32/iup_pplot.dll +0 -0
- data/ext/iup-win32/iup_pplot.lib +0 -0
- data/ext/iup-win32/iupcd.dll +0 -0
- data/ext/iup-win32/iupcd.lib +0 -0
- data/ext/iup-win32/iupcontrols.dll +0 -0
- data/ext/iup-win32/iupcontrols.lib +0 -0
- data/ext/iup-win32/iupgl.dll +0 -0
- data/ext/iup-win32/iupgl.lib +0 -0
- data/ext/iup-win32/iupim.dll +0 -0
- data/ext/iup-win32/iupim.lib +0 -0
- data/ext/iup-win32/iupimglib.dll +0 -0
- data/ext/iup-win32/iupimglib.lib +0 -0
- data/ext/iup-win32/iuplua51.lib +0 -0
- data/ext/iup-win32/iuplua_pplot51.lib +0 -0
- data/ext/iup-win32/iupluacd51.lib +0 -0
- data/ext/iup-win32/iupluacontrols51.lib +0 -0
- data/ext/iup-win32/iupluagl51.lib +0 -0
- data/ext/iup-win32/iupluaim51.lib +0 -0
- data/ext/iup-win32/iupluaimglib51.lib +0 -0
- data/ext/iup-win32/iupluaole51.lib +0 -0
- data/ext/iup-win32/iupole.dll +0 -0
- data/ext/iup-win32/iupole.lib +0 -0
- data/ext/iup-win32/iupstub.lib +0 -0
- data/ext/iup-win32/pdflib.dll +0 -0
- data/ext/iup-win32/pdflib.lib +0 -0
- data/ext/iup.c +1261 -0
- data/ext/mkrf_conf.rb +72 -0
- data/ext/rb_cd.h +1525 -0
- data/ext/rb_iup.h +2446 -0
- data/ext/rb_iup_pplot.h +129 -0
- data/ext/rb_iupcb.h +13 -0
- data/ext/rb_iupcbox.h +40 -0
- data/ext/rb_iupcells.h +15 -0
- data/ext/rb_iupcolorbar.h +17 -0
- data/ext/rb_iupcompat.h +237 -0
- data/ext/rb_iupcontrols.h +28 -0
- data/ext/rb_iupdef.h +3 -0
- data/ext/rb_iupdial.h +24 -0
- data/ext/rb_iupgauge.h +15 -0
- data/ext/rb_iupgc.h +18 -0
- data/ext/rb_iupgetparam.h +72 -0
- data/ext/rb_iupgl.h +58 -0
- data/ext/rb_iupim.h +25 -0
- data/ext/rb_iupmask.h +189 -0
- data/ext/rb_iupmatrix.h +80 -0
- data/ext/rb_iupole.h +24 -0
- data/ext/rb_iupsbox.h +23 -0
- data/ext/rb_iupspeech.h +25 -0
- data/ext/rb_iupspin.h +29 -0
- data/ext/rb_iuptabs.h +29 -0
- data/ext/rb_iuptree.h +94 -0
- data/ext/rb_iupval.h +24 -0
- data/lib/README +1 -0
- data/lib/iup.so +0 -0
- metadata +187 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupcontrols.h"
|
4
|
+
|
5
|
+
VALUE rb_IupControlsOpen(VALUE self)
|
6
|
+
{
|
7
|
+
int v;
|
8
|
+
v = IupControlsOpen();
|
9
|
+
return INT2FIX((int)v);
|
10
|
+
}
|
11
|
+
|
12
|
+
VALUE rb_IupControlsClose(VALUE self)
|
13
|
+
{
|
14
|
+
IupControlsClose();
|
15
|
+
return Qnil;
|
16
|
+
}
|
17
|
+
|
18
|
+
VALUE rb_IupImageLibOpen(VALUE self)
|
19
|
+
{
|
20
|
+
IupImageLibOpen();
|
21
|
+
return Qnil;
|
22
|
+
}
|
23
|
+
|
24
|
+
VALUE rb_IupImageLibClose(VALUE self)
|
25
|
+
{
|
26
|
+
IupImageLibClose();
|
27
|
+
return Qnil;
|
28
|
+
}
|
data/ext/rb_iupdef.h
ADDED
data/ext/rb_iupdial.h
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupdial.h"
|
4
|
+
|
5
|
+
VALUE rb_IupDial(int argc,VALUE *argv,VALUE self)
|
6
|
+
{
|
7
|
+
extern VALUE rb_cIupDial;
|
8
|
+
const char *type = NULL;
|
9
|
+
Ihandle* v;
|
10
|
+
VALUE v_type;
|
11
|
+
if(argc==1 && TYPE(argv[0])==T_HASH) {
|
12
|
+
v_type = rb_hash_delete(argv[0],ID2SYM(rb_intern("type")));
|
13
|
+
} else {
|
14
|
+
rb_scan_args(argc,argv,"10",&v_type);
|
15
|
+
}
|
16
|
+
if(v_type!=Qnil)
|
17
|
+
type = RSTRING(v_type)->ptr;
|
18
|
+
v = IupDial(type);
|
19
|
+
if(argc==1 && TYPE(argv[0])==T_HASH)
|
20
|
+
rb_set_attribute(v,argv[0]);
|
21
|
+
if(v)
|
22
|
+
return rb_funcall(rb_cIupDial,rb_intern("new"),1,UINT2NUM((unsigned)v));
|
23
|
+
return Qnil;
|
24
|
+
}
|
data/ext/rb_iupgauge.h
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupgauge.h"
|
4
|
+
|
5
|
+
VALUE rb_IupGauge(int argc,VALUE *argv,VALUE self)
|
6
|
+
{
|
7
|
+
extern VALUE rb_cIupGauge;
|
8
|
+
Ihandle* v;
|
9
|
+
v = IupGauge();
|
10
|
+
if(argc==1 && TYPE(argv[0])==T_HASH)
|
11
|
+
rb_set_attribute(v,argv[0]);
|
12
|
+
if(v)
|
13
|
+
return rb_funcall(rb_cIupGauge,rb_intern("new"),1,UINT2NUM((unsigned)v));
|
14
|
+
return Qnil;
|
15
|
+
}
|
data/ext/rb_iupgc.h
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupgc.h"
|
4
|
+
|
5
|
+
VALUE rb_IupGetColor(VALUE self,VALUE v_x,VALUE v_y)
|
6
|
+
{
|
7
|
+
int x = NUM2INT(v_x);
|
8
|
+
int y = NUM2INT(v_y);
|
9
|
+
unsigned char r;
|
10
|
+
unsigned char g;
|
11
|
+
unsigned char b;
|
12
|
+
int v;
|
13
|
+
VALUE v_r;
|
14
|
+
v = IupGetColor(x,y,&r,&g,&b);
|
15
|
+
if(v==0) return Qnil;
|
16
|
+
v_r = rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b));
|
17
|
+
return v_r;
|
18
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupgetparam.h"
|
4
|
+
|
5
|
+
static char ParamAction[100];
|
6
|
+
|
7
|
+
static int _param_action(Ihandle* dialog, int param_index, void* user_data)
|
8
|
+
{
|
9
|
+
VALUE v;
|
10
|
+
VALUE node;
|
11
|
+
node = rb_funcall(rb_cIupNode,rb_intern("new"),1,UINT2NUM((unsigned)dialog));
|
12
|
+
v = rb_funcall(rb_cObject,rb_intern(ParamAction),3,node,INT2FIX(param_index),UINT2NUM((unsigned)user_data));
|
13
|
+
return NUM2INT(v);
|
14
|
+
}
|
15
|
+
|
16
|
+
VALUE rb_IupGetParam(int argc,VALUE *argv,VALUE self)
|
17
|
+
{
|
18
|
+
const char* title = RSTRING(argv[0])->ptr;
|
19
|
+
Iparamcb action = NULL;
|
20
|
+
void* user_data = (void*)NUM2INT(argv[2]);
|
21
|
+
const char* format = RSTRING(argv[3])->ptr;
|
22
|
+
int param_count;
|
23
|
+
int param_extra;
|
24
|
+
void *param_data[50];
|
25
|
+
int i,v;
|
26
|
+
int n[50];
|
27
|
+
float d[50];
|
28
|
+
static char s[50][500];
|
29
|
+
VALUE v_r;
|
30
|
+
if(argv[1]!=Qnil) {
|
31
|
+
strcpy(ParamAction,RSTRING(argv[1])->ptr);
|
32
|
+
action = (Iparamcb)_param_action;
|
33
|
+
}
|
34
|
+
param_count = IupGetParamCount(format, ¶m_extra);
|
35
|
+
for(i=0;i<param_count && i+4<argc;i++) {
|
36
|
+
switch(TYPE(argv[i+4])) {
|
37
|
+
case T_FIXNUM:
|
38
|
+
case T_BIGNUM:
|
39
|
+
n[i] = NUM2INT(argv[i+4]);
|
40
|
+
param_data[i] = (void*)&n[i];
|
41
|
+
break;
|
42
|
+
case T_FLOAT:
|
43
|
+
d[i] = RFLOAT(argv[i+4])->value;
|
44
|
+
param_data[i] = (void*)&d[i];
|
45
|
+
break;
|
46
|
+
case T_STRING:
|
47
|
+
strcpy(s[i],RSTRING(argv[i+4])->ptr);
|
48
|
+
param_data[i] = s[i];
|
49
|
+
break;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
param_data[i] = NULL;
|
53
|
+
v = IupGetParamv(title,action,user_data,format,param_count,param_extra,param_data);
|
54
|
+
v_r = rb_ary_new();
|
55
|
+
for(i=0;i<param_count;i++) {
|
56
|
+
switch(TYPE(argv[i+4])) {
|
57
|
+
case T_FIXNUM:
|
58
|
+
case T_BIGNUM:
|
59
|
+
rb_ary_push(v_r,INT2NUM(n[i]));
|
60
|
+
break;
|
61
|
+
case T_FLOAT:
|
62
|
+
sprintf(s[i],"%g",d[i]);
|
63
|
+
rb_ary_push(v_r,rb_float_new(atof(s[i])));
|
64
|
+
break;
|
65
|
+
case T_STRING:
|
66
|
+
rb_ary_push(v_r,rb_str_new2(s[i]));
|
67
|
+
break;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return v_r;
|
71
|
+
}
|
72
|
+
|
data/ext/rb_iupgl.h
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupgl.h"
|
4
|
+
|
5
|
+
VALUE rb_IupGLCanvasOpen(VALUE self)
|
6
|
+
{
|
7
|
+
IupGLCanvasOpen();
|
8
|
+
return Qnil;
|
9
|
+
}
|
10
|
+
|
11
|
+
VALUE rb_IupGLCanvas(int argc,VALUE *argv,VALUE self)
|
12
|
+
{
|
13
|
+
extern VALUE rb_cIupGLCanvas;
|
14
|
+
const char *action = NULL;
|
15
|
+
Ihandle* v;
|
16
|
+
VALUE v_action;
|
17
|
+
IupGLCanvasOpen();
|
18
|
+
rb_scan_args(argc,argv,"01",&v_action);
|
19
|
+
if(v_action!=Qnil) action = RSTRING(v_action)->ptr;
|
20
|
+
v = IupGLCanvas(action);
|
21
|
+
if(v)
|
22
|
+
return rb_funcall(rb_cIupGLCanvas,rb_intern("new"),1,UINT2NUM((unsigned)v));
|
23
|
+
return Qnil;
|
24
|
+
}
|
25
|
+
|
26
|
+
VALUE rb_IupGLMakeCurrent(VALUE self,VALUE node)
|
27
|
+
{
|
28
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
29
|
+
IupGLMakeCurrent((Ihandle*)NUM2UINT(v_ih));
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
VALUE rb_IupGLIsCurrent(VALUE self,VALUE node)
|
34
|
+
{
|
35
|
+
int v;
|
36
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
37
|
+
v = IupGLIsCurrent((Ihandle*)NUM2UINT(v_ih));
|
38
|
+
return INT2FIX((int)v);
|
39
|
+
}
|
40
|
+
|
41
|
+
VALUE rb_IupGLSwapBuffers(VALUE self,VALUE node)
|
42
|
+
{
|
43
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
44
|
+
IupGLSwapBuffers((Ihandle*)NUM2UINT(v_ih));
|
45
|
+
return Qnil;
|
46
|
+
}
|
47
|
+
|
48
|
+
VALUE rb_IupGLPalette(VALUE self,VALUE node,VALUE v_index,VALUE v_r,VALUE v_g,VALUE v_b)
|
49
|
+
{
|
50
|
+
float r,g,b;
|
51
|
+
int index = NUM2INT(v_index);
|
52
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
53
|
+
r = RFLOAT(v_r)->value;
|
54
|
+
g = RFLOAT(v_g)->value;
|
55
|
+
b = RFLOAT(v_b)->value;
|
56
|
+
IupGLPalette((Ihandle*)NUM2UINT(v_ih),index,r,g,b);
|
57
|
+
return Qnil;
|
58
|
+
}
|
data/ext/rb_iupim.h
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupim.h"
|
4
|
+
|
5
|
+
VALUE rb_IupLoadImage(VALUE self,VALUE v_file_name)
|
6
|
+
{
|
7
|
+
extern VALUE rb_cIupImage;
|
8
|
+
const char* file_name = RSTRING(v_file_name)->ptr;
|
9
|
+
Ihandle* v;
|
10
|
+
v = IupLoadImage(file_name);
|
11
|
+
if(v)
|
12
|
+
return rb_funcall(rb_cIupImage,rb_intern("new"),1,UINT2NUM((unsigned)v));
|
13
|
+
return Qnil;
|
14
|
+
}
|
15
|
+
|
16
|
+
VALUE rb_IupSaveImage(VALUE self,VALUE node,VALUE v_file_name,VALUE v_format)
|
17
|
+
{
|
18
|
+
const char* file_name = RSTRING(v_file_name)->ptr;
|
19
|
+
const char* format = RSTRING(v_format)->ptr;
|
20
|
+
int v;
|
21
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
22
|
+
v = IupSaveImage((Ihandle*)NUM2UINT(v_ih),file_name,format);
|
23
|
+
return INT2FIX((int)v);
|
24
|
+
}
|
25
|
+
|
data/ext/rb_iupmask.h
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupmask.h"
|
4
|
+
|
5
|
+
VALUE rb_iupmaskSet(VALUE node,VALUE v_mask,VALUE v_autofill,VALUE v_casei)
|
6
|
+
{
|
7
|
+
const char *mask = RSTRING(v_mask)->ptr;
|
8
|
+
int autofill = NUM2INT(v_autofill);
|
9
|
+
int casei = NUM2INT(v_casei);
|
10
|
+
int v;
|
11
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
12
|
+
v = iupmaskSet((Ihandle*)NUM2UINT(v_ih),mask,autofill,casei);
|
13
|
+
return INT2FIX(v);
|
14
|
+
}
|
15
|
+
|
16
|
+
VALUE rb_iupmaskSetInt(VALUE node,VALUE v_autofill,VALUE v_min,VALUE v_max)
|
17
|
+
{
|
18
|
+
int autofill = NUM2INT(v_autofill);
|
19
|
+
int min = NUM2INT(v_min);
|
20
|
+
int max = NUM2INT(v_max);
|
21
|
+
int v;
|
22
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
23
|
+
v = iupmaskSetInt((Ihandle*)NUM2UINT(v_ih),autofill,min,max);
|
24
|
+
return INT2FIX(v);
|
25
|
+
}
|
26
|
+
|
27
|
+
VALUE rb_iupmaskSetFloat(VALUE node,VALUE v_autofill,VALUE v_min,VALUE v_max)
|
28
|
+
{
|
29
|
+
float min = RFLOAT(v_min)->value;
|
30
|
+
float max = RFLOAT(v_max)->value;
|
31
|
+
int autofill = NUM2INT(v_autofill);
|
32
|
+
int v;
|
33
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
34
|
+
v = iupmaskSetFloat((Ihandle*)NUM2UINT(v_ih),autofill,min,max);
|
35
|
+
return INT2FIX(v);
|
36
|
+
}
|
37
|
+
|
38
|
+
VALUE rb_iupmaskRemove(VALUE node)
|
39
|
+
{
|
40
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
41
|
+
iupmaskRemove((Ihandle*)NUM2UINT(v_ih));
|
42
|
+
return Qnil;
|
43
|
+
}
|
44
|
+
|
45
|
+
VALUE rb_iupmaskCheck(VALUE node)
|
46
|
+
{
|
47
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
48
|
+
int v;
|
49
|
+
v = iupmaskCheck((Ihandle*)NUM2UINT(v_ih));
|
50
|
+
return INT2FIX(v);
|
51
|
+
}
|
52
|
+
|
53
|
+
VALUE rb_iupmaskGet(VALUE node,VALUE v_val)
|
54
|
+
{
|
55
|
+
char *val = RSTRING(v_val)->ptr;
|
56
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
57
|
+
int v;
|
58
|
+
v = iupmaskGet((Ihandle*)NUM2UINT(v_ih),&val);
|
59
|
+
return INT2FIX(v);
|
60
|
+
}
|
61
|
+
|
62
|
+
VALUE rb_iupmaskGetFloat(VALUE node,VALUE v_fval)
|
63
|
+
{
|
64
|
+
int v;
|
65
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
66
|
+
float fval = RFLOAT(v_fval)->value;
|
67
|
+
v = iupmaskGetFloat((Ihandle*)NUM2UINT(v_ih),&fval);
|
68
|
+
return INT2FIX(v);
|
69
|
+
}
|
70
|
+
|
71
|
+
VALUE rb_iupmaskGetDouble(VALUE node,VALUE v_dval)
|
72
|
+
{
|
73
|
+
int v;
|
74
|
+
double dval = RFLOAT(v_dval)->value;
|
75
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
76
|
+
v = iupmaskGetDouble((Ihandle*)NUM2UINT(v_ih),&dval);
|
77
|
+
return INT2FIX(v);
|
78
|
+
}
|
79
|
+
|
80
|
+
VALUE rb_iupmaskGetInt(VALUE node,VALUE v_ival)
|
81
|
+
{
|
82
|
+
int ival = NUM2INT(v_ival);
|
83
|
+
int v;
|
84
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
85
|
+
v = iupmaskGetInt((Ihandle*)NUM2UINT(v_ih),&ival);
|
86
|
+
return INT2FIX(v);
|
87
|
+
}
|
88
|
+
|
89
|
+
VALUE rb_iupmaskMatSet(VALUE node,VALUE v_mask,VALUE v_autofill,VALUE v_casei,VALUE v_lin,VALUE v_col)
|
90
|
+
{
|
91
|
+
const char *mask = RSTRING(v_mask)->ptr;
|
92
|
+
int autofill = NUM2INT(v_autofill);
|
93
|
+
int casei = NUM2INT(v_casei);
|
94
|
+
int lin = NUM2INT(v_lin);
|
95
|
+
int col = NUM2INT(v_col);
|
96
|
+
int v;
|
97
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
98
|
+
v = iupmaskMatSet((Ihandle*)NUM2UINT(v_ih),mask,autofill,casei,lin,col);
|
99
|
+
return INT2FIX(v);
|
100
|
+
}
|
101
|
+
|
102
|
+
VALUE rb_iupmaskMatSetInt(VALUE node,VALUE v_autofill,VALUE v_min,VALUE v_max,VALUE v_lin,VALUE v_col)
|
103
|
+
{
|
104
|
+
int autofill = NUM2INT(v_autofill);
|
105
|
+
int min = NUM2INT(v_min);
|
106
|
+
int max = NUM2INT(v_max);
|
107
|
+
int lin = NUM2INT(v_lin);
|
108
|
+
int col = NUM2INT(v_col);
|
109
|
+
int v;
|
110
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
111
|
+
v = iupmaskMatSetInt((Ihandle*)NUM2UINT(v_ih),autofill,min,max,lin,col);
|
112
|
+
return INT2FIX(v);
|
113
|
+
}
|
114
|
+
|
115
|
+
VALUE rb_iupmaskMatSetFloat(VALUE node,VALUE v_autofill,VALUE v_min,VALUE v_max,VALUE v_lin,VALUE v_col)
|
116
|
+
{
|
117
|
+
int autofill = NUM2INT(v_autofill);
|
118
|
+
int lin = NUM2INT(v_lin);
|
119
|
+
int col = NUM2INT(v_col);
|
120
|
+
float min = RFLOAT(v_min)->value;
|
121
|
+
float max = RFLOAT(v_max)->value;
|
122
|
+
int v;
|
123
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
124
|
+
v = iupmaskMatSetFloat((Ihandle*)NUM2UINT(v_ih),autofill,min,max,lin,col);
|
125
|
+
return INT2FIX(v);
|
126
|
+
}
|
127
|
+
|
128
|
+
VALUE rb_iupmaskMatRemove(VALUE node,VALUE v_lin,VALUE v_col)
|
129
|
+
{
|
130
|
+
int lin = NUM2INT(v_lin);
|
131
|
+
int col = NUM2INT(v_col);
|
132
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
133
|
+
iupmaskMatRemove((Ihandle*)NUM2UINT(v_ih),lin,col);
|
134
|
+
return Qnil;
|
135
|
+
}
|
136
|
+
|
137
|
+
VALUE rb_iupmaskMatCheck(VALUE node,VALUE v_lin,VALUE v_col)
|
138
|
+
{
|
139
|
+
int lin = NUM2INT(v_lin);
|
140
|
+
int col = NUM2INT(v_col);
|
141
|
+
int v;
|
142
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
143
|
+
v = iupmaskMatCheck((Ihandle*)NUM2UINT(v_ih),lin,col);
|
144
|
+
return INT2FIX(v);
|
145
|
+
}
|
146
|
+
|
147
|
+
VALUE rb_iupmaskMatGet(VALUE node,VALUE v_val,VALUE v_lin,VALUE v_col)
|
148
|
+
{
|
149
|
+
char *val = RSTRING(v_val)->ptr;
|
150
|
+
int lin = NUM2INT(v_lin);
|
151
|
+
int col = NUM2INT(v_col);
|
152
|
+
int v;
|
153
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
154
|
+
v = iupmaskMatGet((Ihandle*)NUM2UINT(v_ih),&val,lin,col);
|
155
|
+
return INT2FIX(v);
|
156
|
+
}
|
157
|
+
|
158
|
+
VALUE rb_iupmaskMatGetFloat(VALUE node,VALUE v_fval,VALUE v_lin,VALUE v_col)
|
159
|
+
{
|
160
|
+
int lin = NUM2INT(v_lin);
|
161
|
+
int col = NUM2INT(v_col);
|
162
|
+
int v;
|
163
|
+
float fval = RFLOAT(v_fval)->value;
|
164
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
165
|
+
v = iupmaskMatGetFloat((Ihandle*)NUM2UINT(v_ih),&fval,lin,col);
|
166
|
+
return INT2FIX(v);
|
167
|
+
}
|
168
|
+
|
169
|
+
VALUE rb_iupmaskMatGetDouble(VALUE node,VALUE v_dval,VALUE v_lin,VALUE v_col)
|
170
|
+
{
|
171
|
+
int lin = NUM2INT(v_lin);
|
172
|
+
int col = NUM2INT(v_col);
|
173
|
+
int v;
|
174
|
+
double dval = RFLOAT(v_dval)->value;
|
175
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
176
|
+
v = iupmaskMatGetDouble((Ihandle*)NUM2UINT(v_ih),&dval,lin,col);
|
177
|
+
return INT2FIX(v);
|
178
|
+
}
|
179
|
+
|
180
|
+
VALUE rb_iupmaskMatGetInt(VALUE node,VALUE v_ival,VALUE v_lin,VALUE v_col)
|
181
|
+
{
|
182
|
+
int ival = NUM2INT(v_ival);
|
183
|
+
int lin = NUM2INT(v_lin);
|
184
|
+
int col = NUM2INT(v_col);
|
185
|
+
int v;
|
186
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
187
|
+
v = iupmaskMatGetInt((Ihandle*)NUM2UINT(v_ih),&ival,lin,col);
|
188
|
+
return INT2FIX(v);
|
189
|
+
}
|
data/ext/rb_iupmatrix.h
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "iup.h"
|
3
|
+
#include "iupmatrix.h"
|
4
|
+
|
5
|
+
VALUE rb_IupMatrix(int argc,VALUE *argv,VALUE self)
|
6
|
+
{
|
7
|
+
extern VALUE rb_cIupMatrix;
|
8
|
+
char *action = NULL;
|
9
|
+
Ihandle* v;
|
10
|
+
VALUE v_action;
|
11
|
+
if(argc==1 && TYPE(argv[0])==T_HASH) {
|
12
|
+
v_action = rb_hash_delete(argv[0],ID2SYM(rb_intern("action")));
|
13
|
+
} else {
|
14
|
+
rb_scan_args(argc,argv,"01",&v_action);
|
15
|
+
}
|
16
|
+
if(v_action!=Qnil)
|
17
|
+
action = RSTRING(v_action)->ptr;
|
18
|
+
v = IupMatrix(action);
|
19
|
+
if(argc==1 && TYPE(argv[0])==T_HASH)
|
20
|
+
rb_set_attribute(v,argv[0]);
|
21
|
+
if(v)
|
22
|
+
return rb_funcall(rb_cIupMatrix,rb_intern("new"),1,UINT2NUM((unsigned)v));
|
23
|
+
return Qnil;
|
24
|
+
}
|
25
|
+
|
26
|
+
VALUE rb_IupMatSetAttribute(VALUE node,VALUE v_a,VALUE v_l,VALUE v_c,VALUE v_v)
|
27
|
+
{
|
28
|
+
const char* a = RSTRING(v_a)->ptr;
|
29
|
+
int l = NUM2INT(v_l);
|
30
|
+
int c = NUM2INT(v_c);
|
31
|
+
char* v = RSTRING(v_v)->ptr;
|
32
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
33
|
+
IupMatSetAttribute((Ihandle*)NUM2UINT(v_ih),a,l,c,v);
|
34
|
+
return Qnil;
|
35
|
+
}
|
36
|
+
|
37
|
+
VALUE rb_IupMatStoreAttribute(VALUE node,VALUE v_a,VALUE v_l,VALUE v_c,VALUE v_v)
|
38
|
+
{
|
39
|
+
const char* a = RSTRING(v_a)->ptr;
|
40
|
+
int l = NUM2INT(v_l);
|
41
|
+
int c = NUM2INT(v_c);
|
42
|
+
char* v = RSTRING(v_v)->ptr;
|
43
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
44
|
+
IupMatStoreAttribute((Ihandle*)NUM2UINT(v_ih),a,l,c,v);
|
45
|
+
return Qnil;
|
46
|
+
}
|
47
|
+
|
48
|
+
VALUE rb_IupMatGetAttribute(VALUE node,VALUE v_a,VALUE v_l,VALUE v_c)
|
49
|
+
{
|
50
|
+
const char* a = RSTRING(v_a)->ptr;
|
51
|
+
int l = NUM2INT(v_l);
|
52
|
+
int c = NUM2INT(v_c);
|
53
|
+
char* v;
|
54
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
55
|
+
v = IupMatGetAttribute((Ihandle*)NUM2UINT(v_ih),a,l,c);
|
56
|
+
return rb_str_new2(v);
|
57
|
+
}
|
58
|
+
|
59
|
+
VALUE rb_IupMatGetInt(VALUE node,VALUE v_a,VALUE v_l,VALUE v_c)
|
60
|
+
{
|
61
|
+
const char* a = RSTRING(v_a)->ptr;
|
62
|
+
int l = NUM2INT(v_l);
|
63
|
+
int c = NUM2INT(v_c);
|
64
|
+
int v;
|
65
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
66
|
+
v = IupMatGetInt((Ihandle*)NUM2UINT(v_ih),a,l,c);
|
67
|
+
return INT2FIX(v);
|
68
|
+
}
|
69
|
+
|
70
|
+
VALUE rb_IupMatGetFloat(VALUE node,VALUE v_a,VALUE v_l,VALUE v_c)
|
71
|
+
{
|
72
|
+
const char* a = RSTRING(v_a)->ptr;
|
73
|
+
int l = NUM2INT(v_l);
|
74
|
+
int c = NUM2INT(v_c);
|
75
|
+
float v;
|
76
|
+
VALUE v_ih = rb_iv_get(node,"@ihandle");
|
77
|
+
v = IupMatGetFloat((Ihandle*)NUM2UINT(v_ih),a,l,c);
|
78
|
+
return INT2FIX(v);
|
79
|
+
}
|
80
|
+
|