WaveSwissKnife 0.0.1.20101110-x86-cygwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -0
- data/ChangeLog +5 -0
- data/Credits +3 -0
- data/LICENSE +31 -0
- data/README +18 -0
- data/ReleaseInfo +8 -0
- data/TODO +2 -0
- data/bin/WSK.rb +14 -0
- data/ext/WSK/AnalyzeUtils/AnalyzeUtils.c +272 -0
- data/ext/WSK/AnalyzeUtils/AnalyzeUtils.o +0 -0
- data/ext/WSK/AnalyzeUtils/AnalyzeUtils.so +0 -0
- data/ext/WSK/AnalyzeUtils/Makefile +149 -0
- data/ext/WSK/AnalyzeUtils/build.rb +18 -0
- data/ext/WSK/ArithmUtils/ArithmUtils.c +862 -0
- data/ext/WSK/ArithmUtils/ArithmUtils.o +0 -0
- data/ext/WSK/ArithmUtils/ArithmUtils.so +0 -0
- data/ext/WSK/ArithmUtils/Makefile +149 -0
- data/ext/WSK/ArithmUtils/build.rb +20 -0
- data/ext/WSK/FFTUtils/FFTUtils.c +662 -0
- data/ext/WSK/FFTUtils/FFTUtils.o +0 -0
- data/ext/WSK/FFTUtils/FFTUtils.so +0 -0
- data/ext/WSK/FFTUtils/Makefile +149 -0
- data/ext/WSK/FFTUtils/build.rb +20 -0
- data/ext/WSK/FunctionUtils/FunctionUtils.c +182 -0
- data/ext/WSK/FunctionUtils/FunctionUtils.o +0 -0
- data/ext/WSK/FunctionUtils/FunctionUtils.so +0 -0
- data/ext/WSK/FunctionUtils/Makefile +149 -0
- data/ext/WSK/FunctionUtils/build.rb +20 -0
- data/ext/WSK/SilentUtils/Makefile +149 -0
- data/ext/WSK/SilentUtils/SilentUtils.c +431 -0
- data/ext/WSK/SilentUtils/SilentUtils.o +0 -0
- data/ext/WSK/SilentUtils/SilentUtils.so +0 -0
- data/ext/WSK/SilentUtils/build.rb +18 -0
- data/ext/WSK/VolumeUtils/Makefile +149 -0
- data/ext/WSK/VolumeUtils/VolumeUtils.c +494 -0
- data/ext/WSK/VolumeUtils/VolumeUtils.o +0 -0
- data/ext/WSK/VolumeUtils/VolumeUtils.so +0 -0
- data/ext/WSK/VolumeUtils/build.rb +20 -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 +151 -0
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
= Muriel Salvan (murielsalvan@users.sourceforge.net)
|
data/ChangeLog
ADDED
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 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
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,18 @@
|
|
1
|
+
-- This file is best viewed when processed by rdoc.
|
2
|
+
++
|
3
|
+
|
4
|
+
= WaveSwissKnife
|
5
|
+
|
6
|
+
Command-line utility handling Wave files.
|
7
|
+
|
8
|
+
== Where is the documentation ?
|
9
|
+
|
10
|
+
Check the website at http://waveswissknife.sourceforge.net
|
11
|
+
|
12
|
+
== Who wrote it ?
|
13
|
+
|
14
|
+
Check the AUTHORS[link:files/AUTHORS.html] file.
|
15
|
+
|
16
|
+
== What is the license ?
|
17
|
+
|
18
|
+
You can find out in the LICENSE[link:files/LICENSE.html] file.
|
data/ReleaseInfo
ADDED
data/TODO
ADDED
data/bin/WSK.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!env ruby
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
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::initializeLogging('', '')
|
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-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
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(iValInputRawBuffer)->ptr;
|
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
|
+
}
|
Binary file
|
Binary file
|
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = .
|
7
|
+
topdir = /usr/lib/ruby/1.8/i386-cygwin
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
prefix = $(DESTDIR)/usr
|
11
|
+
exec_prefix = $(prefix)
|
12
|
+
sitedir = $(prefix)/lib/ruby/site_ruby
|
13
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
14
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
15
|
+
dvidir = $(docdir)
|
16
|
+
datarootdir = $(prefix)/share
|
17
|
+
archdir = $(rubylibdir)/$(arch)
|
18
|
+
sbindir = $(exec_prefix)/sbin
|
19
|
+
psdir = $(docdir)
|
20
|
+
localedir = $(datarootdir)/locale
|
21
|
+
htmldir = $(docdir)
|
22
|
+
datadir = $(prefix)/share
|
23
|
+
includedir = $(prefix)/include
|
24
|
+
infodir = $(prefix)/share/info
|
25
|
+
sysconfdir = $(DESTDIR)/etc
|
26
|
+
mandir = $(prefix)/share/man
|
27
|
+
libdir = $(exec_prefix)/lib
|
28
|
+
sharedstatedir = $(prefix)/com
|
29
|
+
oldincludedir = $(DESTDIR)/usr/include
|
30
|
+
pdfdir = $(docdir)
|
31
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
32
|
+
bindir = $(exec_prefix)/bin
|
33
|
+
localstatedir = $(DESTDIR)/var
|
34
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
35
|
+
libexecdir = $(prefix)/sbin
|
36
|
+
|
37
|
+
CC = gcc
|
38
|
+
LIBRUBY = lib$(RUBY_SO_NAME).dll.a
|
39
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
40
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
41
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
42
|
+
|
43
|
+
RUBY_EXTCONF_H =
|
44
|
+
CFLAGS = -g -O2 -Wall -I/cygdrive/f/RR/Source/waveswissknife/svn/waveswissknife/external/CommonUtils/include
|
45
|
+
INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
|
46
|
+
CPPFLAGS =
|
47
|
+
CXXFLAGS = $(CFLAGS)
|
48
|
+
DLDFLAGS = -L. -L/cygdrive/f/RR/Source/waveswissknife/svn/waveswissknife/external/CommonUtils/lib -lCommonUtils -Wl,--enable-auto-image-base,--enable-auto-import,--export-all
|
49
|
+
LDSHARED = gcc -shared -s
|
50
|
+
AR = ar
|
51
|
+
EXEEXT = .exe
|
52
|
+
|
53
|
+
RUBY_INSTALL_NAME = ruby
|
54
|
+
RUBY_SO_NAME = ruby
|
55
|
+
arch = i386-cygwin
|
56
|
+
sitearch = i386-cygwin
|
57
|
+
ruby_version = 1.8
|
58
|
+
ruby = /usr/bin/ruby
|
59
|
+
RUBY = $(ruby)
|
60
|
+
RM = rm -f
|
61
|
+
MAKEDIRS = mkdir -p
|
62
|
+
INSTALL = /usr/bin/install -c
|
63
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
64
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
65
|
+
COPY = cp
|
66
|
+
|
67
|
+
#### End of system configuration section. ####
|
68
|
+
|
69
|
+
preload =
|
70
|
+
|
71
|
+
libpath = . $(libdir)
|
72
|
+
LIBPATH = -L"." -L"$(libdir)"
|
73
|
+
DEFFILE =
|
74
|
+
|
75
|
+
CLEANFILES = mkmf.log
|
76
|
+
DISTCLEANFILES =
|
77
|
+
|
78
|
+
extout =
|
79
|
+
extout_prefix =
|
80
|
+
target_prefix =
|
81
|
+
LOCAL_LIBS =
|
82
|
+
LIBS = $(LIBRUBYARG_SHARED) -ldl -lcrypt
|
83
|
+
SRCS = AnalyzeUtils.c
|
84
|
+
OBJS = AnalyzeUtils.o
|
85
|
+
TARGET = AnalyzeUtils
|
86
|
+
DLLIB = $(TARGET).so
|
87
|
+
EXTSTATIC =
|
88
|
+
STATIC_LIB =
|
89
|
+
|
90
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
91
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
92
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
93
|
+
|
94
|
+
TARGET_SO = $(DLLIB)
|
95
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
96
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
97
|
+
|
98
|
+
all: $(DLLIB)
|
99
|
+
static: $(STATIC_LIB)
|
100
|
+
|
101
|
+
clean:
|
102
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
103
|
+
|
104
|
+
distclean: clean
|
105
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
106
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
107
|
+
|
108
|
+
realclean: distclean
|
109
|
+
install: install-so install-rb
|
110
|
+
|
111
|
+
install-so: $(RUBYARCHDIR)
|
112
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
113
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
114
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
115
|
+
install-rb: pre-install-rb install-rb-default
|
116
|
+
install-rb-default: pre-install-rb-default
|
117
|
+
pre-install-rb: Makefile
|
118
|
+
pre-install-rb-default: Makefile
|
119
|
+
$(RUBYARCHDIR):
|
120
|
+
$(MAKEDIRS) $@
|
121
|
+
|
122
|
+
site-install: site-install-so site-install-rb
|
123
|
+
site-install-so: install-so
|
124
|
+
site-install-rb: install-rb
|
125
|
+
|
126
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
127
|
+
|
128
|
+
.cc.o:
|
129
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
130
|
+
|
131
|
+
.cxx.o:
|
132
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
133
|
+
|
134
|
+
.cpp.o:
|
135
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
136
|
+
|
137
|
+
.C.o:
|
138
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
139
|
+
|
140
|
+
.c.o:
|
141
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
142
|
+
|
143
|
+
$(DLLIB): $(OBJS)
|
144
|
+
@-$(RM) $@
|
145
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
$(OBJS): ruby.h defines.h
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
lAdditionalLocalLibs = [
|
7
|
+
'CommonUtils'
|
8
|
+
]
|
9
|
+
|
10
|
+
require 'mkmf'
|
11
|
+
$CFLAGS += ' -Wall '
|
12
|
+
lAdditionalLocalLibs.each do |iLibName|
|
13
|
+
lLibDir = File.expand_path("#{File.dirname(__FILE__)}/../../../external/#{iLibName}")
|
14
|
+
$CFLAGS += " -I#{lLibDir}/include "
|
15
|
+
$LDFLAGS += " -L#{lLibDir}/lib -l#{iLibName} "
|
16
|
+
end
|
17
|
+
create_makefile('AnalyzeUtils')
|
18
|
+
system('make')
|