excel_to_code 0.3.4 → 0.3.5
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 +4 -0
- data/src/commands/excel_to_c.rb +30 -5
- data/src/commands/excel_to_ruby.rb +1 -1
- data/src/commands/excel_to_x.rb +9 -0
- data/src/compile/c/a.out +0 -0
- data/src/compile/c/a.out.dSYM/Contents/Info.plist +20 -0
- data/src/compile/c/a.out.dSYM/Contents/Resources/DWARF/a.out +0 -0
- data/src/compile/c/compile_to_c_unit_test.rb +17 -3
- data/src/compile/c/excel_to_c_runtime.c +216 -170
- data/src/compile/c/excel_to_c_runtime_test.c +471 -451
- data/src/compile/c/map_formulae_to_c.rb +1 -1
- data/src/compile/c/map_values_to_c.rb +3 -3
- data/src/excel/excel_functions/right.rb +1 -0
- data/src/excel_to_code.rb +1 -1
- data/src/simplify/replace_values_with_constants.rb +0 -24
- metadata +4 -2
@@ -250,7 +250,7 @@ class MapFormulaeToC < MapValuesToC
|
|
250
250
|
|
251
251
|
# Then we need to assign it to an excel value
|
252
252
|
range_name = array_name+"_ev"
|
253
|
-
initializers << "ExcelValue #{range_name} =
|
253
|
+
initializers << "ExcelValue #{range_name} = EXCEL_RANGE(#{array_name},#{number_of_rows},#{number_of_columns});"
|
254
254
|
|
255
255
|
range_name
|
256
256
|
end
|
@@ -52,16 +52,16 @@ class MapValuesToC
|
|
52
52
|
else
|
53
53
|
text.to_i.to_s
|
54
54
|
end
|
55
|
-
"
|
55
|
+
"EXCEL_NUMBER(#{n})"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def percentage(text)
|
60
|
-
"
|
60
|
+
"EXCEL_NUMBER(#{(text.to_f / 100.0).to_s})"
|
61
61
|
end
|
62
62
|
|
63
63
|
def string(text)
|
64
|
-
"
|
64
|
+
"EXCEL_STRING(#{text.inspect})"
|
65
65
|
end
|
66
66
|
|
67
67
|
ERRORS = {
|
data/src/excel_to_code.rb
CHANGED
@@ -12,7 +12,6 @@ class MapValuesToConstants
|
|
12
12
|
|
13
13
|
def map(ast)
|
14
14
|
return ast unless ast.is_a?(Array)
|
15
|
-
operator = ast[0]
|
16
15
|
if replace?(ast)
|
17
16
|
ast.replace([:constant, constants[ast.dup]])
|
18
17
|
else
|
@@ -38,26 +37,3 @@ class MapValuesToConstants
|
|
38
37
|
|
39
38
|
end
|
40
39
|
|
41
|
-
|
42
|
-
class ReplaceValuesWithConstants
|
43
|
-
|
44
|
-
attr_accessor :rewriter
|
45
|
-
|
46
|
-
def self.replace(*args)
|
47
|
-
self.new.replace(*args)
|
48
|
-
end
|
49
|
-
|
50
|
-
def replace(input,output)
|
51
|
-
@rewriter ||= MapValuesToConstants.new
|
52
|
-
input.each_line do |line|
|
53
|
-
begin
|
54
|
-
ref, ast = line.split("\t")
|
55
|
-
output.puts "#{ref}\t#{rewriter.map(eval(ast)).inspect}"
|
56
|
-
rescue Exception => e
|
57
|
-
puts "Exception at line #{line}"
|
58
|
-
raise
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
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.5
|
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-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypeg
|
@@ -126,6 +126,8 @@ files:
|
|
126
126
|
- src/compile.rb
|
127
127
|
- src/compile/c.rb
|
128
128
|
- src/compile/c/a.out
|
129
|
+
- src/compile/c/a.out.dSYM/Contents/Info.plist
|
130
|
+
- src/compile/c/a.out.dSYM/Contents/Resources/DWARF/a.out
|
129
131
|
- src/compile/c/compile_named_reference_setters.rb
|
130
132
|
- src/compile/c/compile_to_c.rb
|
131
133
|
- src/compile/c/compile_to_c_header.rb
|