WaveSwissKnife 0.2.0.20120302
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +4 -0
- data/ChangeLog +31 -0
- data/Credits +3 -0
- data/LICENSE +31 -0
- data/README +15 -0
- data/ReleaseInfo +8 -0
- data/bin/WSK.rb +14 -0
- data/ext/WSK/AnalyzeUtils/AnalyzeUtils.c +272 -0
- data/ext/WSK/AnalyzeUtils/extconf.rb +7 -0
- data/ext/WSK/ArithmUtils/ArithmUtils.c +862 -0
- data/ext/WSK/ArithmUtils/extconf.rb +15 -0
- data/ext/WSK/CommonBuild.rb +29 -0
- data/ext/WSK/FFTUtils/FFTUtils.c +662 -0
- data/ext/WSK/FFTUtils/extconf.rb +15 -0
- data/ext/WSK/FunctionUtils/FunctionUtils.c +182 -0
- data/ext/WSK/FunctionUtils/extconf.rb +15 -0
- data/ext/WSK/SilentUtils/SilentUtils.c +431 -0
- data/ext/WSK/SilentUtils/extconf.rb +7 -0
- data/ext/WSK/VolumeUtils/VolumeUtils.c +494 -0
- data/ext/WSK/VolumeUtils/extconf.rb +15 -0
- data/external/CommonUtils/build.rb +28 -0
- data/external/CommonUtils/include/CommonUtils.h +177 -0
- data/external/CommonUtils/src/CommonUtils.c +639 -0
- data/lib/WSK/Actions/Analyze.rb +176 -0
- data/lib/WSK/Actions/ApplyMap.desc.rb +15 -0
- data/lib/WSK/Actions/ApplyMap.rb +57 -0
- data/lib/WSK/Actions/ApplyVolumeFct.desc.rb +30 -0
- data/lib/WSK/Actions/ApplyVolumeFct.rb +72 -0
- data/lib/WSK/Actions/Compare.desc.rb +25 -0
- data/lib/WSK/Actions/Compare.rb +238 -0
- data/lib/WSK/Actions/ConstantCompare.desc.rb +20 -0
- data/lib/WSK/Actions/ConstantCompare.rb +61 -0
- data/lib/WSK/Actions/Cut.desc.rb +20 -0
- data/lib/WSK/Actions/Cut.rb +60 -0
- data/lib/WSK/Actions/CutFirstSignal.desc.rb +25 -0
- data/lib/WSK/Actions/CutFirstSignal.rb +72 -0
- data/lib/WSK/Actions/DCShifter.desc.rb +15 -0
- data/lib/WSK/Actions/DCShifter.rb +67 -0
- data/lib/WSK/Actions/DrawFct.desc.rb +20 -0
- data/lib/WSK/Actions/DrawFct.rb +59 -0
- data/lib/WSK/Actions/FFT.rb +104 -0
- data/lib/WSK/Actions/GenAllValues.rb +67 -0
- data/lib/WSK/Actions/GenConstant.desc.rb +20 -0
- data/lib/WSK/Actions/GenConstant.rb +56 -0
- data/lib/WSK/Actions/GenSawtooth.rb +57 -0
- data/lib/WSK/Actions/GenSine.desc.rb +20 -0
- data/lib/WSK/Actions/GenSine.rb +73 -0
- data/lib/WSK/Actions/Identity.rb +43 -0
- data/lib/WSK/Actions/Mix.desc.rb +15 -0
- data/lib/WSK/Actions/Mix.rb +149 -0
- data/lib/WSK/Actions/Multiply.desc.rb +15 -0
- data/lib/WSK/Actions/Multiply.rb +73 -0
- data/lib/WSK/Actions/NoiseGate.desc.rb +35 -0
- data/lib/WSK/Actions/NoiseGate.rb +129 -0
- data/lib/WSK/Actions/SilenceInserter.desc.rb +20 -0
- data/lib/WSK/Actions/SilenceInserter.rb +87 -0
- data/lib/WSK/Actions/SilenceRemover.desc.rb +30 -0
- data/lib/WSK/Actions/SilenceRemover.rb +74 -0
- data/lib/WSK/Actions/VolumeProfile.desc.rb +35 -0
- data/lib/WSK/Actions/VolumeProfile.rb +63 -0
- data/lib/WSK/Common.rb +292 -0
- data/lib/WSK/FFT.rb +527 -0
- data/lib/WSK/Functions.rb +770 -0
- data/lib/WSK/Launcher.rb +216 -0
- data/lib/WSK/Maps.rb +29 -0
- data/lib/WSK/Model/CachedBufferReader.rb +151 -0
- data/lib/WSK/Model/Header.rb +133 -0
- data/lib/WSK/Model/InputData.rb +193 -0
- data/lib/WSK/Model/RawReader.rb +78 -0
- data/lib/WSK/Model/WaveReader.rb +91 -0
- data/lib/WSK/OutputInterfaces/DirectStream.rb +146 -0
- data/lib/WSK/RIFFReader.rb +60 -0
- metadata +155 -0
data/AUTHORS
ADDED
data/ChangeLog
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= WaveSwissKnife Release History
|
2
|
+
|
3
|
+
== 0.2.0.20120302 (Beta)
|
4
|
+
|
5
|
+
* Shipping gems in platform-independent architecture.
|
6
|
+
* Adapted to standard C extensions handling to make the Gem architecture independent.
|
7
|
+
* Adapted to standard RubyGems extensions format to deliver a Ruby gem instead of an architecture specific one.
|
8
|
+
* Sorted the output of available actions in the help screen.
|
9
|
+
* Corrected C code to make it compile correctly with Ruby 1.9.
|
10
|
+
* Ignored mkmf.log files in GIT.
|
11
|
+
* Adapted release information to last version of RubyPackager.
|
12
|
+
* Adapted release information to last version of rUtilAnts.
|
13
|
+
* Removed rdoc warning in documentation.
|
14
|
+
* Updated Copyright information.
|
15
|
+
* Updated email address of Muriel Salvan.
|
16
|
+
* Adapted comments to match a better RDoc syntax.
|
17
|
+
* Adapted to new version of rUtilAnts.
|
18
|
+
|
19
|
+
== 0.1.0.20110830 (Beta)
|
20
|
+
|
21
|
+
* Migrated repository to git.
|
22
|
+
* Updated copyright information
|
23
|
+
* Made regression 100% successful.
|
24
|
+
* Migrated TODO list to Trackers.
|
25
|
+
* Made building extensions report errors correctly.
|
26
|
+
* Bug correction: Reading FFT samples could not be performed.
|
27
|
+
|
28
|
+
== 0.0.1.20101110 (Alpha)
|
29
|
+
|
30
|
+
* Initial public release.
|
31
|
+
|
data/Credits
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
The license stated herein is a copy of the BSD License (modified on July 1999).
|
3
|
+
The AUTHOR mentionned below refers to the list of people involved in the
|
4
|
+
creation and modification of any file included in the delivered package.
|
5
|
+
This list is found in the file named AUTHORS.
|
6
|
+
The AUTHORS and LICENSE files have to be included in any release of software
|
7
|
+
embedding source code of this package, or using it as a derivative software.
|
8
|
+
|
9
|
+
Copyright (c) 2010 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
13
|
+
|
14
|
+
1. Redistributions of source code must retain the above copyright notice,
|
15
|
+
this list of conditions and the following disclaimer.
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
18
|
+
and/or other materials provided with the distribution.
|
19
|
+
3. The name of the author may not be used to endorse or promote products
|
20
|
+
derived from this software without specific prior written permission.
|
21
|
+
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
23
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
24
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
25
|
+
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
26
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
27
|
+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
30
|
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
31
|
+
OF SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= WaveSwissKnife
|
2
|
+
|
3
|
+
Command-line utility handling Wave files.
|
4
|
+
|
5
|
+
== Where is the documentation ?
|
6
|
+
|
7
|
+
Check the website at http://waveswissknife.sourceforge.net
|
8
|
+
|
9
|
+
== Who wrote it ?
|
10
|
+
|
11
|
+
Check the AUTHORS[link:AUTHORS.html] file.
|
12
|
+
|
13
|
+
== What is the license ?
|
14
|
+
|
15
|
+
You can find out in the LICENSE[link:LICENSE.html] file.
|
data/ReleaseInfo
ADDED
data/bin/WSK.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!env ruby
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
4
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
5
|
+
#++
|
6
|
+
|
7
|
+
# Main file
|
8
|
+
|
9
|
+
require 'rUtilAnts/Logging'
|
10
|
+
RUtilAnts::Logging::install_logger_on_object
|
11
|
+
require 'WSK/Common'
|
12
|
+
require 'WSK/Launcher'
|
13
|
+
|
14
|
+
exit WSK::Launcher.new.execute(ARGV)
|
@@ -0,0 +1,272 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
3
|
+
* Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
**/
|
5
|
+
|
6
|
+
#include "ruby.h"
|
7
|
+
#include <math.h>
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <CommonUtils.h>
|
10
|
+
|
11
|
+
// Structure used to compute sum of squares
|
12
|
+
typedef struct {
|
13
|
+
unsigned long long int high;
|
14
|
+
unsigned long long int low;
|
15
|
+
} t128bits;
|
16
|
+
|
17
|
+
// Structure used to give variables to iteration process
|
18
|
+
typedef struct {
|
19
|
+
long long int * maxValues;
|
20
|
+
long long int * minValues;
|
21
|
+
long long int * sumValues;
|
22
|
+
long long int * absSumValues;
|
23
|
+
t128bits * squareSumValues;
|
24
|
+
} tAnalyzeStruct;
|
25
|
+
|
26
|
+
/** Add a 64 bits unsigned integer to a 128 bits unsigned integer
|
27
|
+
*
|
28
|
+
* Parameters::
|
29
|
+
* * *ioPtrVal* (<em>t128bits*</em>): The 128 bits integer to modify
|
30
|
+
* * *iAddValue* (<em>const unsigned long long int</em>): The value to add
|
31
|
+
**/
|
32
|
+
inline void add128bits(t128bits* ioPtrVal, const unsigned long long int iAddValue) {
|
33
|
+
unsigned long long int lOldLow = ioPtrVal->low;
|
34
|
+
|
35
|
+
ioPtrVal->low += iAddValue;
|
36
|
+
// check for overflow of low 64 bits, add carry to high
|
37
|
+
if (ioPtrVal->low < lOldLow)
|
38
|
+
++ioPtrVal->high;
|
39
|
+
}
|
40
|
+
|
41
|
+
/** Create empty arrays of long long integers to be used for various sums
|
42
|
+
*
|
43
|
+
* Parameters::
|
44
|
+
* * *iSelf* (_FFT_): Self
|
45
|
+
* * *iValNbrChannels* (_Integer_): Number of channels
|
46
|
+
* * *iValInitialValue* (_Integer_): Initial value
|
47
|
+
* Return::
|
48
|
+
* * _Object_: An encapsulated array for computation
|
49
|
+
**/
|
50
|
+
static VALUE analyzeutils_init64bitsArray(
|
51
|
+
VALUE iSelf,
|
52
|
+
VALUE iValNbrChannels,
|
53
|
+
VALUE iValInitialValue) {
|
54
|
+
VALUE rValContainer;
|
55
|
+
int lNbrChannels = FIX2INT(iValNbrChannels);
|
56
|
+
long long int lInitialValue = FIX2LONG(iValInitialValue);
|
57
|
+
|
58
|
+
long long int * lSumArray = ALLOC_N(long long int, lNbrChannels);
|
59
|
+
int lIdxChannel;
|
60
|
+
for (lIdxChannel = 0; lIdxChannel < lNbrChannels; ++lIdxChannel) {
|
61
|
+
lSumArray[lIdxChannel] = lInitialValue;
|
62
|
+
}
|
63
|
+
|
64
|
+
// Encapsulate it
|
65
|
+
rValContainer = Data_Wrap_Struct(rb_cObject, NULL, free, lSumArray);
|
66
|
+
|
67
|
+
return rValContainer;
|
68
|
+
}
|
69
|
+
|
70
|
+
/** Create empty arrays of 128 bits integers to be used for various sums
|
71
|
+
*
|
72
|
+
* Parameters::
|
73
|
+
* * *iSelf* (_FFT_): Self
|
74
|
+
* * *iValNbrChannels* (_Integer_): Number of channels
|
75
|
+
* Return::
|
76
|
+
* * _Object_: An encapsulated array for computation
|
77
|
+
**/
|
78
|
+
static VALUE analyzeutils_init128bitsArray(
|
79
|
+
VALUE iSelf,
|
80
|
+
VALUE iValNbrChannels) {
|
81
|
+
VALUE rValContainer;
|
82
|
+
int lNbrChannels = FIX2INT(iValNbrChannels);
|
83
|
+
|
84
|
+
t128bits * lSumArray = ALLOC_N(t128bits, lNbrChannels);
|
85
|
+
// Fill it with 0
|
86
|
+
memset(lSumArray, 0, lNbrChannels*sizeof(t128bits));
|
87
|
+
|
88
|
+
// Encapsulate it
|
89
|
+
rValContainer = Data_Wrap_Struct(rb_cObject, NULL, free, lSumArray);
|
90
|
+
|
91
|
+
return rValContainer;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Process a value read from an input buffer for the Analyze function.
|
96
|
+
* Use the trigo cache.
|
97
|
+
*
|
98
|
+
* Parameters::
|
99
|
+
* * *iValue* (<em>const tSampleValue</em>): The value being read
|
100
|
+
* * *iIdxSample* (<em>const tSampleIndex</em>): Index of this sample
|
101
|
+
* * *iIdxChannel* (<em>const int</em>): Channel corresponding to the value being read
|
102
|
+
* * *iPtrArgs* (<em>void*</em>): additional arguments. In fact a <em>tAnalyzeStruct*</em>.
|
103
|
+
* Return::
|
104
|
+
* * _int_: The return code:
|
105
|
+
* ** 0: Continue iteration
|
106
|
+
* ** 1: Break all iterations
|
107
|
+
* ** 2: Skip directly to the next sample (don't call us for other channels of this sample)
|
108
|
+
*/
|
109
|
+
int analyzeutils_processValue_Analyze(
|
110
|
+
const tSampleValue iValue,
|
111
|
+
const tSampleIndex iIdxSample,
|
112
|
+
const int iIdxChannel,
|
113
|
+
void* iPtrArgs) {
|
114
|
+
// Interpret parameters
|
115
|
+
tAnalyzeStruct* lPtrVariables = (tAnalyzeStruct*)iPtrArgs;
|
116
|
+
|
117
|
+
if (iValue > lPtrVariables->maxValues[iIdxChannel]) {
|
118
|
+
lPtrVariables->maxValues[iIdxChannel] = iValue;
|
119
|
+
}
|
120
|
+
if (iValue < lPtrVariables->minValues[iIdxChannel]) {
|
121
|
+
lPtrVariables->minValues[iIdxChannel] = iValue;
|
122
|
+
}
|
123
|
+
lPtrVariables->sumValues[iIdxChannel] += iValue;
|
124
|
+
lPtrVariables->absSumValues[iIdxChannel] += abs(iValue);
|
125
|
+
add128bits(&(lPtrVariables->squareSumValues[iIdxChannel]), ((long long int)iValue)*((long long int)iValue));
|
126
|
+
|
127
|
+
return 0;
|
128
|
+
}
|
129
|
+
|
130
|
+
/** Complete the arrays of sums for analyzis
|
131
|
+
*
|
132
|
+
* Parameters::
|
133
|
+
* * *iSelf* (_FFT_): Self
|
134
|
+
* * *iValInputRawBuffer* (_String_): The input raw buffer
|
135
|
+
* * *iValNbrBitsPerSample* (_Integer_): The number of bits per sample
|
136
|
+
* * *iValNbrSamples* (_Integer_): The number of samples
|
137
|
+
* * *iValNbrChannels* (_Integer_): The number of channels
|
138
|
+
* * *ioValMaxValues* (_Object_): Container of the max values array (should be initialized with init64bitsArray)
|
139
|
+
* * *ioValMinValues* (_Object_): Container of the min values array (should be initialized with init64bitsArray)
|
140
|
+
* * *ioValSumValues* (_Object_): Container of the sum values array (should be initialized with init64bitsArray)
|
141
|
+
* * *ioValAbsSumValues* (_Object_): Container of the abs sum values array (should be initialized with init64bitsArray)
|
142
|
+
* * *ioValSquareSumValues* (_Object_): Container of the square sum values array (should be initialized with init128bitsArray)
|
143
|
+
**/
|
144
|
+
static VALUE analyzeutils_completeAnalyze(
|
145
|
+
VALUE iSelf,
|
146
|
+
VALUE iValInputRawBuffer,
|
147
|
+
VALUE iValNbrBitsPerSample,
|
148
|
+
VALUE iValNbrSamples,
|
149
|
+
VALUE iValNbrChannels,
|
150
|
+
VALUE ioValMaxValues,
|
151
|
+
VALUE ioValMinValues,
|
152
|
+
VALUE ioValSumValues,
|
153
|
+
VALUE ioValAbsSumValues,
|
154
|
+
VALUE ioValSquareSumValues) {
|
155
|
+
// Translate Ruby objects
|
156
|
+
tSampleIndex iNbrSamples = FIX2LONG(iValNbrSamples);
|
157
|
+
int iNbrChannels = FIX2INT(iValNbrChannels);
|
158
|
+
int iNbrBitsPerSample = FIX2LONG(iValNbrBitsPerSample);
|
159
|
+
char* lPtrRawBuffer = RSTRING_PTR(iValInputRawBuffer);
|
160
|
+
// Get the arrays
|
161
|
+
tAnalyzeStruct lProcessParams;
|
162
|
+
Data_Get_Struct(ioValMaxValues, long long int, lProcessParams.maxValues);
|
163
|
+
Data_Get_Struct(ioValMinValues, long long int, lProcessParams.minValues);
|
164
|
+
Data_Get_Struct(ioValSumValues, long long int, lProcessParams.sumValues);
|
165
|
+
Data_Get_Struct(ioValAbsSumValues, long long int, lProcessParams.absSumValues);
|
166
|
+
Data_Get_Struct(ioValSquareSumValues, t128bits, lProcessParams.squareSumValues);
|
167
|
+
|
168
|
+
// Parse the data
|
169
|
+
commonutils_iterateThroughRawBuffer(
|
170
|
+
lPtrRawBuffer,
|
171
|
+
iNbrBitsPerSample,
|
172
|
+
iNbrChannels,
|
173
|
+
iNbrSamples,
|
174
|
+
0,
|
175
|
+
&analyzeutils_processValue_Analyze,
|
176
|
+
&lProcessParams
|
177
|
+
);
|
178
|
+
|
179
|
+
return Qnil;
|
180
|
+
}
|
181
|
+
|
182
|
+
/** Get a Bignum Ruby arrays out of a 64bits C integers array
|
183
|
+
*
|
184
|
+
* Parameters::
|
185
|
+
* * *iSelf* (_FFT_): Self
|
186
|
+
* * *iValArray* (_Object_): Container of the array (should be initialized with init64bitsArray)
|
187
|
+
* * *iValNbrItems* (_Integer_): The number of items in the array
|
188
|
+
* Return::
|
189
|
+
* * <em>list<Integer></em>: Corresponding Ruby array
|
190
|
+
**/
|
191
|
+
static VALUE analyzeutils_getRuby64bitsArray(
|
192
|
+
VALUE iSelf,
|
193
|
+
VALUE iValArray,
|
194
|
+
VALUE iValNbrItems) {
|
195
|
+
// Translate Ruby objects
|
196
|
+
int lNbrItems = FIX2INT(iValNbrItems);
|
197
|
+
// Get the array
|
198
|
+
long long int * lArray;
|
199
|
+
Data_Get_Struct(iValArray, long long int, lArray);
|
200
|
+
// The C-array of the final result
|
201
|
+
VALUE lFinalArray[lNbrItems];
|
202
|
+
|
203
|
+
// Buffer that stores string representation of long long int for Ruby RBigNum
|
204
|
+
char lStrValue[128];
|
205
|
+
int lIdxItem;
|
206
|
+
for (lIdxItem = 0; lIdxItem < lNbrItems; ++lIdxItem) {
|
207
|
+
sprintf(lStrValue, "%lld", lArray[lIdxItem]);
|
208
|
+
lFinalArray[lIdxItem] = rb_cstr2inum(lStrValue, 10);
|
209
|
+
}
|
210
|
+
|
211
|
+
return rb_ary_new4(lNbrItems, lFinalArray);
|
212
|
+
}
|
213
|
+
|
214
|
+
/** Get a Bignum Ruby arrays out of a 128bits C integers array
|
215
|
+
*
|
216
|
+
* Parameters::
|
217
|
+
* * *iSelf* (_FFT_): Self
|
218
|
+
* * *iValArray* (_Object_): Container of the array (should be initialized with init128bitsArray)
|
219
|
+
* * *iValNbrItems* (_Integer_): The number of items in the array
|
220
|
+
* Return::
|
221
|
+
* * <em>list<Integer></em>: Corresponding Ruby array
|
222
|
+
**/
|
223
|
+
static VALUE analyzeutils_getRuby128bitsArray(
|
224
|
+
VALUE iSelf,
|
225
|
+
VALUE iValArray,
|
226
|
+
VALUE iValNbrItems) {
|
227
|
+
// Translate Ruby objects
|
228
|
+
int lNbrItems = FIX2INT(iValNbrItems);
|
229
|
+
// Get the array
|
230
|
+
t128bits * lArray;
|
231
|
+
Data_Get_Struct(iValArray, t128bits, lArray);
|
232
|
+
// The C-array of the final result
|
233
|
+
VALUE lFinalArray[lNbrItems];
|
234
|
+
// Operations that will be used
|
235
|
+
ID lPlusID = rb_intern("+");
|
236
|
+
ID lMultiplyID = rb_intern("*");
|
237
|
+
|
238
|
+
// Buffer that stores string representation of long long int for Ruby RBigNum
|
239
|
+
char lStrValue[128];
|
240
|
+
int lIdxItem;
|
241
|
+
VALUE lValHigh;
|
242
|
+
VALUE lValLow;
|
243
|
+
VALUE lValHighShifted;
|
244
|
+
// We will need to multiply High part by 2^64
|
245
|
+
VALUE lValShiftFactor = rb_cstr2inum("18446744073709551616", 10);
|
246
|
+
for (lIdxItem = 0; lIdxItem < lNbrItems; ++lIdxItem) {
|
247
|
+
sprintf(lStrValue, "%llu", lArray[lIdxItem].high);
|
248
|
+
lValHigh = rb_cstr2inum(lStrValue, 10);
|
249
|
+
sprintf(lStrValue, "%llu", lArray[lIdxItem].low);
|
250
|
+
lValLow = rb_cstr2inum(lStrValue, 10);
|
251
|
+
lValHighShifted = rb_funcall(lValHigh, lMultiplyID, 1, lValShiftFactor);
|
252
|
+
lFinalArray[lIdxItem] = rb_funcall(lValHighShifted, lPlusID, 1, lValLow);
|
253
|
+
}
|
254
|
+
|
255
|
+
return rb_ary_new4(lNbrItems, lFinalArray);
|
256
|
+
}
|
257
|
+
|
258
|
+
// Initialize the module
|
259
|
+
void Init_AnalyzeUtils() {
|
260
|
+
VALUE lWSKModule;
|
261
|
+
VALUE lAnalyzeUtilsModule;
|
262
|
+
VALUE lAnalyzeUtilsClass;
|
263
|
+
|
264
|
+
lWSKModule = rb_define_module("WSK");
|
265
|
+
lAnalyzeUtilsModule = rb_define_module_under(lWSKModule, "AnalyzeUtils");
|
266
|
+
lAnalyzeUtilsClass = rb_define_class_under(lAnalyzeUtilsModule, "AnalyzeUtils", rb_cObject);
|
267
|
+
rb_define_method(lAnalyzeUtilsClass, "init64bitsArray", analyzeutils_init64bitsArray, 2);
|
268
|
+
rb_define_method(lAnalyzeUtilsClass, "init128bitsArray", analyzeutils_init128bitsArray, 1);
|
269
|
+
rb_define_method(lAnalyzeUtilsClass, "completeAnalyze", analyzeutils_completeAnalyze, 9);
|
270
|
+
rb_define_method(lAnalyzeUtilsClass, "getRuby64bitsArray", analyzeutils_getRuby64bitsArray, 2);
|
271
|
+
rb_define_method(lAnalyzeUtilsClass, "getRuby128bitsArray", analyzeutils_getRuby128bitsArray, 2);
|
272
|
+
}
|