History

undo test commenting out code with preprocessor directives

Jack Atherton committed 7 years ago

Commit b91dd1e1 parent db1a1dd26 files · +7454 −7195Browse files

Showing the changes to src/core/chuck_lang.cpp (1 of 26 files). Show all

Unified · Split

src/core/chuck_lang.cpp+1314−1292
@@ -38,9 +38,16 @@ · 37 unmodified lines
38#include "chuck_vm.h"38#include "chuck_vm.h"
39#include "chuck_errmsg.h"39#include "chuck_errmsg.h"
40#include "chuck_ugen.h"40#include "chuck_ugen.h"
41//#include "hidio_sdl.h"41
42#ifndef __DISABLE_HID__
43#include "hidio_sdl.h"
44#endif
45
42#include "util_string.h"46#include "util_string.h"
43//#include "util_serial.h"47
48#ifndef __DISABLE_SERIAL__
49#include "util_serial.h"
50#endif
44 51
45#ifndef __DISABLE_MIDI__52#ifndef __DISABLE_MIDI__
46#include "midiio_rtmidi.h"53#include "midiio_rtmidi.h"
@@ -839,164 +846,166 @@ error: · 792 unmodified lines
839 846
840 847
841 848
849#ifndef __DISABLE_FILEIO__
842//-----------------------------------------------------------------------------850//-----------------------------------------------------------------------------
843// name: init_class_fileio()851// name: init_class_fileio()
844// desc: ...852// desc: ...
845//-----------------------------------------------------------------------------853//-----------------------------------------------------------------------------
846//t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type )854t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type )
847//{855{
848// // init as base class856 // init as base class
849// Chuck_DL_Func * func = NULL;857 Chuck_DL_Func * func = NULL;
850//858
851// // log859 // log
852// EM_log( CK_LOG_SEVERE, "class 'fileio'" );860 EM_log( CK_LOG_SEVERE, "class 'fileio'" );
853//861
854// // init as base class862 // init as base class
855// // TODO: ctor/dtor?863 // TODO: ctor/dtor?
856// // TODO: replace dummy with pure function864 // TODO: replace dummy with pure function
857// if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) )865 if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) )
858// return FALSE;866 return FALSE;
859//867
860// // add open(string)868 // add open(string)
861// func = make_new_mfun( "int", "open", fileio_open );869 func = make_new_mfun( "int", "open", fileio_open );
862// func->add_arg( "string", "path" );870 func->add_arg( "string", "path" );
863// if( !type_engine_import_mfun( env, func ) ) goto error;871 if( !type_engine_import_mfun( env, func ) ) goto error;
864//872
865// // add open(string, flags)873 // add open(string, flags)
866// func = make_new_mfun( "int", "open", fileio_openflags );874 func = make_new_mfun( "int", "open", fileio_openflags );
867// func->add_arg( "string", "path" );875 func->add_arg( "string", "path" );
868// func->add_arg( "int", "flags" );876 func->add_arg( "int", "flags" );
869// if( !type_engine_import_mfun( env, func ) ) goto error;877 if( !type_engine_import_mfun( env, func ) ) goto error;
870//878
871// // add good()879 // add good()
872// func = make_new_mfun( "int", "good", fileio_good );880 func = make_new_mfun( "int", "good", fileio_good );
873// if( !type_engine_import_mfun( env, func ) ) goto error;881 if( !type_engine_import_mfun( env, func ) ) goto error;
874//882
875// // add close()883 // add close()
876// func = make_new_mfun( "void", "close", fileio_close );884 func = make_new_mfun( "void", "close", fileio_close );
877// if( !type_engine_import_mfun( env, func ) ) goto error;885 if( !type_engine_import_mfun( env, func ) ) goto error;
878//886
879// // add flush()887 // add flush()
880// func = make_new_mfun( "void", "flush", fileio_flush );888 func = make_new_mfun( "void", "flush", fileio_flush );
881// if( !type_engine_import_mfun( env, func ) ) goto error;889 if( !type_engine_import_mfun( env, func ) ) goto error;
882//890
883// // add mode()891 // add mode()
884// func = make_new_mfun( "int", "mode", fileio_getmode );892 func = make_new_mfun( "int", "mode", fileio_getmode );
885// if( !type_engine_import_mfun( env, func ) ) goto error;893 if( !type_engine_import_mfun( env, func ) ) goto error;
886//894
887// // add mode(int)895 // add mode(int)
888// func = make_new_mfun( "int", "mode", fileio_setmode );896 func = make_new_mfun( "int", "mode", fileio_setmode );
889// func->add_arg( "int", "flag" );897 func->add_arg( "int", "flag" );
890// if( !type_engine_import_mfun( env, func ) ) goto error;898 if( !type_engine_import_mfun( env, func ) ) goto error;
891//899
892// // add size()900 // add size()
893// func = make_new_mfun( "int", "size", fileio_size );901 func = make_new_mfun( "int", "size", fileio_size );
894// if( !type_engine_import_mfun( env, func ) ) goto error;902 if( !type_engine_import_mfun( env, func ) ) goto error;
895//903
896// // add seek(int)904 // add seek(int)
897// func = make_new_mfun( "void", "seek", fileio_seek );905 func = make_new_mfun( "void", "seek", fileio_seek );
898// func->add_arg( "int", "pos" );906 func->add_arg( "int", "pos" );
899// if( !type_engine_import_mfun( env, func ) ) goto error;907 if( !type_engine_import_mfun( env, func ) ) goto error;
900//908
901// // add tell()909 // add tell()
902// func = make_new_mfun( "int", "tell", fileio_tell );910 func = make_new_mfun( "int", "tell", fileio_tell );
903// if( !type_engine_import_mfun( env, func ) ) goto error;911 if( !type_engine_import_mfun( env, func ) ) goto error;
904//912
905// // add isDir()913 // add isDir()
906// func = make_new_mfun( "int", "isDir", fileio_isdir );914 func = make_new_mfun( "int", "isDir", fileio_isdir );
907// if( !type_engine_import_mfun( env, func ) ) goto error;915 if( !type_engine_import_mfun( env, func ) ) goto error;
908//916
909// // add dirList()917 // add dirList()
910// func = make_new_mfun( "string[]", "dirList", fileio_dirlist );918 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );
911// if( !type_engine_import_mfun( env, func ) ) goto error;919 if( !type_engine_import_mfun( env, func ) ) goto error;
912//920
913// // add read()921 // add read()
914// // func = make_new_mfun( "string", "read", fileio_read );922 // func = make_new_mfun( "string", "read", fileio_read );
915// // func->add_arg( "int", "length" );923 // func->add_arg( "int", "length" );
916// // if( !type_engine_import_mfun( env, func ) ) goto error;924 // if( !type_engine_import_mfun( env, func ) ) goto error;
917//925
918// // add readLine()926 // add readLine()
919// func = make_new_mfun( "string", "readLine", fileio_readline );927 func = make_new_mfun( "string", "readLine", fileio_readline );
920// if( !type_engine_import_mfun( env, func ) ) goto error;928 if( !type_engine_import_mfun( env, func ) ) goto error;
921//929
922// // add readInt()930 // add readInt()
923// // func = make_new_mfun( "int", "readInt", fileio_readint );931 // func = make_new_mfun( "int", "readInt", fileio_readint );
924// // if( !type_engine_import_mfun( env, func ) ) goto error;932 // if( !type_engine_import_mfun( env, func ) ) goto error;
925//933
926// // add readInt(int)934 // add readInt(int)
927// func = make_new_mfun( "int", "readInt", fileio_readintflags );935 func = make_new_mfun( "int", "readInt", fileio_readintflags );
928// func->add_arg( "int", "flags" );936 func->add_arg( "int", "flags" );
929// if( !type_engine_import_mfun( env, func ) ) goto error;937 if( !type_engine_import_mfun( env, func ) ) goto error;
930//938
931// // add readFloat()939 // add readFloat()
932// // func = make_new_mfun( "float", "readFloat", fileio_readfloat );940 // func = make_new_mfun( "float", "readFloat", fileio_readfloat );
933// // if( !type_engine_import_mfun( env, func ) ) goto error;941 // if( !type_engine_import_mfun( env, func ) ) goto error;
934//942
935// // add eof()943 // add eof()
936// func = make_new_mfun( "int", "eof", fileio_eof );944 func = make_new_mfun( "int", "eof", fileio_eof );
937// if( !type_engine_import_mfun( env, func ) ) goto error;945 if( !type_engine_import_mfun( env, func ) ) goto error;
938//946
939// // add more()947 // add more()
940// func = make_new_mfun( "int", "more", fileio_more );948 func = make_new_mfun( "int", "more", fileio_more );
941// if( !type_engine_import_mfun( env, func ) ) goto error;949 if( !type_engine_import_mfun( env, func ) ) goto error;
942//950
943// // add write(string)951 // add write(string)
944// func = make_new_mfun( "void", "write", fileio_writestring );952 func = make_new_mfun( "void", "write", fileio_writestring );
945// func->add_arg( "string", "val" );953 func->add_arg( "string", "val" );
946// if( !type_engine_import_mfun( env, func ) ) goto error;954 if( !type_engine_import_mfun( env, func ) ) goto error;
947//955
948// // add write(int)956 // add write(int)
949// func = make_new_mfun( "void", "write", fileio_writeint );957 func = make_new_mfun( "void", "write", fileio_writeint );
950// func->add_arg( "int", "val" );958 func->add_arg( "int", "val" );
951// if( !type_engine_import_mfun( env, func ) ) goto error;959 if( !type_engine_import_mfun( env, func ) ) goto error;
952//960
953// // add write(int,flags)961 // add write(int,flags)
954// func = make_new_mfun( "void", "write", fileio_writeintflags );962 func = make_new_mfun( "void", "write", fileio_writeintflags );
955// func->add_arg( "int", "val" );963 func->add_arg( "int", "val" );
956// func->add_arg( "int", "flags" );964 func->add_arg( "int", "flags" );
957// if( !type_engine_import_mfun( env, func ) ) goto error;965 if( !type_engine_import_mfun( env, func ) ) goto error;
958//966
959// // add write(float)967 // add write(float)
960// func = make_new_mfun( "void", "write", fileio_writefloat );968 func = make_new_mfun( "void", "write", fileio_writefloat );
961// func->add_arg( "float", "val" );969 func->add_arg( "float", "val" );
962// if( !type_engine_import_mfun( env, func ) ) goto error;970 if( !type_engine_import_mfun( env, func ) ) goto error;
963//971
964// // add FLAG_READ_WRITE972 // add FLAG_READ_WRITE
965// if( !type_engine_import_svar( env, "int", "READ_WRITE",973 if( !type_engine_import_svar( env, "int", "READ_WRITE",
966// TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READ_WRITE ) ) goto error;974 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READ_WRITE ) ) goto error;
967//975
968// // add FLAG_READONLY976 // add FLAG_READONLY
969// if( !type_engine_import_svar( env, "int", "READ",977 if( !type_engine_import_svar( env, "int", "READ",
970// TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READONLY ) ) goto error;978 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READONLY ) ) goto error;
971//979
972// // add FLAG_WRITEONLY980 // add FLAG_WRITEONLY
973// if( !type_engine_import_svar( env, "int", "WRITE",981 if( !type_engine_import_svar( env, "int", "WRITE",
974// TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_WRITEONLY ) ) goto error;982 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_WRITEONLY ) ) goto error;
975//983
976// // add FLAG_APPEND984 // add FLAG_APPEND
977// if( !type_engine_import_svar( env, "int", "APPEND",985 if( !type_engine_import_svar( env, "int", "APPEND",
978// TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_APPEND ) ) goto error;986 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_APPEND ) ) goto error;
979//987
980// // add TYPE_ASCII988 // add TYPE_ASCII
981// if( !type_engine_import_svar( env, "int", "ASCII",989 if( !type_engine_import_svar( env, "int", "ASCII",
982// TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_ASCII ) ) goto error;990 TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_ASCII ) ) goto error;
983//991
984// // add TYPE_BINARY992 // add TYPE_BINARY
985// if( !type_engine_import_svar( env, "int", "BINARY",993 if( !type_engine_import_svar( env, "int", "BINARY",
986// TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_BINARY ) ) goto error;994 TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_BINARY ) ) goto error;
987//995
988// // end the class import996 // end the class import
989// type_engine_import_class_end( env );997 type_engine_import_class_end( env );
990//998
991// return TRUE;999 return TRUE;
992//1000
993//error:1001error:
994//1002
995// // end the class import1003 // end the class import
996// type_engine_import_class_end( env );1004 type_engine_import_class_end( env );
997//1005
998// return FALSE;1006 return FALSE;
999//}1007}
1008#endif
1000 1009
1001 1010
1002 1011
@@ -1633,442 +1642,443 @@ error: · 630 unmodified lines
1633 1642
1634 1643
1635 1644
1636//// static1645#ifndef __DISABLE_HID__
1637//static t_CKUINT HidIn_offset_data = 0;1646// static
1638//1647static t_CKUINT HidIn_offset_data = 0;
1639//static t_CKUINT HidMsg_offset_device_type = 0;1648
1640//static t_CKUINT HidMsg_offset_device_num = 0;1649static t_CKUINT HidMsg_offset_device_type = 0;
1641//static t_CKUINT HidMsg_offset_type = 0;1650static t_CKUINT HidMsg_offset_device_num = 0;
1642//static t_CKUINT HidMsg_offset_which = 0;1651static t_CKUINT HidMsg_offset_type = 0;
1643//static t_CKUINT HidMsg_offset_idata = 0;1652static t_CKUINT HidMsg_offset_which = 0;
1644//static t_CKUINT HidMsg_offset_fdata = 0;1653static t_CKUINT HidMsg_offset_idata = 0;
1645//static t_CKUINT HidMsg_offset_when = 0;1654static t_CKUINT HidMsg_offset_fdata = 0;
1646//static t_CKUINT HidMsg_offset_deltax = 0;1655static t_CKUINT HidMsg_offset_when = 0;
1647//static t_CKUINT HidMsg_offset_deltay = 0;1656static t_CKUINT HidMsg_offset_deltax = 0;
1648//static t_CKUINT HidMsg_offset_axis_position = 0; // deprecated1657static t_CKUINT HidMsg_offset_deltay = 0;
1649//static t_CKUINT HidMsg_offset_axis_position2 = 0;1658static t_CKUINT HidMsg_offset_axis_position = 0; // deprecated
1650//static t_CKUINT HidMsg_offset_scaled_axis_position = 0; // deprecated1659static t_CKUINT HidMsg_offset_axis_position2 = 0;
1651//static t_CKUINT HidMsg_offset_hat_position = 0;1660static t_CKUINT HidMsg_offset_scaled_axis_position = 0; // deprecated
1652//static t_CKUINT HidMsg_offset_cursorx = 0;1661static t_CKUINT HidMsg_offset_hat_position = 0;
1653//static t_CKUINT HidMsg_offset_cursory = 0;1662static t_CKUINT HidMsg_offset_cursorx = 0;
1654//static t_CKUINT HidMsg_offset_scaledcursorx = 0;1663static t_CKUINT HidMsg_offset_cursory = 0;
1655//static t_CKUINT HidMsg_offset_scaledcursory = 0;1664static t_CKUINT HidMsg_offset_scaledcursorx = 0;
1656//static t_CKUINT HidMsg_offset_x = 0;1665static t_CKUINT HidMsg_offset_scaledcursory = 0;
1657//static t_CKUINT HidMsg_offset_y = 0;1666static t_CKUINT HidMsg_offset_x = 0;
1658//static t_CKUINT HidMsg_offset_z = 0;1667static t_CKUINT HidMsg_offset_y = 0;
1659//static t_CKUINT HidMsg_offset_touchx = 0; // added 1.3.0.01668static t_CKUINT HidMsg_offset_z = 0;
1660//static t_CKUINT HidMsg_offset_touchy = 0; // added 1.3.0.01669static t_CKUINT HidMsg_offset_touchx = 0; // added 1.3.0.0
1661//static t_CKUINT HidMsg_offset_touchsize = 0; // added 1.3.0.01670static t_CKUINT HidMsg_offset_touchy = 0; // added 1.3.0.0
1662//static t_CKUINT HidMsg_offset_ascii = 0;1671static t_CKUINT HidMsg_offset_touchsize = 0; // added 1.3.0.0
1663//static t_CKUINT HidMsg_offset_key = 0;1672static t_CKUINT HidMsg_offset_ascii = 0;
1664//1673static t_CKUINT HidMsg_offset_key = 0;
1665//static t_CKUINT HidOut_offset_data = 0;1674
1666 1675static t_CKUINT HidOut_offset_data = 0;
1667////-----------------------------------------------------------------------------1676
1668//// name: init_class_HID()1677//-----------------------------------------------------------------------------
1669//// desc: ...1678// name: init_class_HID()
1670////-----------------------------------------------------------------------------1679// desc: ...
1671//t_CKBOOL init_class_HID( Chuck_Env * env )1680//-----------------------------------------------------------------------------
1672//{1681t_CKBOOL init_class_HID( Chuck_Env * env )
1673// Chuck_DL_Func * func = NULL;1682{
1674//1683 Chuck_DL_Func * func = NULL;
1675// // init base class1684
1676// if( !type_engine_import_class_begin( env, "HidMsg", "Object",1685 // init base class
1677// env->global(), NULL, NULL ) )1686 if( !type_engine_import_class_begin( env, "HidMsg", "Object",
1678// return FALSE;1687 env->global(), NULL, NULL ) )
1679//1688 return FALSE;
1680// // add member variable1689
1681// HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE );1690 // add member variable
1682// if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error;1691 HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE );
1683//1692 if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error;
1684// // add member variable1693
1685// HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE );1694 // add member variable
1686// if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;1695 HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE );
1687//1696 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;
1688// // add member variable1697
1689// HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE );1698 // add member variable
1690// if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;1699 HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE );
1691//1700 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;
1692// // add member variable1701
1693// HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE );1702 // add member variable
1694// if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;1703 HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE );
1695//1704 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;
1696// // add member variable1705
1697// HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE );1706 // add member variable
1698// if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error;1707 HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE );
1699//1708 if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error;
1700// // add member variable1709
1701// HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE );1710 // add member variable
1702// if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error;1711 HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE );
1703//1712 if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error;
1704// // add member variable1713
1705// HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE );1714 // add member variable
1706// if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error;1715 HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE );
1707//1716 if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error;
1708// // add member variable1717
1709// HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE );1718 // add member variable
1710// if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error;1719 HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE );
1711//1720 if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error;
1712// // add member variable1721
1713// HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE );1722 // add member variable
1714// if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error;1723 HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE );
1715//1724 if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error;
1716// // add member variable1725
1717// HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE );1726 // add member variable
1718// if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error;1727 HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE );
1719//1728 if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error;
1720// // add member variable1729
1721// HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE );1730 // add member variable
1722// if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error;1731 HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE );
1723//1732 if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error;
1724// // add member variable1733
1725// HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE );1734 // add member variable
1726// if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error;1735 HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE );
1727//1736 if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error;
1728// // add member variable1737
1729// HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE );1738 // add member variable
1730// if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error;1739 HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE );
1731//1740 if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error;
1732// // add member variable1741
1733// HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE );1742 // add member variable
1734// if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error;1743 HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE );
1735//1744 if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error;
1736// // add member variable1745
1737// HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE );1746 // add member variable
1738// if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error;1747 HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE );
1739//1748 if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error;
1740// // add member variable1749
1741// HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE );1750 // add member variable
1742// if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error;1751 HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE );
1743//1752 if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error;
1744// // add member variable (added 1.3.0.0)1753
1745// HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE );1754 // add member variable (added 1.3.0.0)
1746// if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error;1755 HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE );
1747//1756 if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error;
1748// // add member variable (added 1.3.0.0)1757
1749// HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE );1758 // add member variable (added 1.3.0.0)
1750// if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;1759 HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE );
1751//1760 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;
1752// // add member variable (added 1.3.0.0)1761
1753// HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE );1762 // add member variable (added 1.3.0.0)
1754// if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;1763 HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE );
1755//1764 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;
1756// // add member variable1765
1757// HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE );1766 // add member variable
1758// if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;1767 HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE );
1759//1768 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;
1760// // add member variable1769
1761// HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE );1770 // add member variable
1762// if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;1771 HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE );
1763//1772 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;
1764// // add member variable1773
1765// HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE );1774 // add member variable
1766// if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;1775 HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE );
1767//1776 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;
1768// // add member variable1777
1769// HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE );1778 // add member variable
1770// if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;1779 HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE );
1771//1780 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;
1772// // add member variable1781
1773// HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE );1782 // add member variable
1774// if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;1783 HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE );
1775//1784 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;
1776// // add member variable1785
1777// HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE );1786 // add member variable
1778// if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error;1787 HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE );
1779//1788 if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error;
1780// // add is_axis_motion()1789
1781// func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated1790 // add is_axis_motion()
1782// if( !type_engine_import_mfun( env, func ) ) goto error;1791 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated
1783//1792 if( !type_engine_import_mfun( env, func ) ) goto error;
1784// // add isAxisMotion()1793
1785// func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );1794 // add isAxisMotion()
1786// if( !type_engine_import_mfun( env, func ) ) goto error;1795 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );
1787//1796 if( !type_engine_import_mfun( env, func ) ) goto error;
1788// // add is_button_down()1797
1789// func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated1798 // add is_button_down()
1790// if( !type_engine_import_mfun( env, func ) ) goto error;1799 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated
1791//1800 if( !type_engine_import_mfun( env, func ) ) goto error;
1792// // add isButtonDown()1801
1793// func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );1802 // add isButtonDown()
1794// if( !type_engine_import_mfun( env, func ) ) goto error;1803 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );
1795//1804 if( !type_engine_import_mfun( env, func ) ) goto error;
1796// // add is_button_up()1805
1797// func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated1806 // add is_button_up()
1798// if( !type_engine_import_mfun( env, func ) ) goto error;1807 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated
1799//1808 if( !type_engine_import_mfun( env, func ) ) goto error;
1800// // add isButtonUp()1809
1801// func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );1810 // add isButtonUp()
1802// if( !type_engine_import_mfun( env, func ) ) goto error;1811 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );
1803//1812 if( !type_engine_import_mfun( env, func ) ) goto error;
1804// // add is_mouse_motion()1813
1805// func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated1814 // add is_mouse_motion()
1806// if( !type_engine_import_mfun( env, func ) ) goto error;1815 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated
1807//1816 if( !type_engine_import_mfun( env, func ) ) goto error;
1808// // add isMouseMotion()1817
1809// func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );1818 // add isMouseMotion()
1810// if( !type_engine_import_mfun( env, func ) ) goto error;1819 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );
1811//1820 if( !type_engine_import_mfun( env, func ) ) goto error;
1812// // add is_hat_motion()1821
1813// func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated1822 // add is_hat_motion()
1814// if( !type_engine_import_mfun( env, func ) ) goto error;1823 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated
1815//1824 if( !type_engine_import_mfun( env, func ) ) goto error;
1816// // add isHatMotion()1825
1817// func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );1826 // add isHatMotion()
1818// if( !type_engine_import_mfun( env, func ) ) goto error;1827 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );
1819//1828 if( !type_engine_import_mfun( env, func ) ) goto error;
1820// // add isWheelMotion()1829
1821// func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );1830 // add isWheelMotion()
1822// if( !type_engine_import_mfun( env, func ) ) goto error;1831 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );
1823//1832 if( !type_engine_import_mfun( env, func ) ) goto error;
1824// // end the class import1833
1825// type_engine_import_class_end( env );1834 // end the class import
1826//1835 type_engine_import_class_end( env );
1827//1836
1828// // register deprecate1837
1829// type_engine_register_deprecate( env, "HidIn", "Hid" );1838 // register deprecate
1830//1839 type_engine_register_deprecate( env, "HidIn", "Hid" );
1831// // init base class Hid (copy of HidIn + constants)1840
1832// if( !type_engine_import_class_begin( env, "Hid", "Event",1841 // init base class Hid (copy of HidIn + constants)
1833// env->global(), HidIn_ctor, HidIn_dtor ) )1842 if( !type_engine_import_class_begin( env, "Hid", "Event",
1834// return FALSE;1843 env->global(), HidIn_ctor, HidIn_dtor ) )
1835//1844 return FALSE;
1836// // add open()1845
1837// func = make_new_mfun( "int", "open", HidIn_open );1846 // add open()
1838// func->add_arg( "int", "type" );1847 func = make_new_mfun( "int", "open", HidIn_open );
1839// func->add_arg( "int", "num" );1848 func->add_arg( "int", "type" );
1840// if( !type_engine_import_mfun( env, func ) ) goto error;1849 func->add_arg( "int", "num" );
1841//1850 if( !type_engine_import_mfun( env, func ) ) goto error;
1842// // add open()1851
1843// func = make_new_mfun( "int", "open", HidIn_open_named );1852 // add open()
1844// func->add_arg( "string", "name" );1853 func = make_new_mfun( "int", "open", HidIn_open_named );
1845// if( !type_engine_import_mfun( env, func ) ) goto error;1854 func->add_arg( "string", "name" );
1846//1855 if( !type_engine_import_mfun( env, func ) ) goto error;
1847// // add openJoystick()1856
1848// func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );1857 // add openJoystick()
1849// func->add_arg( "int", "num" );1858 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );
1850// if( !type_engine_import_mfun( env, func ) ) goto error;1859 func->add_arg( "int", "num" );
1851//1860 if( !type_engine_import_mfun( env, func ) ) goto error;
1852// // add openMouse()
1853// func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );
1854// func->add_arg( "int", "num" );
1855// if( !type_engine_import_mfun( env, func ) ) goto error;
1856//
1857// // add openKeyboard()
1858// func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );
1859// func->add_arg( "int", "num" );
1860// if( !type_engine_import_mfun( env, func ) ) goto error;
1861//
1862// // add openTiltSensor()
1863// func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );
1864// if( !type_engine_import_mfun( env, func ) ) goto error;
1865//
1866// // add good()
1867// func = make_new_mfun( "int", "good", HidIn_good );
1868// if( !type_engine_import_mfun( env, func ) ) goto error;
1869//
1870// // add num()
1871// func = make_new_mfun( "int", "num", HidIn_num );
1872// if( !type_engine_import_mfun( env, func ) ) goto error;
1873//
1874// // add name()
1875// func = make_new_mfun( "string", "name", HidIn_name );
1876// if( !type_engine_import_mfun( env, func ) ) goto error;
1877//
1878// // add printerr()
1879// func = make_new_mfun( "void", "printerr", HidIn_printerr );
1880// func->add_arg( "int", "print_or_not" );
1881// if( !type_engine_import_mfun( env, func ) ) goto error;
1882//
1883// // add recv()
1884// func = make_new_mfun( "int", "recv", HidIn_recv );
1885// func->add_arg( "HidMsg", "msg" );
1886// if( !type_engine_import_mfun( env, func ) ) goto error;
1887//
1888// // add read()
1889// func = make_new_mfun( "int", "read", HidIn_read );
1890// func->add_arg( "int", "type" );
1891// func->add_arg( "int", "which" );
1892// func->add_arg( "HidMsg", "msg" );
1893// if( !type_engine_import_mfun( env, func ) ) goto error;
1894//
1895// // add send()
1896// func = make_new_mfun( "int", "send", HidIn_send );
1897// func->add_arg( "HidMsg", "msg" );
1898// if( !type_engine_import_mfun( env, func ) ) goto error;
1899//
1900// // add can_wait()
1901// func = make_new_mfun( "int", "can_wait", HidIn_can_wait );
1902// if( !type_engine_import_mfun( env, func ) ) goto error;
1903//
1904// // add readTiltSensor()
1905// func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );
1906// if( !type_engine_import_sfun( env, func ) ) goto error;
1907//
1908// // add globalTiltPollRate()
1909// func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );
1910// func->add_arg( "dur", "d" );
1911// if( !type_engine_import_sfun( env, func ) ) goto error;
1912//
1913// // add globalTiltPollRate()
1914// func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );
1915// if( !type_engine_import_sfun( env, func ) ) goto error;
1916//
1917// // add startCursorTrack()
1918// func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );
1919// if( !type_engine_import_sfun( env, func ) ) goto error;
1920//
1921// // add stopCursorTrack()
1922// func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );
1923// if( !type_engine_import_sfun( env, func ) ) goto error;
1924//
1925// // add member variable
1926// HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE );
1927// if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error;
1928//
1929// // add static member variable joystick
1930// if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE,
1931// ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE )
1932// goto error;
1933//
1934// // add static member variable keyboard
1935// if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE,
1936// ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE )
1937// goto error;
1938//
1939// // add static member variable mouse
1940// if( type_engine_import_svar( env, "int", "MOUSE", TRUE,
1941// ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE )
1942// goto error;
1943//
1944// // add static member variable wii_remote
1945// if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE,
1946// ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE )
1947// goto error;
1948//
1949// // add static member variable wii_remote
1950// if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE,
1951// ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE )
1952// goto error;
1953//
1954// // add static member variable tablet
1955// if( type_engine_import_svar( env, "int", "TABLET", TRUE,
1956// ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE )
1957// goto error;
1958//
1959// // add static member variable axisMotion
1960// if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE,
1961// ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE )
1962// goto error;
1963//
1964// // add static member variable buttonDown
1965// if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE,
1966// ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE )
1967// goto error;
1968//
1969// // add static member variable buttonUp
1970// if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE,
1971// ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE )
1972// goto error;
1973//
1974// // add static member variable joystickHat
1975// if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE,
1976// ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE )
1977// goto error;
1978//
1979// // add static member variable JOYSTICK_BALL
1980// if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE,
1981// ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE )
1982// goto error;
1983//
1984// // add static member variable mouseMotion
1985// if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE,
1986// ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE )
1987// goto error;
1988//
1989// // add static member variable mouseWheel
1990// if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE,
1991// ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE )
1992// goto error;
1993//
1994// // add static member variable DEVICE_CONNECTED
1995// if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE,
1996// ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE )
1997// goto error;
1998//
1999// // add static member variable DEVICE_DISCONNECTED
2000// if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE,
2001// ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE )
2002// goto error;
2003//
2004// // add static member variable ACCELEROMETER
2005// if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE,
2006// ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE )
2007// goto error;
2008//
2009// // add static member variable LED
2010// if( type_engine_import_svar( env, "int", "LED", TRUE,
2011// ( t_CKUINT ) &CK_HID_LED ) == FALSE )
2012// goto error;
2013//
2014// // add static member variable LED
2015// if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE,
2016// ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE )
2017// goto error;
2018//
2019// // end the class import
2020// type_engine_import_class_end( env );
2021//
2022// /*
2023// // init base class
2024// if( !type_engine_import_class_begin( env, "HidOut", "Object",
2025// env->global(), HidOut_ctor ) )
2026// return FALSE;
2027//
2028// // add open()
2029// func = make_new_mfun( "int", "open", HidOut_open );
2030// func->add_arg( "int", "port" );
2031// if( !type_engine_import_mfun( env, func ) ) goto error;
2032//
2033// // add good()
2034// func = make_new_mfun( "int", "good", HidOut_good );
2035// if( !type_engine_import_mfun( env, func ) ) goto error;
2036//
2037// // add num()
2038// func = make_new_mfun( "int", "num", HidOut_num );
2039// if( !type_engine_import_mfun( env, func ) ) goto error;
2040//
2041// // add name()
2042// func = make_new_mfun( "string", "name", HidOut_name );
2043// if( !type_engine_import_mfun( env, func ) ) goto error;
2044//
2045// // add printerr()
2046// func = make_new_mfun( "void", "printerr", HidOut_printerr );
2047// func->add_arg( "int", "print_or_not" );
2048// if( !type_engine_import_mfun( env, func ) ) goto error;
2049//
2050// // add send()
2051// func = make_new_mfun( "int", "send", HidOut_send );
2052// func->add_arg( "HidMsg", "msg" );
2053// if( !type_engine_import_mfun( env, func ) ) goto error;
2054//
2055// // add member variable
2056// HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE );
2057// if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error;
2058//
2059// // end the class import
2060// type_engine_import_class_end( env );
2061// */
2062// return TRUE;
2063//
2064//error:
2065//
2066// // end the class import
2067// type_engine_import_class_end( env );
2068//
2069// return FALSE;
2070//}
2071 1861
1862 // add openMouse()
1863 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );
1864 func->add_arg( "int", "num" );
1865 if( !type_engine_import_mfun( env, func ) ) goto error;
1866
1867 // add openKeyboard()
1868 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );
1869 func->add_arg( "int", "num" );
1870 if( !type_engine_import_mfun( env, func ) ) goto error;
1871
1872 // add openTiltSensor()
1873 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );
1874 if( !type_engine_import_mfun( env, func ) ) goto error;
1875
1876 // add good()
1877 func = make_new_mfun( "int", "good", HidIn_good );
1878 if( !type_engine_import_mfun( env, func ) ) goto error;
1879
1880 // add num()
1881 func = make_new_mfun( "int", "num", HidIn_num );
1882 if( !type_engine_import_mfun( env, func ) ) goto error;
1883
1884 // add name()
1885 func = make_new_mfun( "string", "name", HidIn_name );
1886 if( !type_engine_import_mfun( env, func ) ) goto error;
1887
1888 // add printerr()
1889 func = make_new_mfun( "void", "printerr", HidIn_printerr );
1890 func->add_arg( "int", "print_or_not" );
1891 if( !type_engine_import_mfun( env, func ) ) goto error;
1892
1893 // add recv()
1894 func = make_new_mfun( "int", "recv", HidIn_recv );
1895 func->add_arg( "HidMsg", "msg" );
1896 if( !type_engine_import_mfun( env, func ) ) goto error;
1897
1898 // add read()
1899 func = make_new_mfun( "int", "read", HidIn_read );
1900 func->add_arg( "int", "type" );
1901 func->add_arg( "int", "which" );
1902 func->add_arg( "HidMsg", "msg" );
1903 if( !type_engine_import_mfun( env, func ) ) goto error;
1904
1905 // add send()
1906 func = make_new_mfun( "int", "send", HidIn_send );
1907 func->add_arg( "HidMsg", "msg" );
1908 if( !type_engine_import_mfun( env, func ) ) goto error;
1909
1910 // add can_wait()
1911 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );
1912 if( !type_engine_import_mfun( env, func ) ) goto error;
1913
1914 // add readTiltSensor()
1915 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );
1916 if( !type_engine_import_sfun( env, func ) ) goto error;
1917
1918 // add globalTiltPollRate()
1919 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );
1920 func->add_arg( "dur", "d" );
1921 if( !type_engine_import_sfun( env, func ) ) goto error;
1922
1923 // add globalTiltPollRate()
1924 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );
1925 if( !type_engine_import_sfun( env, func ) ) goto error;
1926
1927 // add startCursorTrack()
1928 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );
1929 if( !type_engine_import_sfun( env, func ) ) goto error;
1930
1931 // add stopCursorTrack()
1932 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );
1933 if( !type_engine_import_sfun( env, func ) ) goto error;
1934
1935 // add member variable
1936 HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE );
1937 if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error;
1938
1939 // add static member variable joystick
1940 if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE,
1941 ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE )
1942 goto error;
1943
1944 // add static member variable keyboard
1945 if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE,
1946 ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE )
1947 goto error;
1948
1949 // add static member variable mouse
1950 if( type_engine_import_svar( env, "int", "MOUSE", TRUE,
1951 ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE )
1952 goto error;
1953
1954 // add static member variable wii_remote
1955 if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE,
1956 ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE )
1957 goto error;
1958
1959 // add static member variable wii_remote
1960 if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE,
1961 ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE )
1962 goto error;
1963
1964 // add static member variable tablet
1965 if( type_engine_import_svar( env, "int", "TABLET", TRUE,
1966 ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE )
1967 goto error;
1968
1969 // add static member variable axisMotion
1970 if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE,
1971 ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE )
1972 goto error;
1973
1974 // add static member variable buttonDown
1975 if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE,
1976 ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE )
1977 goto error;
1978
1979 // add static member variable buttonUp
1980 if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE,
1981 ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE )
1982 goto error;
1983
1984 // add static member variable joystickHat
1985 if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE,
1986 ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE )
1987 goto error;
1988
1989 // add static member variable JOYSTICK_BALL
1990 if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE,
1991 ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE )
1992 goto error;
1993
1994 // add static member variable mouseMotion
1995 if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE,
1996 ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE )
1997 goto error;
1998
1999 // add static member variable mouseWheel
2000 if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE,
2001 ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE )
2002 goto error;
2003
2004 // add static member variable DEVICE_CONNECTED
2005 if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE,
2006 ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE )
2007 goto error;
2008
2009 // add static member variable DEVICE_DISCONNECTED
2010 if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE,
2011 ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE )
2012 goto error;
2013
2014 // add static member variable ACCELEROMETER
2015 if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE,
2016 ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE )
2017 goto error;
2018
2019 // add static member variable LED
2020 if( type_engine_import_svar( env, "int", "LED", TRUE,
2021 ( t_CKUINT ) &CK_HID_LED ) == FALSE )
2022 goto error;
2023
2024 // add static member variable LED
2025 if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE,
2026 ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE )
2027 goto error;
2028
2029 // end the class import
2030 type_engine_import_class_end( env );
2031
2032 /*
2033 // init base class
2034 if( !type_engine_import_class_begin( env, "HidOut", "Object",
2035 env->global(), HidOut_ctor ) )
2036 return FALSE;
2037
2038 // add open()
2039 func = make_new_mfun( "int", "open", HidOut_open );
2040 func->add_arg( "int", "port" );
2041 if( !type_engine_import_mfun( env, func ) ) goto error;
2042
2043 // add good()
2044 func = make_new_mfun( "int", "good", HidOut_good );
2045 if( !type_engine_import_mfun( env, func ) ) goto error;
2046
2047 // add num()
2048 func = make_new_mfun( "int", "num", HidOut_num );
2049 if( !type_engine_import_mfun( env, func ) ) goto error;
2050
2051 // add name()
2052 func = make_new_mfun( "string", "name", HidOut_name );
2053 if( !type_engine_import_mfun( env, func ) ) goto error;
2054
2055 // add printerr()
2056 func = make_new_mfun( "void", "printerr", HidOut_printerr );
2057 func->add_arg( "int", "print_or_not" );
2058 if( !type_engine_import_mfun( env, func ) ) goto error;
2059
2060 // add send()
2061 func = make_new_mfun( "int", "send", HidOut_send );
2062 func->add_arg( "HidMsg", "msg" );
2063 if( !type_engine_import_mfun( env, func ) ) goto error;
2064
2065 // add member variable
2066 HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE );
2067 if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error;
2068
2069 // end the class import
2070 type_engine_import_class_end( env );
2071 */
2072 return TRUE;
2073
2074error:
2075
2076 // end the class import
2077 type_engine_import_class_end( env );
2078
2079 return FALSE;
2080}
2081#endif
2072 2082
2073 2083
2074 2084
@@ -2962,313 +2972,319 @@ CK_DLL_SFUN( io_newline ) · 887 unmodified lines
2962}2972}
2963 2973
2964 2974
2975
2976
2977#ifndef __DISABLE_FILEIO__
2965//-----------------------------------------------------------------------------2978//-----------------------------------------------------------------------------
2966// FileIO API2979// FileIO API
2967//-----------------------------------------------------------------------------2980//-----------------------------------------------------------------------------
2968//CK_DLL_CTOR( fileio_ctor )2981CK_DLL_CTOR( fileio_ctor )
2969//{ } 2982{ }
2970//2983
2971//CK_DLL_DTOR( fileio_dtor )2984CK_DLL_DTOR( fileio_dtor )
2972//{ }2985{ }
2973//2986
2974//CK_DLL_MFUN( fileio_open )2987CK_DLL_MFUN( fileio_open )
2975//{2988{
2976// std::string filename = GET_NEXT_STRING(ARGS)->str();2989 std::string filename = GET_NEXT_STRING(ARGS)->str();
2977// Chuck_IO_File * f = (Chuck_IO_File *)SELF;2990 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
2978// t_CKINT default_flags =2991 t_CKINT default_flags =
2979// Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII;2992 Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII;
2980//2993
2981// RETURN->v_int = f->open(filename, default_flags);2994 RETURN->v_int = f->open(filename, default_flags);
2982//}2995}
2983//2996
2984//CK_DLL_MFUN( fileio_openflags )2997CK_DLL_MFUN( fileio_openflags )
2985//{2998{
2986// Chuck_IO_File * f = (Chuck_IO_File *)SELF;2999 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
2987// std::string filename = GET_NEXT_STRING(ARGS)->str();3000 std::string filename = GET_NEXT_STRING(ARGS)->str();
2988// t_CKINT flags = GET_NEXT_INT(ARGS);3001 t_CKINT flags = GET_NEXT_INT(ARGS);
2989//3002
2990// RETURN->v_int = f->open(filename, flags);3003 RETURN->v_int = f->open(filename, flags);
2991//}3004}
2992//3005
2993//CK_DLL_MFUN( fileio_close )3006CK_DLL_MFUN( fileio_close )
2994//{3007{
2995// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3008 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
2996// f->close();3009 f->close();
2997//}3010}
2998//3011
2999//CK_DLL_MFUN( fileio_good )3012CK_DLL_MFUN( fileio_good )
3000//{3013{
3001// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3014 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3002// RETURN->v_int = f->good();3015 RETURN->v_int = f->good();
3003//}3016}
3004//3017
3005//CK_DLL_MFUN( fileio_flush )3018CK_DLL_MFUN( fileio_flush )
3006//{3019{
3007// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3020 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3008// f->flush();3021 f->flush();
3009//}3022}
3010//3023
3011//CK_DLL_MFUN( fileio_getmode )3024CK_DLL_MFUN( fileio_getmode )
3012//{3025{
3013// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3026 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3014// RETURN->v_int = f->mode();3027 RETURN->v_int = f->mode();
3015//}3028}
3016//3029
3017//CK_DLL_MFUN( fileio_setmode )3030CK_DLL_MFUN( fileio_setmode )
3018//{3031{
3019// t_CKINT flag = GET_NEXT_INT(ARGS);3032 t_CKINT flag = GET_NEXT_INT(ARGS);
3020// 3033
3021// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3034 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3022// f->mode( flag );3035 f->mode( flag );
3023// RETURN->v_int = 0;3036 RETURN->v_int = 0;
3024//}3037}
3025//3038
3026//CK_DLL_MFUN( fileio_size )3039CK_DLL_MFUN( fileio_size )
3027//{3040{
3028// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3041 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3029// RETURN->v_int = f->size();3042 RETURN->v_int = f->size();
3030//}3043}
3031//3044
3032//CK_DLL_MFUN( fileio_seek )3045CK_DLL_MFUN( fileio_seek )
3033//{3046{
3034// t_CKINT pos = GET_NEXT_INT(ARGS);3047 t_CKINT pos = GET_NEXT_INT(ARGS);
3035// 3048
3036// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3049 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3037// f->seek(pos);3050 f->seek(pos);
3038//}3051}
3039//3052
3040//CK_DLL_MFUN( fileio_tell )3053CK_DLL_MFUN( fileio_tell )
3041//{3054{
3042// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3055 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3043// RETURN->v_int = f->tell();3056 RETURN->v_int = f->tell();
3044//}3057}
3045//3058
3046//CK_DLL_MFUN( fileio_isdir )3059CK_DLL_MFUN( fileio_isdir )
3047//{3060{
3048// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3061 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3049// RETURN->v_int = f->isDir();3062 RETURN->v_int = f->isDir();
3050//}3063}
3051//3064
3052//CK_DLL_MFUN( fileio_dirlist )3065CK_DLL_MFUN( fileio_dirlist )
3053//{3066{
3054// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3067 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3055// Chuck_Array4 * a = f->dirList();3068 Chuck_Array4 * a = f->dirList();
3056// RETURN->v_object = a;3069 RETURN->v_object = a;
3057//}3070}
3058//3071
3059///*3072/*
3060//CK_DLL_MFUN( fileio_read )3073CK_DLL_MFUN( fileio_read )
3061//{3074{
3062// t_CKINT len = GET_NEXT_INT(ARGS);3075 t_CKINT len = GET_NEXT_INT(ARGS);
3063// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3076 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3064// 3077
3065// Chuck_String * s = f->read( len );3078 Chuck_String * s = f->read( len );
3066// RETURN->v_object = s;3079 RETURN->v_object = s;
3067//}3080}
3068//*/3081*/
3069//3082
3070//CK_DLL_MFUN( fileio_readline )3083CK_DLL_MFUN( fileio_readline )
3071//{3084{
3072// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3085 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3073// Chuck_String * ret = f->readLine();3086 Chuck_String * ret = f->readLine();
3074// RETURN->v_object = ret;3087 RETURN->v_object = ret;
3075//}3088}
3076//3089
3077//CK_DLL_MFUN( fileio_readint )3090CK_DLL_MFUN( fileio_readint )
3078//{3091{
3079// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3092 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3080// t_CKINT defaultflags = Chuck_IO::INT32;3093 t_CKINT defaultflags = Chuck_IO::INT32;
3081// 3094
3082// /* (ATODO: doesn't look like asynchronous reading will work)3095 /* (ATODO: doesn't look like asynchronous reading will work)
3083// if (f->mode() == Chuck_IO::MODE_ASYNC)3096 if (f->mode() == Chuck_IO::MODE_ASYNC)
3084// {3097 {
3085// // set up arguments3098 // set up arguments
3086// Chuck_IO::async_args *args = new Chuck_IO::async_args;3099 Chuck_IO::async_args *args = new Chuck_IO::async_args;
3087// args->RETURN = (void *)RETURN;3100 args->RETURN = (void *)RETURN;
3088// args->fileio_obj = f;3101 args->fileio_obj = f;
3089// args->intArg = defaultflags;3102 args->intArg = defaultflags;
3090// // set shred to wait for I/O completion3103 // set shred to wait for I/O completion
3091// f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );3104 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
3092// // start thread3105 // start thread
3093// bool ret = f->m_thread->start( f->readInt_thread, (void *)args );3106 bool ret = f->m_thread->start( f->readInt_thread, (void *)args );
3094// if (!ret) {3107 if (!ret) {
3095// cerr << "m_thread->start failed; recreating m_thread" << endl;3108 cerr << "m_thread->start failed; recreating m_thread" << endl;
3096// delete f->m_thread;3109 delete f->m_thread;
3097// f->m_thread = new XThread;3110 f->m_thread = new XThread;
3098// ret = f->m_thread->start( f->readInt_thread, (void *)args );3111 ret = f->m_thread->start( f->readInt_thread, (void *)args );
3099// if (!ret) {3112 if (!ret) {
3100// EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );3113 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
3101// }3114 }
3102// }3115 }
3103// } else {*/3116 } else {*/
3104// t_CKINT ret = f->readInt( defaultflags );3117 t_CKINT ret = f->readInt( defaultflags );
3105// RETURN->v_int = ret;3118 RETURN->v_int = ret;
3106// //}3119 //}
3107// // ATODO: Debug3120 // ATODO: Debug
3108// //sleep(1);3121 //sleep(1);
3109// //cerr << "fileio_readint exiting" << endl;3122 //cerr << "fileio_readint exiting" << endl;
3110//}3123}
3111//3124
3112//CK_DLL_MFUN( fileio_readintflags )3125CK_DLL_MFUN( fileio_readintflags )
3113//{ 3126{
3114// t_CKINT flags = GET_NEXT_INT(ARGS);3127 t_CKINT flags = GET_NEXT_INT(ARGS);
3115// 3128
3116// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3129 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3117// t_CKINT ret = f->readInt( flags );3130 t_CKINT ret = f->readInt( flags );
3118// 3131
3119// RETURN->v_int = ret;3132 RETURN->v_int = ret;
3120//}3133}
3121//3134
3122//CK_DLL_MFUN( fileio_readfloat )3135CK_DLL_MFUN( fileio_readfloat )
3123//{3136{
3124// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3137 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3125// t_CKFLOAT ret = f->readFloat();3138 t_CKFLOAT ret = f->readFloat();
3126// RETURN->v_float = ret;3139 RETURN->v_float = ret;
3127//}3140}
3128//3141
3129//CK_DLL_MFUN( fileio_eof )3142CK_DLL_MFUN( fileio_eof )
3130//{3143{
3131// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3144 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3132// t_CKBOOL ret = f->eof();3145 t_CKBOOL ret = f->eof();
3133// RETURN->v_int = ret;3146 RETURN->v_int = ret;
3134//}3147}
3135//3148
3136//CK_DLL_MFUN( fileio_more )3149CK_DLL_MFUN( fileio_more )
3137//{3150{
3138// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3151 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3139// t_CKBOOL ret = !f->eof();3152 t_CKBOOL ret = !f->eof();
3140// RETURN->v_int = ret;3153 RETURN->v_int = ret;
3141//}3154}
3142//3155
3143//CK_DLL_MFUN( fileio_writestring )3156CK_DLL_MFUN( fileio_writestring )
3144//{3157{
3145// std::string val = GET_NEXT_STRING(ARGS)->str();3158 std::string val = GET_NEXT_STRING(ARGS)->str();
3146// 3159
3147// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3160 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3148// if (f->mode() == Chuck_IO::MODE_ASYNC)3161 if (f->mode() == Chuck_IO::MODE_ASYNC)
3149// {3162 {
3150// // set up arguments3163 // set up arguments
3151// Chuck_IO::async_args *args = new Chuck_IO::async_args;3164 Chuck_IO::async_args *args = new Chuck_IO::async_args;
3152// args->RETURN = (void *)RETURN;3165 args->RETURN = (void *)RETURN;
3153// args->fileio_obj = f;3166 args->fileio_obj = f;
3154// args->stringArg = std::string(val);3167 args->stringArg = std::string(val);
3155// // set shred to wait for I/O completion3168 // set shred to wait for I/O completion
3156// assert( SHRED != NULL );3169 assert( SHRED != NULL );
3157// f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );3170 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
3158// // start thread3171 // start thread
3159// bool ret = f->m_thread->start( f->writeStr_thread, (void *)args );3172 bool ret = f->m_thread->start( f->writeStr_thread, (void *)args );
3160// if (!ret) {3173 if (!ret) {
3161// // for some reason, the XThread object needs to be3174 // for some reason, the XThread object needs to be
3162// // deleted and reconstructed every time after call #3753175 // deleted and reconstructed every time after call #375
3163// delete f->m_thread;3176 delete f->m_thread;
3164// f->m_thread = new XThread;3177 f->m_thread = new XThread;
3165// ret = f->m_thread->start( f->writeStr_thread, (void *)args );3178 ret = f->m_thread->start( f->writeStr_thread, (void *)args );
3166// if (!ret) {3179 if (!ret) {
3167// EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );3180 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
3168// }3181 }
3169// }3182 }
3170// } else {3183 } else {
3171// f->write(val);3184 f->write(val);
3172// }3185 }
3173//}3186}
3174//3187
3175//CK_DLL_MFUN( fileio_writeint )3188CK_DLL_MFUN( fileio_writeint )
3176//{3189{
3177// t_CKINT val = GET_NEXT_INT(ARGS);3190 t_CKINT val = GET_NEXT_INT(ARGS);
3178// 3191
3179// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3192 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3180// if (f->mode() == Chuck_IO::MODE_ASYNC)3193 if (f->mode() == Chuck_IO::MODE_ASYNC)
3181// {3194 {
3182// // set up arguments3195 // set up arguments
3183// Chuck_IO::async_args *args = new Chuck_IO::async_args;3196 Chuck_IO::async_args *args = new Chuck_IO::async_args;
3184// args->RETURN = (void *)RETURN;3197 args->RETURN = (void *)RETURN;
3185// args->fileio_obj = f;3198 args->fileio_obj = f;
3186// args->intArg = val;3199 args->intArg = val;
3187// // set shred to wait for I/O completion3200 // set shred to wait for I/O completion
3188// assert( SHRED != NULL );3201 assert( SHRED != NULL );
3189// f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );3202 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
3190// // start thread3203 // start thread
3191// bool ret = f->m_thread->start( f->writeInt_thread, (void *)args );3204 bool ret = f->m_thread->start( f->writeInt_thread, (void *)args );
3192// if (!ret) {3205 if (!ret) {
3193// // for some reason, the XThread object needs to be3206 // for some reason, the XThread object needs to be
3194// // deleted and reconstructed every time after call #3753207 // deleted and reconstructed every time after call #375
3195// delete f->m_thread;3208 delete f->m_thread;
3196// f->m_thread = new XThread;3209 f->m_thread = new XThread;
3197// ret = f->m_thread->start( f->writeInt_thread, (void *)args );3210 ret = f->m_thread->start( f->writeInt_thread, (void *)args );
3198// if (!ret) {3211 if (!ret) {
3199// EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );3212 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
3200// }3213 }
3201// }3214 }
3202// } else {3215 } else {
3203// f->write(val);3216 f->write(val);
3204// }3217 }
3205//}3218}
3206//3219
3207//CK_DLL_MFUN( fileio_writeintflags )3220CK_DLL_MFUN( fileio_writeintflags )
3208//{3221{
3209// t_CKINT val = GET_NEXT_INT(ARGS);3222 t_CKINT val = GET_NEXT_INT(ARGS);
3210// t_CKINT flags = GET_NEXT_INT(ARGS);3223 t_CKINT flags = GET_NEXT_INT(ARGS);
3211// 3224
3212// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3225 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3213// if (f->mode() == Chuck_IO::MODE_ASYNC)3226 if (f->mode() == Chuck_IO::MODE_ASYNC)
3214// {3227 {
3215// // TODO: pass flags in args3228 // TODO: pass flags in args
3216// // set up arguments3229 // set up arguments
3217// Chuck_IO::async_args *args = new Chuck_IO::async_args;3230 Chuck_IO::async_args *args = new Chuck_IO::async_args;
3218// args->RETURN = (void *)RETURN;3231 args->RETURN = (void *)RETURN;
3219// args->fileio_obj = f;3232 args->fileio_obj = f;
3220// args->intArg = val;3233 args->intArg = val;
3221// // set shred to wait for I/O completion3234 // set shred to wait for I/O completion
3222// assert( SHRED != NULL );3235 assert( SHRED != NULL );
3223// f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );3236 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
3224// // start thread3237 // start thread
3225// bool ret = f->m_thread->start( f->writeInt_thread, (void *)args );3238 bool ret = f->m_thread->start( f->writeInt_thread, (void *)args );
3226// if (!ret) {3239 if (!ret) {
3227// // for some reason, the XThread object needs to be3240 // for some reason, the XThread object needs to be
3228// // deleted and reconstructed every time after call #3753241 // deleted and reconstructed every time after call #375
3229// delete f->m_thread;3242 delete f->m_thread;
3230// f->m_thread = new XThread;3243 f->m_thread = new XThread;
3231// ret = f->m_thread->start( f->writeInt_thread, (void *)args );3244 ret = f->m_thread->start( f->writeInt_thread, (void *)args );
3232// if (!ret) {3245 if (!ret) {
3233// EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );3246 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
3234// }3247 }
3235// }3248 }
3236// } else {3249 } else {
3237// f->write(val, flags);3250 f->write(val, flags);
3238// }3251 }
3239//}3252}
3240//3253
3241//CK_DLL_MFUN( fileio_writefloat )3254CK_DLL_MFUN( fileio_writefloat )
3242//{3255{
3243// t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);3256 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);
3244// 3257
3245// Chuck_IO_File * f = (Chuck_IO_File *)SELF;3258 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
3246// if (f->mode() == Chuck_IO::MODE_ASYNC)3259 if (f->mode() == Chuck_IO::MODE_ASYNC)
3247// {3260 {
3248// // set up arguments3261 // set up arguments
3249// Chuck_IO::async_args *args = new Chuck_IO::async_args;3262 Chuck_IO::async_args *args = new Chuck_IO::async_args;
3250// args->RETURN = (void *)RETURN;3263 args->RETURN = (void *)RETURN;
3251// args->fileio_obj = f;3264 args->fileio_obj = f;
3252// args->floatArg = val;3265 args->floatArg = val;
3253// // set shred to wait for I/O completion3266 // set shred to wait for I/O completion
3254// assert( SHRED != NULL );3267 assert( SHRED != NULL );
3255// f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );3268 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
3256// // start thread3269 // start thread
3257// bool ret = f->m_thread->start( f->writeFloat_thread, (void *)args );3270 bool ret = f->m_thread->start( f->writeFloat_thread, (void *)args );
3258// if (!ret) {3271 if (!ret) {
3259// // for some reason, the XThread object needs to be3272 // for some reason, the XThread object needs to be
3260// // deleted and reconstructed every time after call #3753273 // deleted and reconstructed every time after call #375
3261// delete f->m_thread;3274 delete f->m_thread;
3262// f->m_thread = new XThread;3275 f->m_thread = new XThread;
3263// ret = f->m_thread->start( f->writeFloat_thread, (void *)args );3276 ret = f->m_thread->start( f->writeFloat_thread, (void *)args );
3264// if (!ret) {3277 if (!ret) {
3265// EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );3278 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
3266// }3279 }
3267// }3280 }
3268// } else {3281 } else {
3269// f->write(val);3282 f->write(val);
3270// }3283 }
3271//}3284}
3285#endif
3286
3287
3272 3288
3273 3289
3274//-----------------------------------------------------------------------------3290//-----------------------------------------------------------------------------
@@ -4336,403 +4352,409 @@ CK_DLL_MFUN( MidiOut_send ) · 1061 unmodified lines
4336#endif // __DISABLE_MIDI__4352#endif // __DISABLE_MIDI__
4337 4353
4338 4354
4339////-----------------------------------------------------------------------------4355
4340//// HidMsg API4356
4341////-----------------------------------------------------------------------------4357#ifndef __DISABLE_HID__
4342//CK_DLL_MFUN( HidMsg_is_axis_motion )4358//-----------------------------------------------------------------------------
4343//{4359// HidMsg API
4344// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4360//-----------------------------------------------------------------------------
4345// CK_HID_JOYSTICK_AXIS ? 1 : 0 );4361CK_DLL_MFUN( HidMsg_is_axis_motion )
4346//}4362{
4347//4363 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4348//CK_DLL_MFUN( HidMsg_is_button_down )4364 CK_HID_JOYSTICK_AXIS ? 1 : 0 );
4349//{4365}
4350// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4366
4351// CK_HID_BUTTON_DOWN ? 1 : 0 );4367CK_DLL_MFUN( HidMsg_is_button_down )
4352//}4368{
4353//4369 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4354//CK_DLL_MFUN( HidMsg_is_button_up )4370 CK_HID_BUTTON_DOWN ? 1 : 0 );
4355//{4371}
4356// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4372
4357// CK_HID_BUTTON_UP ? 1 : 0 );4373CK_DLL_MFUN( HidMsg_is_button_up )
4358//}4374{
4359//4375 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4360//CK_DLL_MFUN( HidMsg_is_mouse_motion )4376 CK_HID_BUTTON_UP ? 1 : 0 );
4361//{4377}
4362// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4378
4363// CK_HID_MOUSE_MOTION ? 1 : 0 );4379CK_DLL_MFUN( HidMsg_is_mouse_motion )
4364//}4380{
4365//4381 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4366//CK_DLL_MFUN( HidMsg_is_hat_motion )4382 CK_HID_MOUSE_MOTION ? 1 : 0 );
4367//{4383}
4368// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4384
4369// CK_HID_JOYSTICK_HAT ? 1 : 0 );4385CK_DLL_MFUN( HidMsg_is_hat_motion )
4370//}4386{
4371//4387 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4372//CK_DLL_MFUN( HidMsg_is_wheel_motion )4388 CK_HID_JOYSTICK_HAT ? 1 : 0 );
4373//{4389}
4374// RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==4390
4375// CK_HID_MOUSE_WHEEL ? 1 : 0 );4391CK_DLL_MFUN( HidMsg_is_wheel_motion )
4376//}4392{
4377//4393 RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) ==
4378////-----------------------------------------------------------------------------4394 CK_HID_MOUSE_WHEEL ? 1 : 0 );
4379//// HidIn API4395}
4380////-----------------------------------------------------------------------------4396
4381//CK_DLL_CTOR( HidIn_ctor )4397//-----------------------------------------------------------------------------
4382//{4398// HidIn API
4383// HidIn * min = new HidIn;4399//-----------------------------------------------------------------------------
4384// min->SELF = SELF;4400CK_DLL_CTOR( HidIn_ctor )
4385// OBJ_MEMBER_INT(SELF, HidIn_offset_data) = (t_CKINT)min;4401{
4386//}4402 HidIn * min = new HidIn;
4387//4403 min->SELF = SELF;
4388//CK_DLL_DTOR( HidIn_dtor )4404 OBJ_MEMBER_INT(SELF, HidIn_offset_data) = (t_CKINT)min;
4389//{4405}
4390// delete (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4406
4391// OBJ_MEMBER_INT(SELF, HidIn_offset_data) = 0;4407CK_DLL_DTOR( HidIn_dtor )
4392//}4408{
4393//4409 delete (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4394//CK_DLL_MFUN( HidIn_open )4410 OBJ_MEMBER_INT(SELF, HidIn_offset_data) = 0;
4395//{4411}
4396// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4412
4397// t_CKINT type = GET_NEXT_INT(ARGS);4413CK_DLL_MFUN( HidIn_open )
4398// t_CKINT num = GET_NEXT_INT(ARGS);4414{
4399// // CK_FPRINTF_STDERR( "HidIn_open %li %li\n", type, num );4415 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4400// RETURN->v_int = min->open( SHRED->vm_ref, type, num );4416 t_CKINT type = GET_NEXT_INT(ARGS);
4401//}4417 t_CKINT num = GET_NEXT_INT(ARGS);
4402//4418 // CK_FPRINTF_STDERR( "HidIn_open %li %li\n", type, num );
4403//CK_DLL_MFUN( HidIn_open_named )4419 RETURN->v_int = min->open( SHRED->vm_ref, type, num );
4404//{4420}
4405// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4421
4406// Chuck_String * name = GET_NEXT_STRING(ARGS);4422CK_DLL_MFUN( HidIn_open_named )
4407// std::string s = name->str();4423{
4408// RETURN->v_int = min->open( SHRED->vm_ref, s );4424 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4409//}4425 Chuck_String * name = GET_NEXT_STRING(ARGS);
4410//4426 std::string s = name->str();
4411//CK_DLL_MFUN( HidIn_open_joystick )4427 RETURN->v_int = min->open( SHRED->vm_ref, s );
4412//{4428}
4413// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4429
4414// t_CKINT num = GET_NEXT_INT(ARGS);4430CK_DLL_MFUN( HidIn_open_joystick )
4415// RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_JOYSTICK, num );4431{
4416//}4432 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4417//4433 t_CKINT num = GET_NEXT_INT(ARGS);
4418//CK_DLL_MFUN( HidIn_open_mouse )4434 RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_JOYSTICK, num );
4419//{4435}
4420// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4436
4421// t_CKINT num = GET_NEXT_INT(ARGS);4437CK_DLL_MFUN( HidIn_open_mouse )
4422// RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_MOUSE, num );4438{
4423//}4439 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4424//4440 t_CKINT num = GET_NEXT_INT(ARGS);
4425//CK_DLL_MFUN( HidIn_open_keyboard )4441 RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_MOUSE, num );
4426//{4442}
4427// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4443
4428// t_CKINT num = GET_NEXT_INT(ARGS);4444CK_DLL_MFUN( HidIn_open_keyboard )
4429// RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_KEYBOARD, num );4445{
4430//}4446 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4431//4447 t_CKINT num = GET_NEXT_INT(ARGS);
4432//CK_DLL_MFUN( HidIn_open_tiltsensor )4448 RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_KEYBOARD, num );
4433//{4449}
4434// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4450
4435// RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 );4451CK_DLL_MFUN( HidIn_open_tiltsensor )
4436//}4452{
4437//4453 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4438//CK_DLL_MFUN( HidIn_good )4454 RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 );
4439//{4455}
4440// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4456
4441// RETURN->v_int = (t_CKINT)min->good();4457CK_DLL_MFUN( HidIn_good )
4442//}4458{
4443//4459 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4444//CK_DLL_MFUN( HidIn_num )4460 RETURN->v_int = (t_CKINT)min->good();
4445//{4461}
4446// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4462
4447// RETURN->v_int = min->num();4463CK_DLL_MFUN( HidIn_num )
4448//}4464{
4449//4465 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4450//CK_DLL_MFUN( HidIn_printerr )4466 RETURN->v_int = min->num();
4451//{4467}
4452// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4468
4453// t_CKINT print_or_not = GET_CK_INT(ARGS);4469CK_DLL_MFUN( HidIn_printerr )
4454// min->set_suppress( !print_or_not );4470{
4455//}4471 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4456//4472 t_CKINT print_or_not = GET_CK_INT(ARGS);
4457//CK_DLL_MFUN( HidIn_name )4473 min->set_suppress( !print_or_not );
4458//{4474}
4459// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4475
4460// // TODO: memory leak, please fix, Thanks.4476CK_DLL_MFUN( HidIn_name )
4461// // Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );4477{
4462// // only if valid4478 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4463// // if( min->good() )4479 // TODO: memory leak, please fix, Thanks.
4464// // a->str = min->phin->getPortName( min->num() );4480 // Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );
4465// // TODO: is null problem?4481 // only if valid
4466// RETURN->v_string = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );4482 // if( min->good() )
4467// RETURN->v_string->set( min->name() );4483 // a->str = min->phin->getPortName( min->num() );
4468//}4484 // TODO: is null problem?
4469//4485 RETURN->v_string = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );
4470//CK_DLL_MFUN( HidIn_recv )4486 RETURN->v_string->set( min->name() );
4471//{4487}
4472// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4488
4473// Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS);4489CK_DLL_MFUN( HidIn_recv )
4474// HidMsg the_msg;4490{
4475// RETURN->v_int = min->recv( &the_msg );4491 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4476// if( RETURN->v_int )4492 Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS);
4477// {4493 HidMsg the_msg;
4478// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;4494 RETURN->v_int = min->recv( &the_msg );
4479// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;4495 if( RETURN->v_int )
4480// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;4496 {
4481// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;4497 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;
4482// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];4498 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;
4483// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];4499 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;
4484//4500 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;
4485// // mouse motion specific member variables4501 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];
4486// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];4502 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];
4487// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];4503
4488// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2];4504 // mouse motion specific member variables
4489// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];4505 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];
4490// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];4506 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];
4491// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];4507 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2];
4492//4508 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];
4493// // axis motion specific member variables4509 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];
4494// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];4510 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];
4495// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];4511
4496// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];4512 // axis motion specific member variables
4497//4513 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];
4498// // hat motion specific variables4514 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];
4499// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];4515 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];
4500//4516
4501// // keyboard specific variables4517 // hat motion specific variables
4502// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];4518 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];
4503// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];4519
4504//4520 // keyboard specific variables
4505// // accelerometer (tilt sensor, wii remote) specific members4521 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];
4506// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];4522 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];
4507// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];4523
4508// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];4524 // accelerometer (tilt sensor, wii remote) specific members
4509//4525 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];
4510// // multitouch stuff - added 1.3.0.04526 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];
4511// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0];4527 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];
4512// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1];4528
4513// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchsize) = the_msg.fdata[2];4529 // multitouch stuff - added 1.3.0.0
4514// }4530 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0];
4515//}4531 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1];
4516//4532 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchsize) = the_msg.fdata[2];
4517//CK_DLL_MFUN( HidIn_read )4533 }
4518//{4534}
4519// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4535
4520// t_CKINT type = GET_NEXT_INT(ARGS);4536CK_DLL_MFUN( HidIn_read )
4521// t_CKINT num = GET_NEXT_INT(ARGS);4537{
4522// Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);4538 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4523//4539 t_CKINT type = GET_NEXT_INT(ARGS);
4524// HidMsg the_msg;4540 t_CKINT num = GET_NEXT_INT(ARGS);
4525//4541 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);
4526// RETURN->v_int = min->read( type, num, &the_msg );4542
4527//4543 HidMsg the_msg;
4528// if( RETURN->v_int )4544
4529// {4545 RETURN->v_int = min->read( type, num, &the_msg );
4530// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;4546
4531// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;4547 if( RETURN->v_int )
4532// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;4548 {
4533// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;4549 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;
4534//4550 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;
4535// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];4551 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;
4536// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];4552 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;
4537//4553
4538// // mouse motion specific member members4554 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];
4539// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];4555 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];
4540// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];4556
4541// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2];4557 // mouse motion specific member members
4542// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];4558 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];
4543// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];4559 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];
4544// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];4560 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2];
4545//4561 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];
4546// // joystick axis specific member members4562 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];
4547// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];4563 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];
4548// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];4564
4549// OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];4565 // joystick axis specific member members
4550//4566 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];
4551// // joystick hat specific member members4567 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];
4552// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];4568 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];
4553//4569
4554// // keyboard specific members4570 // joystick hat specific member members
4555// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];4571 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];
4556// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];4572
4557//4573 // keyboard specific members
4558// // accelerometer (tilt sensor, wii remote) specific members4574 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];
4559// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];4575 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];
4560// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];4576
4561// OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];4577 // accelerometer (tilt sensor, wii remote) specific members
4562// }4578 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];
4563//}4579 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];
4564//4580 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];
4565//CK_DLL_MFUN( HidIn_send )4581 }
4566//{4582}
4567// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4583
4568// Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);4584CK_DLL_MFUN( HidIn_send )
4569//4585{
4570// HidMsg the_msg;4586 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4571// the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type );4587 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);
4572// the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num );4588
4573// the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type );4589 HidMsg the_msg;
4574// the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which );4590 the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type );
4575// the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata );4591 the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num );
4576//4592 the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type );
4577// RETURN->v_int = min->send( &the_msg );4593 the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which );
4578//}4594 the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata );
4579//4595
4580//CK_DLL_MFUN( HidIn_can_wait )4596 RETURN->v_int = min->send( &the_msg );
4581//{4597}
4582// HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);4598
4583// RETURN->v_int = min->empty();4599CK_DLL_MFUN( HidIn_can_wait )
4584//}4600{
4585//4601 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
4586//CK_DLL_SFUN( HidIn_read_tilt_sensor )4602 RETURN->v_int = min->empty();
4587//{4603}
4588// static HidIn * hi;4604
4589// static t_CKBOOL hi_good = TRUE;4605CK_DLL_SFUN( HidIn_read_tilt_sensor )
4590//4606{
4591// Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 );4607 static HidIn * hi;
4592// array->set( 0, 0 );4608 static t_CKBOOL hi_good = TRUE;
4593// array->set( 1, 0 );4609
4594// array->set( 2, 0 );4610 Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 );
4595//4611 array->set( 0, 0 );
4596// // TODO: reference count?4612 array->set( 1, 0 );
4597// array->add_ref();4613 array->set( 2, 0 );
4598// RETURN->v_object = array;4614
4599//4615 // TODO: reference count?
4600// if( hi_good == FALSE )4616 array->add_ref();
4601// return;4617 RETURN->v_object = array;
4602//4618
4603// if( !hi )4619 if( hi_good == FALSE )
4604// {4620 return;
4605// hi = new HidIn;4621
4606// if( !hi->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ) )4622 if( !hi )
4607// {4623 {
4608// hi_good = FALSE;4624 hi = new HidIn;
4609// return;4625 if( !hi->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ) )
4610// }4626 {
4611// }4627 hi_good = FALSE;
4612//4628 return;
4613// HidMsg msg;4629 }
4614//4630 }
4615// if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) )4631
4616// {4632 HidMsg msg;
4617// return;4633
4618// }4634 if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) )
4619//4635 {
4620// array->set( 0, msg.idata[0] );4636 return;
4621// array->set( 1, msg.idata[1] );4637 }
4622// array->set( 2, msg.idata[2] );4638
4623//}4639 array->set( 0, msg.idata[0] );
4624//4640 array->set( 1, msg.idata[1] );
4625//CK_DLL_SFUN( HidIn_ctrl_tiltPollRate )4641 array->set( 2, msg.idata[2] );
4626//{4642}
4627// // get srate4643
4628// if( !SHRED || !SHRED->vm_ref )4644CK_DLL_SFUN( HidIn_ctrl_tiltPollRate )
4629// {4645{
4630// // problem4646 // get srate
4631// CK_FPRINTF_STDERR( "[chuck](via HID): can't set tiltPollRate on NULL shred/VM...\n" );4647 if( !SHRED || !SHRED->vm_ref )
4632// RETURN->v_dur = 0;4648 {
4633// return;4649 // problem
4634// }4650 CK_FPRINTF_STDERR( "[chuck](via HID): can't set tiltPollRate on NULL shred/VM...\n" );
4635// t_CKFLOAT srate = SHRED->vm_ref->srate();4651 RETURN->v_dur = 0;
4636//4652 return;
4637// // get arg4653 }
4638// t_CKDUR v = GET_NEXT_DUR( ARGS );4654 t_CKFLOAT srate = SHRED->vm_ref->srate();
4639//4655
4640// // get in microseconds4656 // get arg
4641// t_CKINT usec = (t_CKINT)( v / srate * 1000000 );4657 t_CKDUR v = GET_NEXT_DUR( ARGS );
4642//4658
4643// // make sure it's nonnegative4659 // get in microseconds
4644// if( usec < 0 ) usec = 0;4660 t_CKINT usec = (t_CKINT)( v / srate * 1000000 );
4645//4661
4646// // go4662 // make sure it's nonnegative
4647// RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000;4663 if( usec < 0 ) usec = 0;
4648//}4664
4649//4665 // go
4650//CK_DLL_SFUN( HidIn_cget_tiltPollRate )4666 RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000;
4651//{4667}
4652// // get srate4668
4653// if( !SHRED || !SHRED->vm_ref )4669CK_DLL_SFUN( HidIn_cget_tiltPollRate )
4654// {4670{
4655// // problem4671 // get srate
4656// CK_FPRINTF_STDERR( "[chuck](via HID): can't get tiltPollRate on NULL shred/VM...\n" );4672 if( !SHRED || !SHRED->vm_ref )
4657// RETURN->v_dur = 0;4673 {
4658// return;4674 // problem
4659// }4675 CK_FPRINTF_STDERR( "[chuck](via HID): can't get tiltPollRate on NULL shred/VM...\n" );
4660// t_CKFLOAT srate = SHRED->vm_ref->srate();4676 RETURN->v_dur = 0;
4661//4677 return;
4662// RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000;4678 }
4663//}4679 t_CKFLOAT srate = SHRED->vm_ref->srate();
4664//4680
4665//CK_DLL_SFUN( HidIn_start_cursor_track )4681 RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000;
4666//{4682}
4667// RETURN->v_int = !Mouse_start_cursor_track();4683
4668//}4684CK_DLL_SFUN( HidIn_start_cursor_track )
4669//4685{
4670//CK_DLL_SFUN( HidIn_stop_cursor_track )4686 RETURN->v_int = !Mouse_start_cursor_track();
4671//{4687}
4672// RETURN->v_int = !Mouse_stop_cursor_track();4688
4673//}4689CK_DLL_SFUN( HidIn_stop_cursor_track )
4674//4690{
4675////-----------------------------------------------------------------------------4691 RETURN->v_int = !Mouse_stop_cursor_track();
4676//// HidOut API4692}
4677////-----------------------------------------------------------------------------4693
4678//CK_DLL_CTOR( HidOut_ctor )4694//-----------------------------------------------------------------------------
4679//{4695// HidOut API
4680// OBJ_MEMBER_INT(SELF, HidOut_offset_data) = (t_CKUINT)new HidOut;4696//-----------------------------------------------------------------------------
4681//}4697CK_DLL_CTOR( HidOut_ctor )
4682//4698{
4683//CK_DLL_DTOR( HidOut_dtor )4699 OBJ_MEMBER_INT(SELF, HidOut_offset_data) = (t_CKUINT)new HidOut;
4684//{4700}
4685// delete (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4701
4686// OBJ_MEMBER_INT(SELF, HidOut_offset_data) = 0;4702CK_DLL_DTOR( HidOut_dtor )
4687//}4703{
4688//4704 delete (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4689//CK_DLL_MFUN( HidOut_open )4705 OBJ_MEMBER_INT(SELF, HidOut_offset_data) = 0;
4690//{4706}
4691// HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4707
4692// t_CKINT num = GET_CK_INT(ARGS);4708CK_DLL_MFUN( HidOut_open )
4693// RETURN->v_int = mout->open( num );4709{
4694//}4710 HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4695//4711 t_CKINT num = GET_CK_INT(ARGS);
4696//CK_DLL_MFUN( HidOut_good )4712 RETURN->v_int = mout->open( num );
4697//{4713}
4698// HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4714
4699// RETURN->v_int = (t_CKINT)mout->good();4715CK_DLL_MFUN( HidOut_good )
4700//}4716{
4701//4717 HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4702//CK_DLL_MFUN( HidOut_num )4718 RETURN->v_int = (t_CKINT)mout->good();
4703//{4719}
4704// HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4720
4705// RETURN->v_int = mout->num();4721CK_DLL_MFUN( HidOut_num )
4706//}4722{
4707//4723 HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4708//CK_DLL_MFUN( HidOut_name )4724 RETURN->v_int = mout->num();
4709//{4725}
4710// // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4726
4711// // TODO: memory leak, please fix, Thanks.4727CK_DLL_MFUN( HidOut_name )
4712// Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );4728{
4713// // only if valid4729 // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4714// // if( mout->good() )4730 // TODO: memory leak, please fix, Thanks.
4715// // a->str = mout->mout->getPortName( mout->num() );4731 Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED );
4716// RETURN->v_string = a;4732 // only if valid
4717//}4733 // if( mout->good() )
4718//4734 // a->str = mout->mout->getPortName( mout->num() );
4719//CK_DLL_MFUN( HidOut_printerr )4735 RETURN->v_string = a;
4720//{4736}
4721// HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4737
4722// t_CKINT print_or_not = GET_CK_INT(ARGS);4738CK_DLL_MFUN( HidOut_printerr )
4723// mout->set_suppress( !print_or_not );4739{
4724//}4740 HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4725//4741 t_CKINT print_or_not = GET_CK_INT(ARGS);
4726//CK_DLL_MFUN( HidOut_send )4742 mout->set_suppress( !print_or_not );
4727//{4743}
4728// HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);4744
4729// // Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS);4745CK_DLL_MFUN( HidOut_send )
4730// HidMsg the_msg;4746{
4731// // the_msg.data[0] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data1);4747 HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data);
4732// // the_msg.data[1] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data2);4748 // Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS);
4733// // the_msg.data[2] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data3);4749 HidMsg the_msg;
4734// RETURN->v_int = mout->send( &the_msg );4750 // the_msg.data[0] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data1);
4735//}4751 // the_msg.data[1] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data2);
4752 // the_msg.data[2] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data3);
4753 RETURN->v_int = mout->send( &the_msg );
4754}
4755#endif //__DISABLE_HID__
4756
4757
4736 4758
4737 4759
4738//-----------------------------------------------------------------------------4760//-----------------------------------------------------------------------------

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t