~ubuntu-branches/ubuntu/quantal/gnumeric/quantal

« back to all changes in this revision

Viewing changes to plugins/excel/ms-formula-write.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2009-06-07 11:10:47 UTC
  • mfrom: (1.1.19 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090607111047-l3rtbzfjxvmi1kx0
Tags: 1.9.8-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Promoted gnumeric-doc to Recommends in gnumeric package for help to be
    installed automatically
  - gnumeric-gtk is a transitional package
  - gnumeric conflicts with gnumeric-gtk << 1.8.3-3ubuntu1
  - call initltool-update in po*
  - remove psiconv support (psiconv is in universe):
    o debian/control: remove B-D on libpsiconv-dev
    o debian/rules: don't pass --with-psiconv to ./configure

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <expr.h>
30
30
#include <expr-impl.h>
31
31
#include <expr-name.h>
32
 
#include <str.h>
33
32
#include <parse-util.h>
34
33
#include <goffice/app/io-context.h>
35
34
 
109
108
                        return;
110
109
 
111
110
                ef = g_new (ExcelFunc, 1);
112
 
                if (!(func->flags & (GNM_FUNC_IS_PLACEHOLDER|GNM_FUNC_IS_WORKBOOK_LOCAL))) {
113
 
                        for (i = 0; i < excel_func_desc_size; i++)
114
 
                                if (!g_ascii_strcasecmp (excel_func_desc[i].name, func->name)) {
115
 
                                        ef->efunc = excel_func_desc + i;
116
 
                                        ef->idx = i;
117
 
                                        ef->macro_name = NULL;
118
 
                                        break;
119
 
                                }
120
 
                } else
121
 
                        i = excel_func_desc_size;
 
111
                ef->efunc = (func->flags & (GNM_FUNC_IS_PLACEHOLDER |
 
112
                                            GNM_FUNC_IS_WORKBOOK_LOCAL))
 
113
                        ? NULL
 
114
                        : g_hash_table_lookup (excel_func_by_name,
 
115
                                               func->name);
122
116
 
123
 
                if (i >= excel_func_desc_size) {
124
 
                        ef->efunc = NULL;
125
 
                        if (func->flags & GNM_FUNC_IS_WORKBOOK_LOCAL) {
126
 
                                ef->macro_name = g_strdup (func->name);
127
 
                                ef->idx = -1;
128
 
                        } else {
129
 
                                g_ptr_array_add (ewb->externnames, func);
130
 
                                ef->macro_name = NULL;
131
 
                                ef->idx = ewb->externnames->len;
132
 
                        }
 
117
                if (ef->efunc) {
 
118
                        ef->idx = ef->efunc - excel_func_desc;
 
119
                        ef->macro_name = NULL;
 
120
                } else if (func->flags & GNM_FUNC_IS_WORKBOOK_LOCAL) {
 
121
                        ef->macro_name = g_strdup (func->name);
 
122
                        ef->idx = -1;
 
123
                } else {
 
124
                        g_ptr_array_add (ewb->externnames, func);
 
125
                        ef->macro_name = NULL;
 
126
                        ef->idx = ewb->externnames->len;
133
127
                }
134
128
                g_hash_table_insert (ewb->function_map, func, ef);
135
129
                break;
651
645
                int prec;                     /* Precedences -- should match parser.y  */
652
646
                int assoc_left, assoc_right;  /* 0: no, 1: yes.  */
653
647
        } const operations [] = {
 
648
                { FORMULA_PTG_PAREN,     0, 0, 0 }, /* Parentheses for clarity  */
654
649
                { FORMULA_PTG_EQUAL,     1, 1, 0 },
655
650
                { FORMULA_PTG_GT,        1, 1, 0 },
656
651
                { FORMULA_PTG_LT,        1, 1, 0 },
682
677
        case GNM_EXPR_OP_ANY_BINARY :
683
678
                if (target_type != XL_ARRAY)
684
679
                        target_type = XL_VAL;
685
 
 
 
680
                /* Fall through.  */
686
681
        case GNM_EXPR_OP_RANGE_CTOR:
687
682
        case GNM_EXPR_OP_INTERSECT: {
688
683
                int const prec = operations[op].prec;
746
741
                }
747
742
 
748
743
                case VALUE_STRING:
749
 
                        write_string (pd, v->v_str.val->str);
 
744
                        write_string (pd, value_peek_string (v));
750
745
                        break;
751
746
 
752
747
                case VALUE_CELLRANGE:
793
788
                write_node (pd, expr->unary.value, operations[op].prec,
794
789
                        (target_type != XL_ARRAY) ? XL_VAL : XL_ARRAY);
795
790
                push_guint8 (pd, operations[op].xl_op);
796
 
                if (prec <= paren_level)
 
791
                if (op != GNM_EXPR_OP_PAREN && prec <= paren_level)
797
792
                        push_guint8 (pd, FORMULA_PTG_PAREN);
798
793
                break;
799
794
        }