excel_to_code 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -105,6 +105,7 @@ class ExcelToC < ExcelToX
105
105
  c = CompileToC.new
106
106
  c.variable_set_counter = variable_set_counter
107
107
  c.gettable = lambda { |ref| false }
108
+ c.worksheet = ""
108
109
  i = input("Common elements")
109
110
  c.rewrite(i,w,o)
110
111
  close(i)
@@ -173,10 +173,21 @@ class ExcelToX
173
173
  inline_formulae_that_are_only_used_once
174
174
  separate_formulae_elements
175
175
  replace_values_with_constants
176
-
176
+
177
177
  # This actually creates the code (implemented in subclasses)
178
178
  write_code
179
179
 
180
+ # clear some memory here, before trying to compile
181
+ if run_in_memory
182
+ @files = nil
183
+ @cells_to_keep = nil
184
+ @cells_that_can_be_set_at_runtime = nil
185
+ # now do garbage collection, because what we've just done will have freed a lot of memory
186
+ GC.enable
187
+ GC.start
188
+ # TODO I think there's still another 500MB that could be freed here, when compiling decc_model
189
+ end
190
+
180
191
  # These compile and run the code version of the excel (implemented in subclasses)
181
192
  compile_code
182
193
  run_tests
@@ -18,7 +18,7 @@ class CompileToC
18
18
  mapper = MapFormulaeToC.new
19
19
  mapper.worksheet = worksheet
20
20
  mapper.sheet_names = Hash[sheet_names_file.readlines.map { |line| line.strip.split("\t")}]
21
- c_name = mapper.sheet_names[worksheet]
21
+ c_name = mapper.sheet_names[worksheet] || worksheet
22
22
  input.lines do |line|
23
23
  begin
24
24
  ref, formula = line.split("\t")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel_to_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-11 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubypeg