ofa 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/{ofa.c → ofa.cpp} +135 -118
- metadata +5 -5
data/ext/{ofa.c → ofa.cpp}
RENAMED
@@ -10,6 +10,30 @@
|
|
10
10
|
|
11
11
|
#define SWIGRUBY
|
12
12
|
|
13
|
+
|
14
|
+
#ifdef __cplusplus
|
15
|
+
/* SwigValueWrapper is described in swig.swg */
|
16
|
+
template<typename T> class SwigValueWrapper {
|
17
|
+
struct SwigMovePointer {
|
18
|
+
T *ptr;
|
19
|
+
SwigMovePointer(T *p) : ptr(p) { }
|
20
|
+
~SwigMovePointer() { delete ptr; }
|
21
|
+
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
|
22
|
+
} pointer;
|
23
|
+
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
24
|
+
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
|
25
|
+
public:
|
26
|
+
SwigValueWrapper() : pointer(0) { }
|
27
|
+
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
|
28
|
+
operator T&() const { return *pointer.ptr; }
|
29
|
+
T *operator&() { return pointer.ptr; }
|
30
|
+
};
|
31
|
+
|
32
|
+
template <typename T> T SwigValueInit() {
|
33
|
+
return T();
|
34
|
+
}
|
35
|
+
#endif
|
36
|
+
|
13
37
|
/* -----------------------------------------------------------------------------
|
14
38
|
* This section contains generic SWIG labels for method/variable
|
15
39
|
* declarations/attributes, and other compiler dependent labels.
|
@@ -1791,9 +1815,8 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
|
|
1791
1815
|
|
1792
1816
|
#define SWIGTYPE_p_char swig_types[0]
|
1793
1817
|
#define SWIGTYPE_p_int swig_types[1]
|
1794
|
-
|
1795
|
-
static
|
1796
|
-
static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
|
1818
|
+
static swig_type_info *swig_types[3];
|
1819
|
+
static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
|
1797
1820
|
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
1798
1821
|
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
1799
1822
|
|
@@ -1812,28 +1835,14 @@ static VALUE mOfa;
|
|
1812
1835
|
#define SWIG_VERSION SWIGVERSION
|
1813
1836
|
|
1814
1837
|
|
1815
|
-
#define SWIG_as_voidptr(a)
|
1816
|
-
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),
|
1817
|
-
|
1818
|
-
|
1819
|
-
#include <limits.h>
|
1820
|
-
#if !defined(SWIG_NO_LLONG_MAX)
|
1821
|
-
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
1822
|
-
# define LLONG_MAX __LONG_LONG_MAX__
|
1823
|
-
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
1824
|
-
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
1825
|
-
# endif
|
1826
|
-
#endif
|
1838
|
+
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
|
1839
|
+
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
|
1827
1840
|
|
1828
1841
|
|
1829
|
-
|
1842
|
+
#include <stdexcept>
|
1830
1843
|
|
1831
1844
|
|
1832
|
-
|
1833
|
-
SWIG_From_int (int value)
|
1834
|
-
{
|
1835
|
-
return SWIG_From_long (value);
|
1836
|
-
}
|
1845
|
+
#include <ofa1/ofa.h>
|
1837
1846
|
|
1838
1847
|
|
1839
1848
|
#ifdef __cplusplus
|
@@ -1864,58 +1873,97 @@ struct timeval rb_time_timeval(VALUE);
|
|
1864
1873
|
#endif
|
1865
1874
|
|
1866
1875
|
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1876
|
+
#include <limits.h>
|
1877
|
+
#if !defined(SWIG_NO_LLONG_MAX)
|
1878
|
+
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
|
1879
|
+
# define LLONG_MAX __LONG_LONG_MAX__
|
1880
|
+
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
1881
|
+
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
1882
|
+
# endif
|
1883
|
+
#endif
|
1872
1884
|
|
1873
1885
|
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
return obj;
|
1886
|
+
#define SWIG_From_long LONG2NUM
|
1887
|
+
|
1888
|
+
|
1889
|
+
SWIGINTERNINLINE VALUE
|
1890
|
+
SWIG_From_int (int value)
|
1891
|
+
{
|
1892
|
+
return SWIG_From_long (value);
|
1882
1893
|
}
|
1883
|
-
/*@SWIG@*/
|
1884
1894
|
|
1885
|
-
|
1886
|
-
|
1895
|
+
|
1896
|
+
const char *wrap_create_fingerprint(const char *data, long size, int sRate, int stereo) {
|
1897
|
+
#ifdef WORDS_BIGENDIAN
|
1898
|
+
#define ENDIANESS (1)
|
1899
|
+
#else
|
1900
|
+
#define ENDIANESS (0)
|
1901
|
+
#endif
|
1902
|
+
return ofa_create_print((unsigned char *)data, ENDIANESS, size, sRate, stereo);
|
1903
|
+
}
|
1904
|
+
|
1905
|
+
|
1906
|
+
SWIGINTERN swig_type_info*
|
1907
|
+
SWIG_pchar_descriptor(void)
|
1887
1908
|
{
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
a[1] = (VALUE)(&v);
|
1894
|
-
if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
|
1895
|
-
if (val) *val = v;
|
1896
|
-
return SWIG_OK;
|
1897
|
-
}
|
1909
|
+
static int init = 0;
|
1910
|
+
static swig_type_info* info = 0;
|
1911
|
+
if (!init) {
|
1912
|
+
info = SWIG_TypeQuery("_p_char");
|
1913
|
+
init = 1;
|
1898
1914
|
}
|
1899
|
-
return
|
1915
|
+
return info;
|
1900
1916
|
}
|
1901
1917
|
|
1902
1918
|
|
1903
1919
|
SWIGINTERN int
|
1904
|
-
|
1920
|
+
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
1905
1921
|
{
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1922
|
+
if (TYPE(obj) == T_STRING) {
|
1923
|
+
#if defined(StringValuePtr)
|
1924
|
+
char *cstr = StringValuePtr(obj);
|
1925
|
+
#else
|
1926
|
+
char *cstr = STR2CSTR(obj);
|
1927
|
+
#endif
|
1928
|
+
size_t size = RSTRING_LEN(obj) + 1;
|
1929
|
+
if (cptr) {
|
1930
|
+
if (alloc) {
|
1931
|
+
if (*alloc == SWIG_NEWOBJ) {
|
1932
|
+
*cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
|
1933
|
+
} else {
|
1934
|
+
*cptr = cstr;
|
1935
|
+
*alloc = SWIG_OLDOBJ;
|
1936
|
+
}
|
1937
|
+
}
|
1938
|
+
}
|
1939
|
+
if (psize) *psize = size;
|
1940
|
+
return SWIG_OK;
|
1941
|
+
} else {
|
1942
|
+
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
1943
|
+
if (pchar_descriptor) {
|
1944
|
+
void* vptr = 0;
|
1945
|
+
if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
|
1946
|
+
if (cptr) *cptr = (char *)vptr;
|
1947
|
+
if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
|
1948
|
+
if (alloc) *alloc = SWIG_OLDOBJ;
|
1949
|
+
return SWIG_OK;
|
1950
|
+
}
|
1913
1951
|
}
|
1914
1952
|
}
|
1915
|
-
return
|
1953
|
+
return SWIG_TypeError;
|
1916
1954
|
}
|
1917
1955
|
|
1918
1956
|
|
1957
|
+
|
1958
|
+
|
1959
|
+
|
1960
|
+
SWIGINTERN VALUE
|
1961
|
+
SWIG_ruby_failed(void)
|
1962
|
+
{
|
1963
|
+
return Qnil;
|
1964
|
+
}
|
1965
|
+
|
1966
|
+
|
1919
1967
|
/*@SWIG:/Users/adriano/Applications/homebrew/Cellar/swig/2.0.0//share/swig/2.0.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
|
1920
1968
|
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
|
1921
1969
|
{
|
@@ -1954,26 +2002,13 @@ SWIG_AsVal_int (VALUE obj, int *val)
|
|
1954
2002
|
if ((v < INT_MIN || v > INT_MAX)) {
|
1955
2003
|
return SWIG_OverflowError;
|
1956
2004
|
} else {
|
1957
|
-
if (val) *val =
|
2005
|
+
if (val) *val = static_cast< int >(v);
|
1958
2006
|
}
|
1959
2007
|
}
|
1960
2008
|
return res;
|
1961
2009
|
}
|
1962
2010
|
|
1963
2011
|
|
1964
|
-
SWIGINTERN swig_type_info*
|
1965
|
-
SWIG_pchar_descriptor(void)
|
1966
|
-
{
|
1967
|
-
static int init = 0;
|
1968
|
-
static swig_type_info* info = 0;
|
1969
|
-
if (!init) {
|
1970
|
-
info = SWIG_TypeQuery("_p_char");
|
1971
|
-
init = 1;
|
1972
|
-
}
|
1973
|
-
return info;
|
1974
|
-
}
|
1975
|
-
|
1976
|
-
|
1977
2012
|
SWIGINTERNINLINE VALUE
|
1978
2013
|
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
1979
2014
|
{
|
@@ -1981,9 +2016,9 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
|
1981
2016
|
if (size > LONG_MAX) {
|
1982
2017
|
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
1983
2018
|
return pchar_descriptor ?
|
1984
|
-
SWIG_NewPointerObj(
|
2019
|
+
SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
|
1985
2020
|
} else {
|
1986
|
-
return rb_str_new(carray,
|
2021
|
+
return rb_str_new(carray, static_cast< long >(size));
|
1987
2022
|
}
|
1988
2023
|
} else {
|
1989
2024
|
return Qnil;
|
@@ -2044,63 +2079,51 @@ fail:
|
|
2044
2079
|
|
2045
2080
|
SWIGINTERN VALUE
|
2046
2081
|
_wrap_create_fingerprint(int argc, VALUE *argv, VALUE self) {
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2082
|
+
char *arg1 = (char *) 0 ;
|
2083
|
+
long arg2 ;
|
2084
|
+
int arg3 ;
|
2050
2085
|
int arg4 ;
|
2051
|
-
int
|
2052
|
-
|
2053
|
-
int
|
2054
|
-
|
2086
|
+
int res1 ;
|
2087
|
+
char *buf1 = 0 ;
|
2088
|
+
int alloc1 = 0 ;
|
2089
|
+
long val2 ;
|
2055
2090
|
int ecode2 = 0 ;
|
2056
|
-
|
2091
|
+
int val3 ;
|
2057
2092
|
int ecode3 = 0 ;
|
2058
2093
|
int val4 ;
|
2059
2094
|
int ecode4 = 0 ;
|
2060
|
-
int val5 ;
|
2061
|
-
int ecode5 = 0 ;
|
2062
2095
|
char *result = 0 ;
|
2063
2096
|
VALUE vresult = Qnil;
|
2064
2097
|
|
2065
|
-
if ((argc <
|
2066
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
2098
|
+
if ((argc < 4) || (argc > 4)) {
|
2099
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
|
2067
2100
|
}
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
if (!SWIG_IsOK(ecode)) {
|
2072
|
-
SWIG_exception_fail(SWIG_ArgError(ecode), Ruby_Format_TypeError( "", "unsigned char","ofa_create_print", 1, argv[0] ));
|
2073
|
-
}
|
2074
|
-
temp1 = (unsigned char)(val);
|
2075
|
-
arg1 = &temp1;
|
2076
|
-
res1 = SWIG_AddTmpMask(ecode);
|
2101
|
+
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
|
2102
|
+
if (!SWIG_IsOK(res1)) {
|
2103
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","wrap_create_fingerprint", 1, argv[0] ));
|
2077
2104
|
}
|
2078
|
-
|
2105
|
+
arg1 = reinterpret_cast< char * >(buf1);
|
2106
|
+
ecode2 = SWIG_AsVal_long(argv[1], &val2);
|
2079
2107
|
if (!SWIG_IsOK(ecode2)) {
|
2080
|
-
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "
|
2108
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "long","wrap_create_fingerprint", 2, argv[1] ));
|
2081
2109
|
}
|
2082
|
-
arg2 = (
|
2083
|
-
ecode3 =
|
2110
|
+
arg2 = static_cast< long >(val2);
|
2111
|
+
ecode3 = SWIG_AsVal_int(argv[2], &val3);
|
2084
2112
|
if (!SWIG_IsOK(ecode3)) {
|
2085
|
-
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "
|
2113
|
+
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","wrap_create_fingerprint", 3, argv[2] ));
|
2086
2114
|
}
|
2087
|
-
arg3 = (
|
2115
|
+
arg3 = static_cast< int >(val3);
|
2088
2116
|
ecode4 = SWIG_AsVal_int(argv[3], &val4);
|
2089
2117
|
if (!SWIG_IsOK(ecode4)) {
|
2090
|
-
SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","
|
2091
|
-
}
|
2092
|
-
arg4 = (int)(val4);
|
2093
|
-
ecode5 = SWIG_AsVal_int(argv[4], &val5);
|
2094
|
-
if (!SWIG_IsOK(ecode5)) {
|
2095
|
-
SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","ofa_create_print", 5, argv[4] ));
|
2118
|
+
SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","wrap_create_fingerprint", 4, argv[3] ));
|
2096
2119
|
}
|
2097
|
-
|
2098
|
-
result = (char *)
|
2120
|
+
arg4 = static_cast< int >(val4);
|
2121
|
+
result = (char *)wrap_create_fingerprint((char const *)arg1,arg2,arg3,arg4);
|
2099
2122
|
vresult = SWIG_FromCharPtr((const char *)result);
|
2100
|
-
if (
|
2123
|
+
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
|
2101
2124
|
return vresult;
|
2102
2125
|
fail:
|
2103
|
-
if (
|
2126
|
+
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
|
2104
2127
|
return Qnil;
|
2105
2128
|
}
|
2106
2129
|
|
@@ -2110,22 +2133,18 @@ fail:
|
|
2110
2133
|
|
2111
2134
|
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
|
2112
2135
|
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
|
2113
|
-
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0};
|
2114
2136
|
|
2115
2137
|
static swig_type_info *swig_type_initial[] = {
|
2116
2138
|
&_swigt__p_char,
|
2117
2139
|
&_swigt__p_int,
|
2118
|
-
&_swigt__p_unsigned_char,
|
2119
2140
|
};
|
2120
2141
|
|
2121
2142
|
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
|
2122
2143
|
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
|
2123
|
-
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
|
2124
2144
|
|
2125
2145
|
static swig_cast_info *swig_cast_initial[] = {
|
2126
2146
|
_swigc__p_char,
|
2127
2147
|
_swigc__p_int,
|
2128
|
-
_swigc__p_unsigned_char,
|
2129
2148
|
};
|
2130
2149
|
|
2131
2150
|
|
@@ -2386,9 +2405,7 @@ SWIGEXPORT void Init_ofa(void) {
|
|
2386
2405
|
}
|
2387
2406
|
|
2388
2407
|
SWIG_RubyInitializeTrackings();
|
2389
|
-
|
2390
|
-
|
2391
|
-
rb_define_module_function(mOfa, "version", _wrap_version, -1);
|
2392
|
-
rb_define_module_function(mOfa, "create_fingerprint", _wrap_create_fingerprint, -1);
|
2408
|
+
rb_define_module_function(mOfa, "version", VALUEFUNC(_wrap_version), -1);
|
2409
|
+
rb_define_module_function(mOfa, "create_fingerprint", VALUEFUNC(_wrap_create_fingerprint), -1);
|
2393
2410
|
}
|
2394
2411
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 1
|
9
|
+
version: "1.1"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adriano Bonat
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-25 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -28,7 +28,7 @@ extra_rdoc_files: []
|
|
28
28
|
|
29
29
|
files:
|
30
30
|
- ext/extconf.rb
|
31
|
-
- ext/ofa.
|
31
|
+
- ext/ofa.cpp
|
32
32
|
has_rdoc: true
|
33
33
|
homepage: http://github.com/tanob/ofa-ruby
|
34
34
|
licenses: []
|