Commit 6c13ff3a authored by Morten Welinder's avatar Morten Welinder

Fix parsing of references in not-English locales.

parent bde3b4c4
2002-04-10 Morten Welinder <terra@diku.dk>
* src/parse-util.c (cellref_a1_get): Fix toupper usage. Make this
work for non-English. Check for overflow in row number.
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug expr leak
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug
expr leak
(cb_scrollbar_config_ok_clicked) : plug expr leak
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
2002-04-10 Morten Welinder <terra@diku.dk>
* src/parse-util.c (cellref_a1_get): Fix toupper usage. Make this
work for non-English. Check for overflow in row number.
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug expr leak
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug
expr leak
(cb_scrollbar_config_ok_clicked) : plug expr leak
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
2002-04-10 Morten Welinder <terra@diku.dk>
* src/parse-util.c (cellref_a1_get): Fix toupper usage. Make this
work for non-English. Check for overflow in row number.
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug expr leak
* sheet-object-widget.c (cb_checkbox_config_ok_clicked) : plug
expr leak
(cb_scrollbar_config_ok_clicked) : plug expr leak
2002-04-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
......@@ -285,7 +285,7 @@ expr_name_add (ParsePos const *pp, char const *name,
* @value:
* @error:
*
* Parses a texual name in @value, and enters the value
* Parses a textual name in @value, and enters the value
* either as a workbook name if @sheet == NULL or a sheet
* name if @wb == NULL.
*
......
......@@ -135,7 +135,7 @@ gnm_expr_new_binary (GnmExpr const *l, GnmExprOp op, GnmExpr const *r)
GnmExpr const *
gnm_expr_new_name (GnmNamedExpr *name,
Sheet *optional_scope, Workbook *optional_wb_scope)
Sheet *optional_scope, Workbook *optional_wb_scope)
{
GnmExprName *ans;
......
......@@ -61,7 +61,7 @@ cellref_name (CellRef const *cell_ref, ParsePos const *pp, gboolean no_sheetname
if (col < 0)
col += SHEET_MAX_COLS;
if (col <= 'Z'-'A'){
if (col <= 'Z'-'A') {
*p++ = col + 'A';
} else {
int a = col / ('Z'-'A'+1);
......@@ -100,27 +100,37 @@ cellref_a1_get (CellRef *out, char const *in, CellPos const *pos)
{
int col = 0;
int row = 0;
unsigned char uc;
g_return_val_if_fail (in != NULL, NULL);
g_return_val_if_fail (out != NULL, NULL);
/* Try to parse a column */
if (*in == '$'){
if (*in == '$') {
out->col_relative = FALSE;
in++;
} else
out->col_relative = TRUE;
if (!(toupper (*in) >= 'A' && toupper (*in) <= 'Z'))
/*
* Careful here! 'A' and 'a' are not necessarily the only
* characters which toupper maps to 'A'.
*/
uc = (unsigned char)*in;
if (!((uc >= 'A' && uc <= 'Z') ||
(uc >= 'a' && uc <= 'z')))
return NULL;
col = toupper (uc) - 'A';
in++;
col = toupper (*in++) - 'A';
if (toupper (*in) >= 'A' && toupper (*in) <= 'Z')
col = (col+1) * ('Z'-'A'+1) + toupper (*in++) - 'A';
uc = (unsigned char)*in;
if ((uc >= 'A' && uc <= 'Z') || (uc >= 'a' && uc <= 'z')) {
col = (col + 1) * ('Z' - 'A' + 1) + toupper (uc) - 'A';
in++;
}
/* Try to parse a row */
if (*in == '$'){
if (*in == '$') {
out->row_relative = FALSE;
in++;
} else
......@@ -129,12 +139,12 @@ cellref_a1_get (CellRef *out, char const *in, CellPos const *pos)
if (!(*in >= '1' && *in <= '9'))
return NULL;
while (isdigit ((unsigned char)*in)){
while (isdigit ((unsigned char)*in)) {
row = row * 10 + *in - '0';
if (row > SHEET_MAX_ROWS)
return NULL;
in++;
}
if (row > SHEET_MAX_ROWS)
return NULL;
row--;
/* Setup the cell reference information */
......@@ -293,7 +303,7 @@ col_name_internal (char *buf, int col)
g_return_val_if_fail (col < SHEET_MAX_COLS, buf);
g_return_val_if_fail (col >= 0, buf);
if (col <= 'Z'-'A'){
if (col <= 'Z'-'A') {
*buf++ = col + 'A';
} else {
int a = col / ('Z'-'A'+1);
......@@ -455,8 +465,8 @@ parse_cell_name (char const *cell_str, int *col, int *row, gboolean strict, int
/* Parse row number: a sequence of digits. */
for (*row = 0; *cell_str; cell_str++) {
if (*cell_str < '0' || *cell_str > '9'){
if (found_digits && strict == FALSE){
if (*cell_str < '0' || *cell_str > '9') {
if (found_digits && strict == FALSE) {
break;
} else
return FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment