excel_to_code 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/commands/excel_to_x.rb +7 -1
- data/src/compile/c/a.out +0 -0
- data/src/compile/c/a.out.dSYM/Contents/Resources/DWARF/a.out +0 -0
- data/src/compile/c/excel_to_c_runtime.c +18 -0
- data/src/compile/c/excel_to_c_runtime_test.c +10 -0
- data/src/compile/c/map_formulae_to_c.rb +1 -0
- data/src/compile/ruby/map_formulae_to_ruby.rb +1 -0
- data/src/excel/excel_functions.rb +2 -0
- data/src/excel/excel_functions/char.rb +12 -0
- data/src/excel_to_code.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7be4eb5782ad34fe1d4a42bf50083440afcc72e2
|
4
|
+
data.tar.gz: ac3bbda110cc0d9ce8dcbc504fce982e79c849d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca73c4cac5b6acef852961b40cd495e91793b5424ef1833b9bdfbf4614c012bcb7c058eda8139b877e2fa8496d4b74014bd9e6066650e2852e6cf8e68bf7456
|
7
|
+
data.tar.gz: df4a7cc607b058104cabd6f03f1fe2675d352a90d1c63fc5591f22e2ba76450c46cfd076f70ca2ef9d7bf29b98ddb1b82ca4657b35bdb064a189b6126241ef12
|
data/src/commands/excel_to_x.rb
CHANGED
@@ -231,7 +231,13 @@ class ExcelToX
|
|
231
231
|
unless self.log
|
232
232
|
self.log = Logger.new(STDOUT)
|
233
233
|
log.formatter = proc do |severity, datetime, progname, msg|
|
234
|
-
|
234
|
+
case severity
|
235
|
+
when "FATAL"; "\033[41m#{datetime.strftime("%H:%M")}\t#{msg}\033[0m\n"
|
236
|
+
when "ERROR"; "\033[41m#{datetime.strftime("%H:%M")}\t#{msg}\033[0m\n"
|
237
|
+
when "WARN"; "\033[31m#{datetime.strftime("%H:%M")}\t#{msg}\033[0m\n"
|
238
|
+
when "INFO"; "\033[34m#{datetime.strftime("%H:%M")}\t#{msg}\033[0m\n"
|
239
|
+
else; "#{datetime.strftime("%H:%M")}\t#{msg}\n"
|
240
|
+
end
|
235
241
|
end
|
236
242
|
end
|
237
243
|
|
data/src/compile/c/a.out
CHANGED
Binary file
|
Binary file
|
@@ -58,6 +58,7 @@ static ExcelValue less_than(ExcelValue a_v, ExcelValue b_v);
|
|
58
58
|
static ExcelValue less_than_or_equal(ExcelValue a_v, ExcelValue b_v);
|
59
59
|
static ExcelValue average(int array_size, ExcelValue *array);
|
60
60
|
static ExcelValue averageifs(ExcelValue average_range_v, int number_of_arguments, ExcelValue *arguments);
|
61
|
+
static ExcelValue excel_char(ExcelValue number_v);
|
61
62
|
static ExcelValue ensure_is_number(ExcelValue maybe_number_v);
|
62
63
|
static ExcelValue find_2(ExcelValue string_to_look_for_v, ExcelValue string_to_look_in_v);
|
63
64
|
static ExcelValue find(ExcelValue string_to_look_for_v, ExcelValue string_to_look_in_v, ExcelValue position_to_start_at_v);
|
@@ -300,6 +301,23 @@ static ExcelValue excel_abs(ExcelValue a_v) {
|
|
300
301
|
}
|
301
302
|
}
|
302
303
|
|
304
|
+
static ExcelValue excel_char(ExcelValue a_v) {
|
305
|
+
CHECK_FOR_PASSED_ERROR(a_v)
|
306
|
+
NUMBER(a_v, a)
|
307
|
+
CHECK_FOR_CONVERSION_ERROR
|
308
|
+
if(a <= 0) { return VALUE; }
|
309
|
+
if(a >= 256) { return VALUE; }
|
310
|
+
a = floor(a);
|
311
|
+
char *string = malloc(1); // Freed later
|
312
|
+
if(string == 0) {
|
313
|
+
printf("Out of memory in char");
|
314
|
+
exit(-1);
|
315
|
+
}
|
316
|
+
string[0] = a;
|
317
|
+
free_later(string);
|
318
|
+
return EXCEL_STRING(string);
|
319
|
+
}
|
320
|
+
|
303
321
|
static ExcelValue add(ExcelValue a_v, ExcelValue b_v) {
|
304
322
|
CHECK_FOR_PASSED_ERROR(a_v)
|
305
323
|
CHECK_FOR_PASSED_ERROR(b_v)
|
@@ -1012,6 +1012,16 @@ int test_functions() {
|
|
1012
1012
|
ExcelValue npv_array5[] = { BLANK };
|
1013
1013
|
assert(npv(EXCEL_NUMBER(0.1), 1, npv_array5).number == 0);
|
1014
1014
|
|
1015
|
+
// CHAR
|
1016
|
+
assert_equal(VALUE, excel_char(ZERO), "excel_char(0) == VALUE");
|
1017
|
+
assert_equal(VALUE, excel_char(EXCEL_NUMBER(256)), "excel_char(256) == VALUE");
|
1018
|
+
assert_equal(VALUE, excel_char(BLANK), "excel_char() == VALUE");
|
1019
|
+
assert_equal(VALUE, excel_char(EXCEL_STRING("adsfa")), "excel_char('nonsense') == VALUE");
|
1020
|
+
assert_equal(DIV0, excel_char(DIV0), "excel_char(DIV0) == DIV0");
|
1021
|
+
assert_equal(EXCEL_STRING("\x01"), excel_char(ONE), "excel_char(1) == '\x01'");
|
1022
|
+
assert_equal(EXCEL_STRING("a"), excel_char(EXCEL_NUMBER(97)), "excel_char(97) == 'a'");
|
1023
|
+
assert_equal(EXCEL_STRING("a"), excel_char(EXCEL_NUMBER(97.5)), "excel_char(97.5) == 'a'");
|
1024
|
+
|
1015
1025
|
// Release memory
|
1016
1026
|
free_all_allocated_memory();
|
1017
1027
|
|
data/src/excel_to_code.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excel_to_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Counsell, Green on Black Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypeg
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- src/excel/excel_functions/average.rb
|
156
156
|
- src/excel/excel_functions/averageifs.rb
|
157
157
|
- src/excel/excel_functions/cell.rb
|
158
|
+
- src/excel/excel_functions/char.rb
|
158
159
|
- src/excel/excel_functions/choose.rb
|
159
160
|
- src/excel/excel_functions/cosh.rb
|
160
161
|
- src/excel/excel_functions/count.rb
|