Commit 09ed851a authored by Jody Goldberg's avatar Jody Goldberg

Make Value into a real discriminated union and split into types.

This provides a modest memory savings and paves the way for
a custom allocator.
parent 0069c587
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
2000-04-29 Jody Goldberg <jgoldberg@home.com>
* * : Convert 'Value' into a union of real types and allocate each
seperately.
* src/dialogs/dialog-printer-setup.c (do_print_preview_cb) :
Suppress warning.
2000-04-29 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/dialog-stf-preview.c :
......
......@@ -2157,7 +2157,7 @@ write_names (BiffPut *bp, ExcelWorkbook *wb)
int
ms_excel_write_map_errcode (Value const * const v)
{
char const * const mesg = v->v.error.mesg->str;
char const * const mesg = v->v_err.mesg->str;
if (!strcmp (gnumeric_err_NULL, mesg))
return 0;
if (!strcmp (gnumeric_err_DIV0, mesg))
......@@ -2213,7 +2213,7 @@ write_value (BiffPut *bp, Value *v, eBiff_version ver,
MS_OLE_SET_GUINT8 (data + 6, ms_excel_write_map_errcode (v));
MS_OLE_SET_GUINT8 (data + 7, 1); /* Mark as a err */
} else {
MS_OLE_SET_GUINT8 (data + 6, v->v.v_bool ? 1 : 0);
MS_OLE_SET_GUINT8 (data + 6, v->v_bool.val ? 1 : 0);
MS_OLE_SET_GUINT8 (data + 7, 0); /* Mark as a bool */
}
ms_biff_put_commit (bp);
......@@ -2221,15 +2221,15 @@ write_value (BiffPut *bp, Value *v, eBiff_version ver,
}
case VALUE_INTEGER:
{
int_t vint = v->v.v_int;
int_t vint = v->v_int.val;
guint8 *data;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_write_debug > 3)
printf ("Writing %d %d\n", vint, v->v.v_int);
printf ("Writing %d %d\n", vint, v->v_int.val);
#endif
if (((vint<<2)>>2) != vint) { /* Chain to floating point then. */
Value *vf = value_new_float (v->v.v_int);
Value *vf = value_new_float (v->v_int.val);
write_value (bp, vf, ver, col, row, xf);
value_release (vf);
} else {
......@@ -2246,7 +2246,7 @@ write_value (BiffPut *bp, Value *v, eBiff_version ver,
}
case VALUE_FLOAT:
{
float_t val = v->v.v_float;
float_t val = v->v_float.val;
gboolean is_int = ((val - (int)val) == 0.0) &&
(((((int)val)<<2)>>2) == ((int)val));
......@@ -2287,7 +2287,7 @@ write_value (BiffPut *bp, Value *v, eBiff_version ver,
case VALUE_STRING:
{
char data[16];
g_return_if_fail (v->v.str->str);
g_return_if_fail (v->v_str.val->str);
if (ver >= eBiffV8); /* Use SST stuff in fulness of time */
......@@ -2297,9 +2297,9 @@ write_value (BiffPut *bp, Value *v, eBiff_version ver,
EX_SETXF (data, xf);
EX_SETCOL(data, col);
EX_SETROW(data, row);
EX_SETSTRLEN (data, strlen(v->v.str->str));
EX_SETSTRLEN (data, strlen(v->v_str.val->str));
ms_biff_put_var_write (bp, data, 8);
biff_put_text (bp, v->v.str->str, eBiffV7, FALSE, AS_PER_VER);
biff_put_text (bp, v->v_str.val->str, eBiffV7, FALSE, AS_PER_VER);
ms_biff_put_commit (bp);
break;
}
......@@ -2357,7 +2357,7 @@ write_formula (BiffPut *bp, ExcelSheet *sheet, const Cell *cell, gint16 xf)
case VALUE_BOOLEAN :
MS_OLE_SET_GUINT32 (data + 6,
(v->v.v_bool ? 0x100 : 0x0) | 0x00000001);
(v->v_bool.val ? 0x100 : 0x0) | 0x00000001);
MS_OLE_SET_GUINT32 (data + 10, 0xffff0000);
break;
......
......@@ -688,7 +688,7 @@ make_function (ParseList **stack, int fn_idx, int numargs)
if (tmp != NULL) {
if (tmp->oper == OPER_CONSTANT &&
tmp->u.constant->type == VALUE_STRING)
f_name = tmp->u.constant->v.str->str;
f_name = tmp->u.constant->v_str.val->str;
else if (tmp->oper == OPER_NAME)
f_name = tmp->u.name->name->str;
}
......
......@@ -625,7 +625,7 @@ write_node (PolishData *pd, ExprTree *tree)
{
guint8 data[2];
MS_OLE_SET_GUINT8 (data, FORMULA_PTG_BOOL);
MS_OLE_SET_GUINT8 (data+1, v->v.v_bool ? 1 : 0);
MS_OLE_SET_GUINT8 (data+1, v->v_bool.val ? 1 : 0);
ms_biff_put_var_write (pd->bp, data, 2);
break;
}
......@@ -647,13 +647,13 @@ write_node (PolishData *pd, ExprTree *tree)
}
case VALUE_STRING:
write_string (pd, v->v.str->str);
write_string (pd, v->v_str.val->str);
break;
case VALUE_CELLRANGE:
{ /* FIXME: Could be 3D ! */
write_area (pd, &v->v.cell_range.cell_a,
&v->v.cell_range.cell_b);
write_area (pd, &v->v_range.cell_a,
&v->v_range.cell_b);
break;
}
......@@ -662,13 +662,13 @@ write_node (PolishData *pd, ExprTree *tree)
{
guint8 data[8];
if (v->v.array.x > 256 ||
v->v.array.y > 65536)
if (v->v_array.x > 256 ||
v->v_array.y > 65536)
g_warning ("Array far too big");
MS_OLE_SET_GUINT8 (data + 0, FORMULA_PTG_ARRAY);
MS_OLE_SET_GUINT8 (data + 1, v->v.array.x - 1);
MS_OLE_SET_GUINT16 (data + 2, v->v.array.y - 1);
MS_OLE_SET_GUINT8 (data + 1, v->v_array.x - 1);
MS_OLE_SET_GUINT16 (data + 2, v->v_array.y - 1);
MS_OLE_SET_GUINT16 (data + 4, 0x0); /* ? */
MS_OLE_SET_GUINT16 (data + 6, 0x0); /* ? */
ms_biff_put_var_write (pd->bp, data, 8);
......@@ -758,9 +758,9 @@ write_arrays (PolishData *pd)
array = pd->arrays->data;
g_return_if_fail (array->type == VALUE_ARRAY);
for (lpy = 0; lpy < array->v.array.y; lpy++) {
for (lpx = 0; lpx < array->v.array.x; lpx++) {
const Value *v = array->v.array.vals[lpx][lpy];
for (lpy = 0; lpy < array->v_array.y; lpy++) {
for (lpx = 0; lpx < array->v_array.x; lpx++) {
const Value *v = array->v_array.vals[lpx][lpy];
if (VALUE_IS_NUMBER (v)) {
push_guint8 (pd, 1);
......
......@@ -31,7 +31,7 @@ criteria_test_equal(Value *x, Value *y)
else
return 0;
else if (x->type == VALUE_STRING && y->type == VALUE_STRING
&& g_strcasecmp (x->v.str->str, y->v.str->str) == 0)
&& g_strcasecmp (x->v_str.val->str, y->v_str.val->str) == 0)
return 1;
else
return 0;
......@@ -46,7 +46,7 @@ criteria_test_unequal(Value *x, Value *y)
else
return 0;
else if (x->type == VALUE_STRING && y->type == VALUE_STRING
&& g_strcasecmp(x->v.str->str, y->v.str->str) != 0)
&& g_strcasecmp(x->v_str.val->str, y->v_str.val->str) != 0)
return 1;
else
return 0;
......@@ -112,8 +112,8 @@ find_column_of_field (const EvalPosition *ep, Value *database, Value *field)
int begin_col, end_col, row, n, column;
int offset;
offset = database->v.cell_range.cell_b.col -
database->v.cell_range.cell_a.col;
offset = database->v_range.cell_b.col -
database->v_range.cell_a.col;
if (field->type == VALUE_INTEGER)
return value_get_as_int (field) + offset - 1;
......@@ -121,14 +121,14 @@ find_column_of_field (const EvalPosition *ep, Value *database, Value *field)
if (field->type != VALUE_STRING)
return -1;
sheet = eval_sheet (database->v.cell_range.cell_a.sheet, ep->sheet);
sheet = eval_sheet (database->v_range.cell_a.sheet, ep->sheet);
field_name = value_get_as_string (field);
column = -1;
/* find the column that is labeled after `field_name' */
begin_col = database->v.cell_range.cell_a.col;
end_col = database->v.cell_range.cell_b.col;
row = database->v.cell_range.cell_a.row;
begin_col = database->v_range.cell_a.col;
end_col = database->v_range.cell_b.col;
row = database->v_range.cell_a.row;
for (n = begin_col; n <= end_col; n++) {
char *txt;
......@@ -282,11 +282,11 @@ parse_database_criteria (const EvalPosition *ep, Value *database,
int b_col, b_row, e_col, e_row;
int *field_ind;
sheet = eval_sheet (database->v.cell_range.cell_a.sheet, ep->sheet);
b_col = criteria->v.cell_range.cell_a.col;
b_row = criteria->v.cell_range.cell_a.row;
e_col = criteria->v.cell_range.cell_b.col;
e_row = criteria->v.cell_range.cell_b.row;
sheet = eval_sheet (database->v_range.cell_a.sheet, ep->sheet);
b_col = criteria->v_range.cell_a.col;
b_row = criteria->v_range.cell_a.row;
e_col = criteria->v_range.cell_b.col;
e_row = criteria->v_range.cell_b.row;
field_ind = g_new(int, (e_col-b_col+1));
......@@ -318,9 +318,9 @@ find_cells_that_match (Sheet *sheet, Value *database,
{
GSList *current, *conditions, *cells;
int row, first_row, last_row, add_flag;
last_row = database->v.cell_range.cell_b.row;
last_row = database->v_range.cell_b.row;
cells = NULL;
first_row = database->v.cell_range.cell_a.row + 1;
first_row = database->v_range.cell_a.row + 1;
for (row=first_row; row<=last_row; row++) {
Cell *cell, *test_cell;
......@@ -527,7 +527,7 @@ gnumeric_daverage (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -594,7 +594,7 @@ gnumeric_dcount (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -655,7 +655,7 @@ gnumeric_dcounta (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -720,7 +720,7 @@ gnumeric_dget (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -786,7 +786,7 @@ gnumeric_dmax (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL)
......@@ -854,7 +854,7 @@ gnumeric_dmin (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL) {
......@@ -924,7 +924,7 @@ gnumeric_dproduct (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -992,7 +992,7 @@ gnumeric_dstdev (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL)
......@@ -1058,7 +1058,7 @@ gnumeric_dstdevp (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL) {
......@@ -1126,7 +1126,7 @@ gnumeric_dsum (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL) {
......@@ -1193,7 +1193,7 @@ gnumeric_dvar (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
if (cells == NULL) {
......@@ -1262,7 +1262,7 @@ gnumeric_dvarp (FunctionEvalInfo *ei, Value **argv)
if (criterias == NULL)
return value_new_error (ei->pos, gnumeric_err_NUM);
sheet = eval_sheet (database->v.cell_range.cell_a.sheet,
sheet = eval_sheet (database->v_range.cell_a.sheet,
ei->pos->sheet);
cells = find_cells_that_match (sheet, database, field, criterias);
......@@ -1319,7 +1319,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
if (col == -1)
return value_new_error (ei->pos, gnumeric_err_REF);
row = argv[0]->v.cell_range.cell_b.row;
row = argv[0]->v_range.cell_b.row;
cell = sheet_cell_get(ei->pos->sheet, col, row);
/* FIXME: Lots of stuff missing */
......
......@@ -74,18 +74,18 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
return value_duplicate(value);
case VALUE_STRING:
str = value->v.str->str;
str = value->v_str.val->str;
break;
case VALUE_BOOLEAN :
snprintf (buffer, sizeof (buffer)-1, "%d", value->v.v_bool?1:0);
snprintf (buffer, sizeof (buffer)-1, "%d", value->v_bool.val?1:0);
str = buffer;
break;
case VALUE_INTEGER:
snprintf (buffer, sizeof (buffer)-1, "%d", value->v.v_int);
snprintf (buffer, sizeof (buffer)-1, "%d", value->v_int.val);
str = buffer;
break;
case VALUE_FLOAT:
snprintf (buffer, sizeof (buffer)-1, "%8.0f", value->v.v_float);
snprintf (buffer, sizeof (buffer)-1, "%8.0f", value->v_float.val);
str = buffer;
break;
case VALUE_EMPTY:
......@@ -662,7 +662,7 @@ gnumeric_complex (FunctionEvalInfo *ei, Value **argv)
if (argv[2] == NULL)
suffix = "i";
else
suffix = argv[2]->v.str->str;
suffix = argv[2]->v_str.val->str;
if (strcmp(suffix, "i") != 0 &&
strcmp(suffix, "j") != 0)
......@@ -1606,8 +1606,8 @@ gnumeric_convert (FunctionEvalInfo *ei, Value **argv)
Value *v;
n = value_get_as_float (argv [0]);
from_unit = argv [1]->v.str->str;
to_unit = argv [2]->v.str->str;
from_unit = argv [1]->v_str.val->str;
to_unit = argv [2]->v_str.val->str;
if (strcmp(from_unit, "C") == 0 && strcmp(to_unit, "F") == 0)
return value_new_float (1.8*n+32);
......@@ -1769,7 +1769,7 @@ gnumeric_delta (FunctionEvalInfo *ei, Value **argv)
switch ((vx->type > vy->type) ? vx->type : vy->type) {
case VALUE_BOOLEAN:
/* Only happens when both are bool */
ans = vx->v.v_bool == vy->v.v_bool;
ans = vx->v_bool.val == vy->v_bool.val;
break;
case VALUE_EMPTY:
case VALUE_INTEGER:
......@@ -1823,7 +1823,7 @@ gnumeric_gestep (FunctionEvalInfo *ei, Value **argv)
switch ((vx->type > vy->type) ? vx->type : vy->type) {
case VALUE_BOOLEAN:
/* Only happens when both are bool */
ans = vx->v.v_bool >= vy->v.v_bool;
ans = vx->v_bool.val >= vy->v_bool.val;
break;
case VALUE_EMPTY:
case VALUE_INTEGER:
......
......@@ -1949,7 +1949,7 @@ static char *help_euro = {
static Value *
gnumeric_euro (FunctionEvalInfo *ei, Value **argv)
{
char *str = argv[0]->v.str->str;
char *str = argv[0]->v_str.val->str;
switch (*str) {
case 'A':
......
......@@ -143,8 +143,8 @@ translate_cell_format (StyleFormat *format)
static Value *
gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
{
char * info_type = argv [0]->v.str->str;
CellRef ref = argv [1]->v.cell_range.cell_a;
char * info_type = argv [0]->v_str.val->str;
CellRef ref = argv [1]->v_range.cell_a;
if (!g_strcasecmp(info_type, "address")) {
/* Reference of the first cell in reference, as text. */
......@@ -236,10 +236,10 @@ gnumeric_countblank (FunctionEvalInfo *ei, Value **args)
range = args[0];
sheet = eval_sheet (ei->pos->sheet, ei->pos->sheet);
col_a = range->v.cell_range.cell_a.col;
col_b = range->v.cell_range.cell_b.col;
row_a = range->v.cell_range.cell_a.row;
row_b = range->v.cell_range.cell_b.row;
col_a = range->v_range.cell_a.col;
col_b = range->v_range.cell_b.col;
row_a = range->v_range.cell_a.row;
row_b = range->v_range.cell_b.row;
count = 0;
for (i=col_a; i<=col_b; i++)
......@@ -269,7 +269,7 @@ static char *help_info = {
static Value *
gnumeric_info (FunctionEvalInfo *ei, Value **argv)
{
char const * const info_type = argv [0]->v.str->str;
char const * const info_type = argv [0]->v_str.val->str;
if (!strcasecmp (info_type, "directory")) {
/* Path of the current directory or folder. */
return value_new_error (ei->pos, _("Unimplemented"));
......@@ -411,7 +411,7 @@ gnumeric_isna (FunctionEvalInfo *ei, GList *expr_node_list)
if (err != NULL)
return err;
b = (res && !strcmp (gnumeric_err_NA, res->v.error.mesg->str));
b = (res && !strcmp (gnumeric_err_NA, res->v_err.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -441,7 +441,7 @@ gnumeric_iserr (FunctionEvalInfo *ei, GList *expr_node_list)
if (err != NULL)
return err;
b = (res && strcmp (gnumeric_err_NA, res->v.error.mesg->str));
b = (res && strcmp (gnumeric_err_NA, res->v_err.mesg->str));
if (res) value_release (res);
return value_new_bool (b);
}
......@@ -481,7 +481,7 @@ gnumeric_error_type (FunctionEvalInfo *ei, GList *expr_node_list)
if (res == NULL)
return value_new_error (ei->pos, gnumeric_err_NA);
mesg = res->v.error.mesg->str;
mesg = res->v_err.mesg->str;
if (!strcmp (gnumeric_err_NULL, mesg))
retval = 1;
else if (!strcmp (gnumeric_err_DIV0, mesg))
......@@ -546,7 +546,7 @@ gnumeric_error (FunctionEvalInfo *ei, Value *argv[])
if (argv [0]->type != VALUE_STRING)
return value_new_error (ei->pos, _("Type mismatch"));
return value_new_error (ei->pos, argv [0]->v.str->str);
return value_new_error (ei->pos, argv [0]->v_str.val->str);
}
/***************************************************************************/
......@@ -808,7 +808,7 @@ gnumeric_n (FunctionEvalInfo *ei, Value **argv)
if (argv[0]->type != VALUE_STRING)
return value_new_error (ei->pos, gnumeric_err_NUM);
str = argv[0]->v.str->str;
str = argv[0]->v_str.val->str;
if (NULL != (v = format_match (str, &format)))
return v;
return value_new_float (0);
......
......@@ -78,7 +78,7 @@ gnumeric_address (FunctionEvalInfo *ei, Value **args)
text = g_new(gchar, 1);
text[0] = '\0';
} else {
gchar *p = args[4]->v.str->str;
gchar *p = args[4]->v_str.val->str;
int space = 0;
text = g_new(gchar, strlen(p) + 4);
......@@ -86,9 +86,9 @@ gnumeric_address (FunctionEvalInfo *ei, Value **args)
if (*p++ == ' ')
space = 1;
if (space)
sprintf(text, "'%s'", args[4]->v.str->str);
sprintf(text, "'%s'", args[4]->v_str.val->str);
else
strcpy(text, args[4]->v.str->str);
strcpy(text, args[4]->v_str.val->str);
strcat(text, "!");
}
......@@ -596,7 +596,7 @@ match_compare (const Value *v1, const Value *v2)
}
case VALUE_STRING:
return strcasecmp (v1->v.str->str, v2->v.str->str);
return strcasecmp (v1->v_str.val->str, v2->v_str.val->str);
default:
return 0;
......@@ -815,8 +815,8 @@ gnumeric_column (FunctionEvalInfo *ei, GList *nodes)
expr->u.constant->type == VALUE_CELLRANGE) {
int i, j, col;
Value const * range = expr->u.constant;
CellRef const * a = &range->v.cell_range.cell_a;
CellRef const * b = &range->v.cell_range.cell_b;
CellRef const * a = &range->v_range.cell_a;
CellRef const * b = &range->v_range.cell_b;
Value * res = value_new_array (b->col - a->col + 1,
b->row - a->row + 1);
......@@ -887,8 +887,8 @@ gnumeric_offset (FunctionEvalInfo *ei, Value **args)
g_return_val_if_fail (args [0]->type == VALUE_CELLRANGE, NULL);
cell_ref_make_abs (&a, &args[0]->v.cell_range.cell_a, ei->pos);
cell_ref_make_abs (&b, &args[0]->v.cell_range.cell_b, ei->pos);
cell_ref_make_abs (&a, &args[0]->v_range.cell_a, ei->pos);
cell_ref_make_abs (&b, &args[0]->v_range.cell_b, ei->pos);
row_offset = value_get_as_int (args[1]);
col_offset = value_get_as_int (args[2]);
......@@ -958,8 +958,8 @@ gnumeric_row (FunctionEvalInfo *ei, GList *nodes)
expr->u.constant->type == VALUE_CELLRANGE) {
int i, j, row;
Value const * range = expr->u.constant;
CellRef const * a = &range->v.cell_range.cell_a;
CellRef const * b = &range->v.cell_range.cell_b;
CellRef const * a = &range->v_range.cell_a;
CellRef const * b = &range->v_range.cell_b;
Value * res = value_new_array (b->col - a->col + 1,
b->row - a->row + 1);
......@@ -1060,9 +1060,9 @@ gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
res = value_new_array_non_init (rows, cols);
for (r = 0; r < rows; ++r){
res->v.array.vals [r] = g_new (Value *, cols);
res->v_array.vals [r] = g_new (Value *, cols);
for (c = 0; c < cols; ++c)
res->v.array.vals[r][c] =
res->v_array.vals[r][c] =
value_duplicate(value_area_get_x_y (ep, matrix,
c, r));
}
......
......@@ -37,13 +37,13 @@ callback_function_sumxy (Sheet *sheet, int col, int row,
return value_terminate();
case VALUE_BOOLEAN:
x = cell->value->v.v_bool ? 1 : 0;
x = cell->value->v_bool.val ? 1 : 0;
break;
case VALUE_INTEGER:
x = cell->value->v.v_int;
x = cell->value->v_int.val;
break;
case VALUE_FLOAT:
x = cell->value->v.v_float;
x = cell->value->v_float.val;
break;
case VALUE_EMPTY:
default:
......@@ -83,16 +83,16 @@ callback_function_criteria (Sheet *sheet, int col, int row,
switch (cell->value->type) {
case VALUE_BOOLEAN:
v = value_new_bool (cell->value->v.v_bool);
v = value_new_bool (cell->value->v_bool.val);
break;
case VALUE_INTEGER:
v = value_new_int (cell->value->v.v_int);
v = value_new_int (cell->value->v_int.val);
break;
case VALUE_FLOAT:
v = value_new_float (cell->value->v.v_float);
v = value_new_float (cell->value->v_float.val);
break;
case VALUE_STRING:
v = value_new_string (cell->value->v.str->str);
v = value_new_string (cell->value->v_str.val->str);
break;
case VALUE_EMPTY:
default:
......@@ -195,10 +195,10 @@ callback_function_lcm (const EvalPosition *ep, Value *value, void *closure)
switch (value->type){
case VALUE_INTEGER:
if (value->v.v_int < 1)
if (value->v_int.val < 1)
return value_terminate();
result->v.v_int /= gcd(result->v.v_int, value->v.v_int);
result->v.v_int *= value->v.v_int;
result->v_int.val /= gcd(result->v_int.val, value->v_int.val);
result->v_int.val *= value->v_int.val;
break;
case VALUE_EMPTY:
default:
......@@ -518,18 +518,18 @@ gnumeric_countif (FunctionEvalInfo *ei, Value **argv)
items.fun = (criteria_test_fun_t) criteria_test_equal;
items.test_value = argv[1];
} else {
parse_criteria(argv[1]->v.str->str,
parse_criteria(argv[1]->v_str.val->str,
&items.fun, &items.test_value);