Commit 35c63b46 authored by Arturo Espinosa's avatar Arturo Espinosa

Rename OP_ constant to OPER_* to avoid namespace clashes in Perl plugin

parent ef54b95e
...@@ -757,8 +757,8 @@ static char *help_max = { ...@@ -757,8 +757,8 @@ static char *help_max = {
}; };
enum { enum {
OP_MIN, OPER_MIN,
OP_MAX OPER_MAX
}; };
typedef struct { typedef struct {
...@@ -775,7 +775,7 @@ callback_function_min_max (Sheet *sheet, Value *value, char **error_string, void ...@@ -775,7 +775,7 @@ callback_function_min_max (Sheet *sheet, Value *value, char **error_string, void
switch (value->type){ switch (value->type){
case VALUE_INTEGER: case VALUE_INTEGER:
if (mm->found){ if (mm->found){
if (mm->operation == OP_MIN){ if (mm->operation == OPER_MIN){
if (value->v.v_int < mm->result->v.v_float) if (value->v.v_int < mm->result->v.v_float)
mm->result->v.v_float = value->v.v_int; mm->result->v.v_float = value->v.v_int;
} else { } else {
...@@ -790,7 +790,7 @@ callback_function_min_max (Sheet *sheet, Value *value, char **error_string, void ...@@ -790,7 +790,7 @@ callback_function_min_max (Sheet *sheet, Value *value, char **error_string, void
case VALUE_FLOAT: case VALUE_FLOAT:
if (mm->found){ if (mm->found){
if (mm->operation == OP_MIN){ if (mm->operation == OPER_MIN){
if (value->v.v_float < mm->result->v.v_float) if (value->v.v_float < mm->result->v.v_float)
mm->result->v.v_float = value->v.v_float; mm->result->v.v_float = value->v.v_float;
} else { } else {
...@@ -815,7 +815,7 @@ gnumeric_min (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, c ...@@ -815,7 +815,7 @@ gnumeric_min (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, c
min_max_closure_t closure; min_max_closure_t closure;
Sheet *sheet = (Sheet *) tsheet; Sheet *sheet = (Sheet *) tsheet;
closure.operation = OP_MIN; closure.operation = OPER_MIN;
closure.found = 0; closure.found = 0;
closure.result = g_new (Value, 1); closure.result = g_new (Value, 1);
closure.result->type = VALUE_FLOAT; closure.result->type = VALUE_FLOAT;
...@@ -834,7 +834,7 @@ gnumeric_max (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, c ...@@ -834,7 +834,7 @@ gnumeric_max (void *tsheet, GList *expr_node_list, int eval_col, int eval_row, c
min_max_closure_t closure; min_max_closure_t closure;
Sheet *sheet = (Sheet *) tsheet; Sheet *sheet = (Sheet *) tsheet;
closure.operation = OP_MAX; closure.operation = OPER_MAX;
closure.found = 0; closure.found = 0;
closure.result = g_new (Value, 1); closure.result = g_new (Value, 1);
closure.result->type = VALUE_FLOAT; closure.result->type = VALUE_FLOAT;
......
...@@ -123,7 +123,7 @@ do_clipboard_paste_cell_region (CellRegion *region, Sheet *dest_sheet, ...@@ -123,7 +123,7 @@ do_clipboard_paste_cell_region (CellRegion *region, Sheet *dest_sheet,
dest_row + paste_height - 1); dest_row + paste_height - 1);
/* If no operations are defined, we clear the area */ /* If no operations are defined, we clear the area */
if (!(paste_flags & PASTE_OP_MASK)) if (!(paste_flags & PASTE_OPER_MASK))
sheet_redraw_cell_region (dest_sheet, sheet_redraw_cell_region (dest_sheet,
dest_col, dest_row, dest_col, dest_row,
dest_col + paste_width - 1, dest_col + paste_width - 1,
......
...@@ -7,15 +7,15 @@ enum { ...@@ -7,15 +7,15 @@ enum {
PASTE_FORMATS = 2, PASTE_FORMATS = 2,
/* Operations that can be performed at paste time on a cell */ /* Operations that can be performed at paste time on a cell */
PASTE_OP_ADD = 4, PASTE_OPER_ADD = 4,
PASTE_OP_SUB = 8, PASTE_OPER_SUB = 8,
PASTE_OP_MULT = 16, PASTE_OPER_MULT = 16,
PASTE_OP_DIV = 32 PASTE_OPER_DIV = 32
}; };
#define PASTE_ALL_TYPES (PASTE_FORMULAS | PASTE_VALUES | PASTE_FORMATS) #define PASTE_ALL_TYPES (PASTE_FORMULAS | PASTE_VALUES | PASTE_FORMATS)
#define PASTE_DEFAULT PASTE_ALL_TYPES #define PASTE_DEFAULT PASTE_ALL_TYPES
#define PASTE_OP_MASK (PASTE_OP_ADD | PASTE_OP_SUB | PASTE_OP_MULT | PASTE_OP_DIV) #define PASTE_OPER_MASK (PASTE_OPER_ADD | PASTE_OPER_SUB | PASTE_OPER_MULT | PASTE_OPER_DIV)
CellRegion *clipboard_copy_cell_range (Sheet *sheet, CellRegion *clipboard_copy_cell_range (Sheet *sheet,
int start_col, int start_row, int start_col, int start_row,
......
...@@ -177,39 +177,39 @@ add_tree_deps (Cell *cell, ExprTree *tree) ...@@ -177,39 +177,39 @@ add_tree_deps (Cell *cell, ExprTree *tree)
GList *l; GList *l;
switch (tree->oper){ switch (tree->oper){
case OP_EQUAL: case OPER_EQUAL:
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
case OP_GT: case OPER_GT:
case OP_GTE: case OPER_GTE:
case OP_LT: case OPER_LT:
case OP_LTE: case OPER_LTE:
case OP_ADD: case OPER_ADD:
case OP_SUB: case OPER_SUB:
case OP_MULT: case OPER_MULT:
case OP_DIV: case OPER_DIV:
case OP_EXP: case OPER_EXP:
case OP_CONCAT: case OPER_CONCAT:
add_tree_deps (cell, tree->u.binary.value_a); add_tree_deps (cell, tree->u.binary.value_a);
add_tree_deps (cell, tree->u.binary.value_b); add_tree_deps (cell, tree->u.binary.value_b);
return; return;
case OP_CONSTANT: case OPER_CONSTANT:
add_value_deps (cell, tree->u.constant); add_value_deps (cell, tree->u.constant);
return; return;
case OP_FUNCALL: case OPER_FUNCALL:
for (l = tree->u.function.arg_list; l; l = l->next) for (l = tree->u.function.arg_list; l; l = l->next)
add_tree_deps (cell, l->data); add_tree_deps (cell, l->data);
return; return;
case OP_VAR: case OPER_VAR:
add_cell_range_deps ( add_cell_range_deps (
cell, cell,
&tree->u.constant->v.cell, &tree->u.constant->v.cell,
&tree->u.constant->v.cell); &tree->u.constant->v.cell);
return; return;
case OP_NEG: case OPER_NEG:
add_tree_deps (cell, tree->u.value); add_tree_deps (cell, tree->u.value);
return; return;
......
...@@ -131,19 +131,19 @@ dialog_paste_special (void) ...@@ -131,19 +131,19 @@ dialog_paste_special (void)
i = gtk_radio_group_get_selected (group_ops); i = gtk_radio_group_get_selected (group_ops);
switch (i){ switch (i){
case 1: /* Add */ case 1: /* Add */
result |= PASTE_OP_ADD; result |= PASTE_OPER_ADD;
break; break;
case 2: case 2:
result |= PASTE_OP_SUB; result |= PASTE_OPER_SUB;
break; break;
case 3: case 3:
result |= PASTE_OP_MULT; result |= PASTE_OPER_MULT;
break; break;
case 4: case 4:
result |= PASTE_OP_DIV; result |= PASTE_OPER_DIV;
break; break;
} }
} }
......
...@@ -131,19 +131,19 @@ dialog_paste_special (void) ...@@ -131,19 +131,19 @@ dialog_paste_special (void)
i = gtk_radio_group_get_selected (group_ops); i = gtk_radio_group_get_selected (group_ops);
switch (i){ switch (i){
case 1: /* Add */ case 1: /* Add */
result |= PASTE_OP_ADD; result |= PASTE_OPER_ADD;
break; break;
case 2: case 2:
result |= PASTE_OP_SUB; result |= PASTE_OPER_SUB;
break; break;
case 3: case 3:
result |= PASTE_OP_MULT; result |= PASTE_OPER_MULT;
break; break;
case 4: case 4:
result |= PASTE_OP_DIV; result |= PASTE_OPER_DIV;
break; break;
} }
} }
......
...@@ -177,39 +177,39 @@ add_tree_deps (Cell *cell, ExprTree *tree) ...@@ -177,39 +177,39 @@ add_tree_deps (Cell *cell, ExprTree *tree)
GList *l; GList *l;
switch (tree->oper){ switch (tree->oper){
case OP_EQUAL: case OPER_EQUAL:
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
case OP_GT: case OPER_GT:
case OP_GTE: case OPER_GTE:
case OP_LT: case OPER_LT:
case OP_LTE: case OPER_LTE:
case OP_ADD: case OPER_ADD:
case OP_SUB: case OPER_SUB:
case OP_MULT: case OPER_MULT:
case OP_DIV: case OPER_DIV:
case OP_EXP: case OPER_EXP:
case OP_CONCAT: case OPER_CONCAT:
add_tree_deps (cell, tree->u.binary.value_a); add_tree_deps (cell, tree->u.binary.value_a);
add_tree_deps (cell, tree->u.binary.value_b); add_tree_deps (cell, tree->u.binary.value_b);
return; return;
case OP_CONSTANT: case OPER_CONSTANT:
add_value_deps (cell, tree->u.constant); add_value_deps (cell, tree->u.constant);
return; return;
case OP_FUNCALL: case OPER_FUNCALL:
for (l = tree->u.function.arg_list; l; l = l->next) for (l = tree->u.function.arg_list; l; l = l->next)
add_tree_deps (cell, l->data); add_tree_deps (cell, l->data);
return; return;
case OP_VAR: case OPER_VAR:
add_cell_range_deps ( add_cell_range_deps (
cell, cell,
&tree->u.constant->v.cell, &tree->u.constant->v.cell,
&tree->u.constant->v.cell); &tree->u.constant->v.cell);
return; return;
case OP_NEG: case OPER_NEG:
add_tree_deps (cell, tree->u.value); add_tree_deps (cell, tree->u.value);
return; return;
......
...@@ -62,28 +62,28 @@ do_expr_tree_ref (ExprTree *tree) ...@@ -62,28 +62,28 @@ do_expr_tree_ref (ExprTree *tree)
tree->ref_count++; tree->ref_count++;
switch (tree->oper){ switch (tree->oper){
case OP_VAR: case OPER_VAR:
case OP_CONSTANT: case OPER_CONSTANT:
case OP_FUNCALL: case OPER_FUNCALL:
break; break;
case OP_EQUAL: case OPER_EQUAL:
case OP_GT: case OPER_GT:
case OP_LT: case OPER_LT:
case OP_GTE: case OPER_GTE:
case OP_LTE: case OPER_LTE:
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
case OP_ADD: case OPER_ADD:
case OP_SUB: case OPER_SUB:
case OP_MULT: case OPER_MULT:
case OP_DIV: case OPER_DIV:
case OP_EXP: case OPER_EXP:
case OP_CONCAT: case OPER_CONCAT:
do_expr_tree_ref (tree->u.binary.value_a); do_expr_tree_ref (tree->u.binary.value_a);
do_expr_tree_ref (tree->u.binary.value_b); do_expr_tree_ref (tree->u.binary.value_b);
break; break;
case OP_NEG: case OPER_NEG:
do_expr_tree_ref (tree->u.value); do_expr_tree_ref (tree->u.value);
break; break;
} }
...@@ -107,36 +107,36 @@ do_expr_tree_unref (ExprTree *tree) ...@@ -107,36 +107,36 @@ do_expr_tree_unref (ExprTree *tree)
{ {
tree->ref_count--; tree->ref_count--;
switch (tree->oper){ switch (tree->oper){
case OP_VAR: case OPER_VAR:
break; break;
case OP_CONSTANT: case OPER_CONSTANT:
if (tree->ref_count == 0) if (tree->ref_count == 0)
value_release (tree->u.constant); value_release (tree->u.constant);
break; break;
case OP_FUNCALL: case OPER_FUNCALL:
if (tree->ref_count == 0) if (tree->ref_count == 0)
symbol_unref (tree->u.function.symbol); symbol_unref (tree->u.function.symbol);
break; break;
case OP_EQUAL: case OPER_EQUAL:
case OP_GT: case OPER_GT:
case OP_LT: case OPER_LT:
case OP_GTE: case OPER_GTE:
case OP_LTE: case OPER_LTE:
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
case OP_ADD: case OPER_ADD:
case OP_SUB: case OPER_SUB:
case OP_MULT: case OPER_MULT:
case OP_DIV: case OPER_DIV:
case OP_EXP: case OPER_EXP:
case OP_CONCAT: case OPER_CONCAT:
do_expr_tree_unref (tree->u.binary.value_a); do_expr_tree_unref (tree->u.binary.value_a);
do_expr_tree_unref (tree->u.binary.value_b); do_expr_tree_unref (tree->u.binary.value_b);
break; break;
case OP_NEG: case OPER_NEG:
do_expr_tree_unref (tree->u.value); do_expr_tree_unref (tree->u.value);
break; break;
} }
...@@ -476,7 +476,7 @@ function_def_call_with_values (Sheet *sheet, FunctionDefinition *fd, int argc, ...@@ -476,7 +476,7 @@ function_def_call_with_values (Sheet *sheet, FunctionDefinition *fd, int argc,
tree = g_new (ExprTree, argc); tree = g_new (ExprTree, argc);
for (i = 0; i < argc; i++){ for (i = 0; i < argc; i++){
tree [i].oper = OP_CONSTANT; tree [i].oper = OPER_CONSTANT;
tree [i].ref_count = 1; tree [i].ref_count = 1;
tree [i].u.constant = values [i]; tree [i].u.constant = values [i];
...@@ -632,12 +632,12 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -632,12 +632,12 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
g_return_val_if_fail (IS_SHEET (asheet), NULL); g_return_val_if_fail (IS_SHEET (asheet), NULL);
switch (tree->oper){ switch (tree->oper){
case OP_EQUAL: case OPER_EQUAL:
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
case OP_GT: case OPER_GT:
case OP_GTE: case OPER_GTE:
case OP_LT: case OPER_LT:
case OP_LTE: { case OPER_LTE: {
int comp; int comp;
a = eval_expr (sheet, tree->u.binary.value_a, a = eval_expr (sheet, tree->u.binary.value_a,
...@@ -664,27 +664,27 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -664,27 +664,27 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
} }
switch (tree->oper){ switch (tree->oper){
case OP_EQUAL: case OPER_EQUAL:
res->v.v_int = comp == IS_EQUAL; res->v.v_int = comp == IS_EQUAL;
break; break;
case OP_GT: case OPER_GT:
res->v.v_int = comp == IS_GREATER; res->v.v_int = comp == IS_GREATER;
break; break;
case OP_LT: case OPER_LT:
res->v.v_int = comp == IS_LESS; res->v.v_int = comp == IS_LESS;
break; break;
case OP_LTE: case OPER_LTE:
res->v.v_int = (comp == IS_EQUAL || comp == IS_LESS); res->v.v_int = (comp == IS_EQUAL || comp == IS_LESS);
break; break;
case OP_GTE: case OPER_GTE:
res->v.v_int = (comp == IS_EQUAL || comp == IS_GREATER); res->v.v_int = (comp == IS_EQUAL || comp == IS_GREATER);
break; break;
case OP_NOT_EQUAL: case OPER_NOT_EQUAL:
res->v.v_int = comp != IS_EQUAL; res->v.v_int = comp != IS_EQUAL;
break; break;
...@@ -696,11 +696,11 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -696,11 +696,11 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
return res; return res;
} }
case OP_ADD: case OPER_ADD:
case OP_SUB: case OPER_SUB:
case OP_MULT: case OPER_MULT:
case OP_DIV: case OPER_DIV:
case OP_EXP: case OPER_EXP:
a = eval_expr (sheet, tree->u.binary.value_a, a = eval_expr (sheet, tree->u.binary.value_a,
eval_col, eval_row, error_string); eval_col, eval_row, error_string);
b = eval_expr (sheet, tree->u.binary.value_b, b = eval_expr (sheet, tree->u.binary.value_b,
...@@ -726,19 +726,19 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -726,19 +726,19 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
res->type = VALUE_INTEGER; res->type = VALUE_INTEGER;
switch (tree->oper){ switch (tree->oper){
case OP_ADD: case OPER_ADD:
res->v.v_int = a->v.v_int + b->v.v_int; res->v.v_int = a->v.v_int + b->v.v_int;
break; break;
case OP_SUB: case OPER_SUB:
res->v.v_int = a->v.v_int - b->v.v_int; res->v.v_int = a->v.v_int - b->v.v_int;
break; break;
case OP_MULT: case OPER_MULT:
res->v.v_int = a->v.v_int * b->v.v_int; res->v.v_int = a->v.v_int * b->v.v_int;
break; break;
case OP_DIV: case OPER_DIV:
if (b->v.v_int == 0){ if (b->v.v_int == 0){
value_release (a); value_release (a);
value_release (b); value_release (b);
...@@ -750,7 +750,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -750,7 +750,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
res->v.v_float = a->v.v_int / (float_t)b->v.v_int; res->v.v_float = a->v.v_int / (float_t)b->v.v_int;
break; break;
case OP_EXP: case OPER_EXP:
res->v.v_int = pow (a->v.v_int, b->v.v_int); res->v.v_int = pow (a->v.v_int, b->v.v_int);
break; break;
default: default:
...@@ -762,19 +762,19 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -762,19 +762,19 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
b = value_cast_to_float (b); b = value_cast_to_float (b);
switch (tree->oper){ switch (tree->oper){
case OP_ADD: case OPER_ADD:
res->v.v_float = a->v.v_float + b->v.v_float; res->v.v_float = a->v.v_float + b->v.v_float;
break; break;
case OP_SUB: case OPER_SUB:
res->v.v_float = a->v.v_float - b->v.v_float; res->v.v_float = a->v.v_float - b->v.v_float;
break; break;
case OP_MULT: case OPER_MULT:
res->v.v_float = a->v.v_float * b->v.v_float; res->v.v_float = a->v.v_float * b->v.v_float;
break; break;
case OP_DIV: case OPER_DIV:
if (b->v.v_float == 0.0){ if (b->v.v_float == 0.0){
value_release (a); value_release (a);
value_release (b); value_release (b);
...@@ -786,7 +786,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -786,7 +786,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
res->v.v_float = a->v.v_float / b->v.v_float; res->v.v_float = a->v.v_float / b->v.v_float;
break; break;
case OP_EXP: case OPER_EXP:
res->v.v_float = pow (a->v.v_float, b->v.v_float); res->v.v_float = pow (a->v.v_float, b->v.v_float);
break; break;
default: default:
...@@ -796,7 +796,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro ...@@ -796,7 +796,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
value_release (b); value_release (b);
return res; return res;
case OP_CONCAT: {