Skip to content

Commit

Permalink
sum() function now works again!
Browse files Browse the repository at this point in the history
A significant win, I think.

I had to reinstate the behavious of add_range_ref()
  • Loading branch information
Mark Carter committed Jan 17, 2019
1 parent c15fe33 commit 924807d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ref.cc
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,8 @@ add_ref (CELLREF row, CELLREF col)
/* like add_ref, except over a range of arguments and with memory
* management weirdness.
*/
void
add_range_ref (struct rng *rng)
void add_range_ref (struct rng *rng)
{
return; // TODO FIXME
#if 0
CELL *other_cell;
struct ref_fm *oldref, *newref;
struct ref_fm nonref;
Expand All @@ -637,15 +634,18 @@ add_range_ref (struct rng *rng)
* adjust the refcounts
*/
nonref.refs_refcnt = 1;
other_cell = next_cell_in_range ();
assert(other_cell);
celldeq_t cells_in_range = get_cells_in_range(rng);
//other_cell = next_cell_in_range ();
other_cell = take_front(cells_in_range);
//assert(other_cell);
oldref = other_cell->cell_refs_from;
if (oldref && oldref->refs_refcnt == 1)
oldref = &nonref;

add_ref_fm (&(other_cell->cell_refs_from), cur_row, cur_col);
newref = other_cell->cell_refs_from;
while ((other_cell = next_cell_in_range ()))
//while ((other_cell = next_cell_in_range ()))
while(other_cell = take_front(cells_in_range))
{
if (other_cell->cell_refs_from == oldref)
{
Expand Down Expand Up @@ -675,7 +675,6 @@ add_range_ref (struct rng *rng)
oldref->refs_refcnt=1;
flush_fm_ref(oldref);
} */
#endif
}

static void
Expand Down
8 changes: 8 additions & 0 deletions src/sheet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,11 @@ celldeq_t get_cells_in_range(struct rng *a_rng) // definition

}

cell* take_front(celldeq_t & cd)
{
if(cd.size() ==0) return nullptr;
cell *cp = cd.front();
cd.pop_front();
return cp;
}

1 change: 1 addition & 0 deletions src/sheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct cell* find_or_make_cell(CELLREF row, CELLREF col);

void init_cells();
celldeq_t get_cells_in_range(struct rng *r);
cell* take_front(celldeq_t & cd);

void make_cells_in_range(struct rng *r);
void no_more_cells();
Expand Down

0 comments on commit 924807d

Please sign in to comment.