excel_to_code 0.2.20 → 0.2.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/excel_to_c +14 -13
- data/bin/excel_to_ruby +23 -13
- data/src/commands/excel_to_x.rb +8 -1
- data/src/compile/c/a.out +0 -0
- data/src/compile/c/excel_to_c_runtime_test.c +3 -0
- data/src/excel/excel_functions/sumifs.rb +8 -1
- data/src/excel_to_code.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dfb614b4506cd5feb1fdf4ed13261b19e33af1c
|
4
|
+
data.tar.gz: 5e06790944edc88f7ccea7959e4a1a1a6119fffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f5287bc61bfaa773332bfd7361eb062cf3f3246649ce677699374745fdb68cb707899457a003faabd04caa3285483a04a465e8a6864bdcad8a593faa417bf00
|
7
|
+
data.tar.gz: 1dbe79f4c2bf8dcb78db9f033f30ce1dfd0f5e44b3e8004a51b2f42f62507001ae3e3c17e25a19af075af0b67d25598cd214b7b0a39987f994ca7333e6300c2f
|
data/bin/excel_to_c
CHANGED
@@ -4,7 +4,6 @@ require_relative '../src/excel_to_code'
|
|
4
4
|
|
5
5
|
command = ExcelToC.new
|
6
6
|
|
7
|
-
#FIXME: Add a version option
|
8
7
|
opts = OptionParser.new do |opts|
|
9
8
|
opts.banner = <<-END
|
10
9
|
|
@@ -20,18 +19,15 @@ END
|
|
20
19
|
opts.separator ""
|
21
20
|
opts.separator "Specific options:"
|
22
21
|
|
23
|
-
opts.on('-
|
24
|
-
|
22
|
+
opts.on('-v','--version', 'Prints the version number of this code') do
|
23
|
+
puts ExcelToCode.version
|
24
|
+
exit
|
25
25
|
end
|
26
26
|
|
27
27
|
opts.on('-o','--output-name NAME','Filename to give to c version of code (and associated ruby interface). Defaults to a folder with the same name as the excel file.') do |name|
|
28
28
|
command.output_name = name
|
29
29
|
end
|
30
|
-
|
31
|
-
opts.on('-p','--prune-except WORKSHEET',"Remove all cells except those on this worksheet, or that are required to calculate values on that worksheet. By default keeps all cells.") do |sheet|
|
32
|
-
command.cells_to_keep = { sheet => :all }
|
33
|
-
end
|
34
|
-
|
30
|
+
|
35
31
|
opts.on('-c','--compile',"Compile the generated code (where relevant)") do
|
36
32
|
command.actually_compile_code = true
|
37
33
|
end
|
@@ -39,15 +35,20 @@ END
|
|
39
35
|
opts.on('-r','--run-tests',"Compile the generated code and then run the tests") do
|
40
36
|
command.actually_run_tests = true
|
41
37
|
end
|
42
|
-
|
43
|
-
opts.on('--
|
44
|
-
command.
|
38
|
+
|
39
|
+
opts.on('-n','--named-references',"Transfer named references from spreadsheet to generated code") do
|
40
|
+
command.named_references_that_can_be_set_at_runtime = :where_possible
|
41
|
+
command.named_references_to_keep = :all
|
45
42
|
end
|
46
43
|
|
47
|
-
opts.on('
|
48
|
-
command.
|
44
|
+
opts.on('-s','--settable WORKSHEET','Make it possible to set the values of cells in this worksheet at runtime. By default no values are settable.') do |sheet|
|
45
|
+
command.cells_that_can_be_set_at_runtime = { sheet => :all }
|
49
46
|
end
|
50
47
|
|
48
|
+
opts.on('-p','--prune-except WORKSHEET',"Remove all cells except those on this worksheet, or that are required to calculate values on that worksheet. By default keeps all cells.") do |sheet|
|
49
|
+
command.cells_to_keep = { sheet => :all }
|
50
|
+
end
|
51
|
+
|
51
52
|
opts.on('--isolate WORKSHEET', "Only performs translation and optimiation of that one worksheet. Useful for debugging an incorrect translation of a large worksheet") do |sheet|
|
52
53
|
command.isolate = sheet
|
53
54
|
end
|
data/bin/excel_to_ruby
CHANGED
@@ -19,28 +19,38 @@ END
|
|
19
19
|
opts.separator ""
|
20
20
|
opts.separator "Specific options:"
|
21
21
|
|
22
|
-
opts.on('-
|
23
|
-
|
22
|
+
opts.on('-v','--version', 'Prints the version number of this code') do
|
23
|
+
puts ExcelToCode.version
|
24
|
+
exit
|
24
25
|
end
|
25
26
|
|
26
|
-
opts.on('-o','--output-name NAME','Filename to give to
|
27
|
+
opts.on('-o','--output-name NAME','Filename to give to c version of code (and associated ruby interface). Defaults to a folder with the same name as the excel file.') do |name|
|
27
28
|
command.output_name = name
|
28
29
|
end
|
29
|
-
|
30
|
-
opts.on('-
|
31
|
-
command.
|
30
|
+
|
31
|
+
opts.on('-c','--compile',"Compile the generated code (where relevant)") do
|
32
|
+
command.actually_compile_code = true
|
32
33
|
end
|
33
|
-
|
34
|
-
opts.on('-r','--run-tests',"
|
34
|
+
|
35
|
+
opts.on('-r','--run-tests',"Compile the generated code and then run the tests") do
|
35
36
|
command.actually_run_tests = true
|
36
37
|
end
|
37
|
-
|
38
|
-
opts.on('--
|
39
|
-
command.
|
38
|
+
|
39
|
+
opts.on('-n','--named-references',"Transfer named references from spreadsheet to generated code") do
|
40
|
+
command.named_references_that_can_be_set_at_runtime = :where_possible
|
41
|
+
command.named_references_to_keep = :all
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on('-s','--settable WORKSHEET','Make it possible to set the values of cells in this worksheet at runtime. By default no values are settable.') do |sheet|
|
45
|
+
command.cells_that_can_be_set_at_runtime = { sheet => :all }
|
40
46
|
end
|
41
47
|
|
42
|
-
opts.on('--
|
43
|
-
command.
|
48
|
+
opts.on('-p','--prune-except WORKSHEET',"Remove all cells except those on this worksheet, or that are required to calculate values on that worksheet. By default keeps all cells.") do |sheet|
|
49
|
+
command.cells_to_keep = { sheet => :all }
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on('--isolate WORKSHEET', "Only performs translation and optimiation of that one worksheet. Useful for debugging an incorrect translation of a large worksheet") do |sheet|
|
53
|
+
command.isolate = sheet
|
44
54
|
end
|
45
55
|
|
46
56
|
opts.on("-h", "--help", "Show this message") do
|
data/src/commands/excel_to_x.rb
CHANGED
@@ -540,7 +540,14 @@ class ExcelToX
|
|
540
540
|
def transfer_named_references_to_keep_into_cells_to_keep
|
541
541
|
log.info "Transfering named references to keep into cells to keep"
|
542
542
|
return unless @named_references_to_keep
|
543
|
-
|
543
|
+
if @named_references_to_keep == :all
|
544
|
+
@named_references_to_keep = @named_references.keys
|
545
|
+
# If the user has specified named_references_to_keep == :all, but there are none, fall back
|
546
|
+
if @named_references_to_keep.empty?
|
547
|
+
log.warn "named_references_to_keep == :all, but no named references found"
|
548
|
+
return
|
549
|
+
end
|
550
|
+
end
|
544
551
|
@cells_to_keep ||= {}
|
545
552
|
@named_references_to_keep.each do |name|
|
546
553
|
ref = @named_references[name]
|
data/src/compile/c/a.out
CHANGED
Binary file
|
@@ -482,6 +482,9 @@ int test_functions() {
|
|
482
482
|
ExcelValue sumifs_array_9[] = { new_excel_number(10), new_excel_string("10.0")};
|
483
483
|
assert(sumifs(new_excel_number(100),2,sumifs_array_9).number == 100);
|
484
484
|
|
485
|
+
ExcelValue sumifs_array_9b[] = { new_excel_string("10"), new_excel_number(10.0)};
|
486
|
+
assert(sumifs(new_excel_number(100),2,sumifs_array_9b).number == 100);
|
487
|
+
|
485
488
|
ExcelValue sumifs_array_10[] = { sumifs_array_4_v, new_excel_string("CO2"), sumifs_array_5_v, new_excel_number(2)};
|
486
489
|
assert(sumifs(sumifs_array_3_v,4, sumifs_array_10).number == 0);
|
487
490
|
|
@@ -37,7 +37,14 @@ module ExcelFunctions
|
|
37
37
|
|
38
38
|
pass = case check_value
|
39
39
|
when String
|
40
|
-
|
40
|
+
case required_value
|
41
|
+
when String
|
42
|
+
check_value.downcase == required_value.downcase
|
43
|
+
when Numeric
|
44
|
+
check_value.to_f == required_value.to_f
|
45
|
+
else
|
46
|
+
check_value.downcase == required_value.to_s.downcase
|
47
|
+
end
|
41
48
|
when true, false
|
42
49
|
check_value == required_value
|
43
50
|
when nil
|
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.2.
|
4
|
+
version: 0.2.21
|
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: 2014-
|
11
|
+
date: 2014-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypeg
|