Commit f8206c57 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

- Initial usage of the new exception mechanisms.

- Improve versioning of the plugins.
- Some bug fixes.

1999-12-29  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-view.c (command_context_gui,
				gui_splits_array,
				gui_plugin_problem,
				command_context_gui_cast) : New functions.

	* src/workbook.c (workbook_new) : Switch to using the workbook_view
	  routines to manipulate the undo/redo and paste/paste_special menu
	  items.

	* src/func.c (function_iterate_argument_values) : Return an error
	  for empty/missing arguments.

	* plugins/*/Makefile.am : Define GNUMERIC_VERSION.

	* plugins/*/*.c (init_plugin): Take a CmdContext for error reporting.
	  Call plugin_version_mismatch to do some minimal version matching for
	  plugins and the running application.

	* src/Gnumeric.idl : Add PluginProblem.

	* src/command-context.[ch] (gnumeric_error_splits_array,
				    gnumeric_error_plugin_problem,
				    command_context_vtbl_init) : New functions.

	* src/plugin.c (plugin_version_mismatch) : New function.
	  (plugin_load) : Hard code a GUI context for now.
	                  Switch to using gnumeric_error_ routines.
			  Pass a CmdContext to the init_plugin routines.
			  Only produce an error if the plugin returns -1.
			  Store the plugin filename.
	  (plugin_unload) : Free the filename on exit.

	* *.c : command_context_gui now takes a Workbook argument.
	      : Switch from gnumeric_no_modify_array_notice
	                 to gnumeric_error_splits_array in most places.
parent 9b84663f
1999-12-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook-view.c (command_context_gui,
gui_splits_array,
gui_plugin_problem,
command_context_gui_cast) : New functions.
* src/workbook.c (workbook_new) : Switch to using the workbook_view
routines to manipulate the undo/redo and paste/paste_special menu
items.
* src/func.c (function_iterate_argument_values) : Return an error
for empty/missing arguments.
* plugins/*/Makefile.am : Define GNUMERIC_VERSION.
* plugins/*/*.c (init_plugin): Take a CmdContext for error reporting.
Call plugin_version_mismatch to do some minimal version matching for
plugins and the running application.
* src/Gnumeric.idl : Add PluginProblem.
* src/command-context.[ch] (gnumeric_error_splits_array,
gnumeric_error_plugin_problem,
command_context_vtbl_init) : New functions.
* src/plugin.c (plugin_version_mismatch) : New function.
(plugin_load) : Hard code a GUI context for now.
Switch to using gnumeric_error_ routines.
Pass a CmdContext to the init_plugin routines.
Only produce an error if the plugin returns -1.
Store the plugin filename.
(plugin_unload) : Free the filename on exit.
* *.c : command_context_gui now takes a Workbook argument.
: Switch from gnumeric_no_modify_array_notice
to gnumeric_error_splits_array in most places.
1999-12-28 Peter Moulder <reiter@netspace.net.au>
* src/number-match.c: Currently, two-digit years are converted to
......
1999-12-29 Jody Goldberg <jgoldberg@home.com>
* src/workbook-view.c (command_context_gui,
gui_splits_array,
gui_plugin_problem,
command_context_gui_cast) : New functions.
* src/workbook.c (workbook_new) : Switch to using the workbook_view
routines to manipulate the undo/redo and paste/paste_special menu
items.
* src/func.c (function_iterate_argument_values) : Return an error
for empty/missing arguments.
* plugins/*/Makefile.am : Define GNUMERIC_VERSION.
* plugins/*/*.c (init_plugin): Take a CmdContext for error reporting.
Call plugin_version_mismatch to do some minimal version matching for
plugins and the running application.
* src/Gnumeric.idl : Add PluginProblem.
* src/command-context.[ch] (gnumeric_error_splits_array,
gnumeric_error_plugin_problem,
command_context_vtbl_init) : New functions.
* src/plugin.c (plugin_version_mismatch) : New function.
(plugin_load) : Hard code a GUI context for now.
Switch to using gnumeric_error_ routines.
Pass a CmdContext to the init_plugin routines.
Only produce an error if the plugin returns -1.
Store the plugin filename.
(plugin_unload) : Free the filename on exit.
* *.c : command_context_gui now takes a Workbook argument.
: Switch from gnumeric_no_modify_array_notice
to gnumeric_error_splits_array in most places.
1999-12-28 Peter Moulder <reiter@netspace.net.au>
* src/number-match.c: Currently, two-digit years are converted to
......
......@@ -39,10 +39,9 @@ Gnumeric Spread Sheet task list
* Expressions
* Rework the handling of input ranges for functions/operators that take
scalars. To either take implicit intersection of calling cell and range
or to create array result and apply function/operator to each input
individually.
* Implicit iteration. For an array expression that returns scalar results
which takes a range as a scalar argument, apply the expression to each element
of the input range.
* Implement Even More Functions
......
......@@ -17,5 +17,6 @@ libgnum_dif_la_SOURCES = dif.h dif.c
INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGNUMERIC_VERSION=\""$(VERSION)"\" \
-I$(includedir) \
$(GNOME_INCLUDEDIR)
......@@ -299,7 +299,7 @@ dif_write_cell (FILE *f, Cell *cell, int col, int row)
fputs("1,0\n\"\"\n", f);
break;
case VALUE_STRING: /* Text Value */
case VALUE_STRING: /* Text Value */
fputs("1,0\n\"", f);
fputs(cell->text->str, f);
fputs("\"\n", f);
......@@ -346,7 +346,7 @@ dif_write_cell (FILE *f, Cell *cell, int col, int row)
}
}
if (ferror (f))
return -1;
......@@ -407,10 +407,10 @@ dif_write_workbook (Workbook *wb, const char *filename)
for (col = 0; col <= sheet->cols.max_used; col++) {
cell = sheet_cell_get (sheet, col, row);
rc = dif_write_cell (f, cell, col, row);
if (rc)
if (rc)
goto out;
}
}
sheet_list = sheet_list->next;
......@@ -443,10 +443,13 @@ dif_cleanup_plugin (PluginData *pd)
int
init_plugin (PluginData * pd)
init_plugin (CmdContext *context, PluginData * pd)
{
char *desc;
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return -2;
desc = _("Data Interchange Format (DIF) import");
file_format_register_open (1, desc, NULL, dif_read_workbook);
......
......@@ -13,6 +13,6 @@
#include "sheet.h"
#include "plugin.h"
int init_plugin (PluginData *pd);
int init_plugin (CmdContext *context, PluginData *pd);
#endif /* GNUMERIC_DIF_H */
......@@ -10,7 +10,7 @@
* See S59D52.HTM for the spec.
* NOTE : Use the low byte as much as possible. The high byte is supposed to
* be a version (not mentioned in more recent docs). However, some
* of the low bytes types have multiple record types with different
* of the low bytes types have multiple record types with different
* high bytes.... So much for consistancy.
* As you add low numbers, check you don't glup an odd-ball
**/
......@@ -46,7 +46,7 @@
#define BIFF_ARRAY 0x21 /* 2, NOT 10 */
#define BIFF_1904 0x22 /* 0, NOT 1,10 */
#define BIFF_EXTERNNAME 0x23 /* 2 */
#define BIFF_DEFAULTROWHEIGHT 0x25 /* 2, NOT 10 */
#define BIFF_DEFAULTROWHEIGHT 0x25 /* 2, NOT 10 */
#define BIFF_LEFT_MARGIN 0x26 /* 0, NOT 10 */
#define BIFF_RIGHT_MARGIN 0x27 /* 0, NOT 10 */
#define BIFF_TOP_MARGIN 0x28 /* 0 */
......
......@@ -26,7 +26,7 @@ static gboolean
excel_probe (const char *filename)
{
MsOle *file;
if (ms_ole_open (&file, filename) == MS_OLE_ERR_OK) {
MsOleErr result;
MsOleStream *stream;
......@@ -53,7 +53,7 @@ excel_load (Workbook *wb, const char *filename)
MsOle *f;
gboolean ret;
MsOleErr result;
result = ms_ole_open (&f, filename);
if (result != MS_OLE_ERR_OK) {
ms_ole_destroy (&f);
......@@ -92,7 +92,7 @@ excel_save (Workbook *wb, const char *filename, eBiff_version ver)
_("Saving over old files disabled for safety"));
return 1;
}
result = ms_ole_create (&f, filename);
if (result != MS_OLE_ERR_OK) {
......
......@@ -33,7 +33,7 @@ extern EXCEL_PALETTE_ENTRY const excel_default_palette[];
extern char *excel_builtin_formats[];
#define EXCEL_BUILTIN_FORMAT_LEN 0x32
typedef struct
typedef struct
{
char *prefix ;
int num_args ; /* -1 for multi-arg */
......
......@@ -136,7 +136,7 @@ ms_biff_merge_continues (BiffQuery *bq, guint32 len)
chunk.data[chunk.length-1]);
#endif
tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
bq->pos->read_copy (bq->pos, tmp, 4);
bq->pos->read_copy (bq->pos, tmp, 4);
total_len += chunk.length;
g_array_append_val (contin, chunk);
......
......@@ -12,7 +12,7 @@
extern double biff_getdouble (const guint8 *p);
extern void biff_setdouble (guint8 *p, double d);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
/* MW: I have reservations about this. We are assuming not only little
* endian, but also arbitrary alignment for doubles as well as a certain
......@@ -46,7 +46,7 @@ struct _BiffQuery {
int data_malloced; /* is *data a copy ? */
MsOleStream *pos;
};
/* Sets up a query on a stream */
extern BiffQuery *ms_biff_query_new (MsOleStream *);
/* Updates the BiffQuery structure with the next BIFF record
......@@ -70,13 +70,13 @@ typedef struct _BiffPut
guint8 *data;
MsOlePos streamPos;
MsOlePos curpos; /* Curpos is offset from beggining of header */
guint16 num_merges;
guint16 num_merges;
/* gint16 padding;*/
int data_malloced;
int len_fixed;
MsOleStream *pos;
} BiffPut;
/* Sets up a record on a stream */
extern BiffPut *ms_biff_put_new (MsOleStream *);
extern void ms_biff_put_destroy (BiffPut *);
......
......@@ -1118,10 +1118,10 @@ BC_R(markerformat)(ExcelChartHandler const *handle,
* We already have the colors ?
*/
StyleColor const * marker_border =
ms_excel_palette_get (s->wb->palette,
ms_excel_palette_get (s->wb->palette,
MS_OLE_GET_GUINT16 (q->data+12));
StyleColor const * marker_fill =
ms_excel_palette_get (s->wb->palette,
ms_excel_palette_get (s->wb->palette,
MS_OLE_GET_GUINT16 (q->data+14));
guint32 const marker_size = MS_OLE_GET_GUINT32 (q->data+16);
......
......@@ -235,7 +235,7 @@ ms_escher_read_SplitMenuColors (MSEscherState * state, MSEscherHeader * h)
g_return_val_if_fail (h->instance == 4, TRUE);
g_return_val_if_fail (h->len == 24, TRUE); /* header + 4*4 */
if ((data = ms_escher_get_data (state, h->offset, 24,
common_header_len, &needs_free))) {
guint32 const top_level_fill = MS_OLE_GET_GUINT32(data + 0);
......@@ -395,12 +395,12 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
ms_escher_get_data (state, h->offset, h->len,
header, &needs_free);
const char *repoid = NULL;
if (blip_instance == 0x6e0)
repoid = "bonobo-object:image-x-png";
else
repoid = "embeddable:image-jpeg";
ms_escher_blip_new (data, h->len - header,
repoid, state->wb);
write_file ("unknown", data, h->len - header, h->fbt - Blip_START);
......@@ -1561,7 +1561,7 @@ ms_escher_read_OPT (MSEscherState * state, MSEscherHeader * h)
case 766 : name = "bool fc3DKeyHarsh"; break;
/* 0 : Is fill lighting harsh?` */
case 767 : name = "bool fc3DFillHarsh"; break;
/* NULL : master shape */
case 769 : name = "MSOHSP pMaster"; break;
/* None : Type of connector */
......@@ -1899,9 +1899,9 @@ ms_escher_read_container (MSEscherState * state, MSEscherHeader * container,
* @q: Biff context.
* @wb: required workbook argument
* @sheet: optional sheet argument
*
*
* This function parses an escher stream, and stores relevant data in the
* workbook.
* workbook.
*/
void
ms_escher_parse (BiffQuery *q, ExcelWorkbook *wb, ExcelSheet *sheet)
......
......@@ -561,10 +561,10 @@ char *excel_builtin_formats[EXCEL_BUILTIN_FORMAT_LEN] = {
/* 0x31 */ "@"
};
/*
/*
* FIXME: This code falsely assumes that the builtin formats are
* fixed. The builtins get translated to local currency formats. E.g.
* Format data : 0x05 == '"kr"\ #,##0;"kr"\ \-#,##0'
* Format data : 0x05 == '"kr"\ #,##0;"kr"\ \-#,##0'
*/
StyleFormat *
biff_format_data_lookup (ExcelWorkbook *wb, guint16 idx)
......@@ -981,7 +981,7 @@ ms_excel_get_xf (ExcelSheet *sheet, int const xfidx)
* @fontname The font name
*
* Tries to find a gnome font which matches the Excel font.
* Returns the name of the substitute font if found. Otherwise returns NULL
* Returns the name of the substitute font if found. Otherwise returns NULL
*/
/* This is very ad hoc - throw it away when something better comes along */
static gchar *
......@@ -1038,7 +1038,7 @@ style_optimize (ExcelSheet *sheet, int col, int row)
sheet->style_optimize.end.row = row;
if (row < sheet->style_optimize.end.row)
sheet->style_optimize.start.row = row;
}
}
}
static MStyle *
......@@ -1097,13 +1097,13 @@ ms_excel_get_style_from_xf (ExcelSheet *sheet, guint16 xfidx)
mstyle_set_pattern (mstyle, xf->fill_pattern_idx);
/* Solid patterns seem to reverse the meaning */
/*
/*
* FIXME: Is this test correct? I fed Excel an XF record with
* fill_pattern_idx = 1, pat_backgnd_col = 1 (black),
* pat_foregnd_col = 0 (white). Excel displays it with black
* background. Gnumeric displays it with white background.
* Can the "xf->pat_foregnd_col != 0" test be removed?
* - Jon Hellan
* - Jon Hellan
*/
if (xf->fill_pattern_idx == 1 && xf->pat_foregnd_col != 0) {
pattern_index = xf->pat_backgnd_col;
......@@ -1551,7 +1551,7 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
xf->pat_backgnd_col = (data & 0x1f80) >> 7;
data = MS_OLE_GET_GUINT16 (q->data + 10);
xf->fill_pattern_idx =
xf->fill_pattern_idx =
excel_map_pattern_index_from_excel (data & 0x3f);
#ifndef NO_DEBUG_EXCEL
......@@ -2327,18 +2327,18 @@ print_font_mapping_debug_info (ExcelSheet *sheet, MStyle const *ms)
{
BiffXFData const *xf = NULL;
BiffFontData const *fd = NULL;
if ((xf = ms_excel_get_xf (sheet, 0)) != NULL &&
(fd = ms_excel_get_font (sheet, xf->font_idx))) {
printf ("Font: %s %g",
printf ("Font: %s %g",
fd->fontname, fd->height/20.0);
if (ms) {
const char *msfn
const char *msfn
= mstyle_get_font_name (ms);
printf (" mapped to %s %.6g",
printf (" mapped to %s %.6g",
msfn,
mstyle_get_font_size
mstyle_get_font_size
(ms));
}
printf ("\n");
......@@ -2361,11 +2361,11 @@ lookup_base_char_width_for_read (ExcelSheet *sheet)
/*
* I'm only guessing that 0 is the right index, but I've been
* right so far.
* right so far.
*/
def = !sheet->wb->XF_cell_records ||
(sheet->wb->XF_cell_records->len == 0);
if (def)
ms = NULL;
else
......@@ -2382,7 +2382,7 @@ lookup_base_char_width_for_read (ExcelSheet *sheet)
print_font_mapping_debug_info (sheet, ms);
}
#endif
res = lookup_font_base_char_width (sf,
res = lookup_font_base_char_width (sf,
(ms_excel_read_debug > 2));
style_font_unref (sf);
mstyle_unref (ms);
......@@ -2390,7 +2390,7 @@ lookup_base_char_width_for_read (ExcelSheet *sheet)
return res;
}
/**
* get_base_char_width:
* @sheet the Excel sheet
......@@ -2402,7 +2402,7 @@ lookup_base_char_width_for_read (ExcelSheet *sheet)
* The char width is based on the font in the "Normal" style.
* This style is actually common to all sheets in the
* workbook, but I find it more robust to treat it as a sheet
* attribute.
* attribute.
*
* FIXME: There is a function with this name both in ms-excel-read.c and
* ms-excel-write.c. The only difference is lookup_base_char_width_for_read
......@@ -2418,20 +2418,20 @@ get_base_char_width (ExcelSheet *sheet)
return sheet->base_char_width;
}
/**
* get_row_height_units:
* @height height in Excel units
*
* Converts row height from Excel units to points. Returns height in points.
*
* Excel specifies row height in 1/20 of a point.
*
*
* Excel specifies row height in 1/20 of a point.
*
* What we now print out is just 0.5% shorter than theoretical
* height. The height of what Excel prints out varies in mysterious
* ways. Sometimes it is close to theoretical, sometimes it is a few %
* shorter. I don't see any point in correcting for the 0.5% until we
* know the whole story.
* know the whole story.
*/
static double
get_row_height_units (guint16 height)
......@@ -2443,7 +2443,7 @@ get_row_height_units (guint16 height)
* get_units_net_of_margins:
* @units A dimension in points
* @cri A ColRowInfo for a row or column.
*
*
* Converts an external (with margins) row height/column width in
* points to an internal (without margins) height/width, as this is
* what the sheet_<foo>_set_{width|height}_units functions
......@@ -2465,10 +2465,10 @@ get_units_net_of_margins (double units, const ColRowInfo * cri)
* ms_excel_read_row:
* @q A BIFF query
* @sheet The Excel sheet
*
* Processes a BIFF row info (BIFF_ROW) record. See: S59DDB.HTM
*
* Processes a BIFF row info (BIFF_ROW) record. See: S59DDB.HTM
*/
static void
static void
ms_excel_read_row (BiffQuery *q, ExcelSheet *sheet)
{
guint16 const row = MS_OLE_GET_GUINT16(q->data);
......@@ -2484,7 +2484,7 @@ ms_excel_read_row (BiffQuery *q, ExcelSheet *sheet)
if ((height & 0x8000) == 0) {
double hu = get_row_height_units (height);
/* Subtract margins */
hu = get_units_net_of_margins
hu = get_units_net_of_margins
(hu, sheet_row_get_info (sheet->gnum_sheet, row));
sheet_row_set_height_units (sheet->gnum_sheet, row, hu, TRUE);
}
......@@ -2499,15 +2499,15 @@ ms_excel_read_row (BiffQuery *q, ExcelSheet *sheet)
#endif
}
}
/**
* ms_excel_read_colinfo:
* @q A BIFF query
* @sheet The Excel sheet
*
* Processes a BIFF column info (BIFF_COLINFO) record. See: S59D67.HTM
*
* Processes a BIFF column info (BIFF_COLINFO) record. See: S59D67.HTM
*/
static void
static void
ms_excel_read_colinfo (BiffQuery *q, ExcelSheet *sheet)
{
int lp;
......@@ -2543,20 +2543,20 @@ ms_excel_read_colinfo (BiffQuery *q, ExcelSheet *sheet)
printf ("FIXME: Hidden column unimplemented\n");
else
printf ("FIXME: 0 sized column ???\n");
/* FIXME : Is this still necessary ? */
col_width = 62;
} else
col_width = (width * char_width) / 256.;
/* Subtract margins */
col_width = get_units_net_of_margins
col_width = get_units_net_of_margins
(col_width, sheet_col_get_info (sheet->gnum_sheet, firstcol));
/* NOTE : seems like this is inclusive firstcol, inclusive lastcol */
if (lastcol >= SHEET_MAX_COLS)
lastcol = SHEET_MAX_COLS-1;
for (lp = firstcol; lp <= lastcol; ++lp)
sheet_col_set_width_units
sheet_col_set_width_units
(sheet->gnum_sheet, lp, col_width);
}
......@@ -2899,7 +2899,7 @@ ms_excel_read_selection (ExcelSheet *sheet, BiffQuery *q)
* ms_excel_read_default_row_height:
* @q A BIFF query
* @sheet The Excel sheet
*
*
* Processes a BIFF default row height (BIFF_DEFAULTROWHEIGHT) record.
* See: S59D72.HTM
*/
......@@ -2933,7 +2933,7 @@ ms_excel_read_default_row_height (BiffQuery *q, ExcelSheet *sheet)
* ms_excel_read_default_col_width:
* @q A BIFF query
* @sheet The Excel sheet
*
*
* Processes a BIFF default column width (BIFF_DEFCOLWIDTH) record.
* See: S59D73.HTM
*/
......@@ -3713,7 +3713,7 @@ ms_excel_read_workbook (Workbook *workbook, MsOle *file)
}
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 2) {
printf ("Format data : 0x%x == '%s'\n",
printf ("Format data : 0x%x == '%s'\n",
d->idx, d->name);
}
#endif
......
......@@ -35,7 +35,7 @@ typedef struct _BiffBoundsheetData
typedef struct {
guint16 col;
guint16 row;
guint16 row;
} BiffSharedFormulaKey;
typedef struct {
......
......@@ -15,9 +15,9 @@
/*
* TwoWayTable
*
* This is a data structure for a one to one mapping between a key and an
* index. You can access the key by index and the index by key. Indices are
* assigned to keys in the order they are entered.
* This is a data structure for a one to one mapping between a key and an
* index. You can access the key by index and the index by key. Indices are
* assigned to keys in the order they are entered.
*
* Example of use:
* Build a table of unique fonts in the workbook, assigning each an index.
......@@ -30,8 +30,8 @@
* two_way_table_replace: Replace the key for an index in the TwoWayTable
* two_way_table_key_to_idx: Find index given a key
* two_way_table_idx_to_key: Find key given the index
*
* Implementation:
*
* Implementation:
* A g_hash_table and a g_ptr_array. The value stored in the hash
* table is index + 1. This is because hash lookup returns NULL on
* failure. If 0 could be stored in the hash, we could not distinguish
......@@ -48,7 +48,7 @@
*/
TwoWayTable *
two_way_table_new (GHashFunc hash_func,
GCompareFunc key_compare_func,
GCompareFunc key_compare_func,
gint base)
{
TwoWayTable *table = g_new (TwoWayTable, 1);
......@@ -64,7 +64,7 @@ two_way_table_new (GHashFunc hash_func,
/**
* two_way_table_free
* @table Table
*
*
* Destroys the TwoWayTable.
*/
void
......@@ -85,10 +85,10 @@ two_way_table_free (TwoWayTable *table)
* Puts a key to the TwoWayTable if it is not already there. Returns
* the index of the key. apf is of type AfterPutFunc, and can be used
* for logging, freeing resources, etc. It is told if the key was
* entered or not.
* entered or not.
*/
gint
two_way_table_put (const TwoWayTable *table, gpointer key,
two_way_table_put (const TwoWayTable *table, gpointer key,
gboolean unique, AfterPutFunc apf, gpointer closure)
{
gint index = two_way_table_key_to_idx (table, key);
......@@ -99,7 +99,7 @@ two_way_table_put (const TwoWayTable *table, gpointer key,
index = table->idx_to_key->len + table->base;
if (!found)
g_hash_table_insert (table->key_to_idx, key,
g_hash_table_insert (table->key_to_idx, key,
GINT_TO_POINTER (index + 1));
g_ptr_array_add (table->idx_to_key, key);
}
......@@ -115,7 +115,7 @@ two_way_table_put (const TwoWayTable *table, gpointer key,
* @table Table
* @idx Index to be updated
* @key New key to be assigned to the index
*
*
* Replaces the key bound to an index with a new value. Returns the old key.
*/
gpointer
......@@ -126,7 +126,7 @@ two_way_table_replace (const TwoWayTable *table, gint idx, gpointer key)
g_hash_table_remove(table->key_to_idx, old_key);
g_hash_table_insert(table->key_to_idx, key, GINT_TO_POINTER (idx + 1));
g_ptr_array_index (table->idx_to_key, idx) = key;
return old_key;
}
......@@ -134,7 +134,7 @@ two_way_table_replace (const TwoWayTable *table, gint idx, gpointer key)
* two_way_table_key_to_idx
* @table Table
* @key Key
*
*
* Returns index of key, or -1 if key not found.
*/
gint
......@@ -148,15 +148,15 @@ two_way_table_key_to_idx (const TwoWayTable *table, gconstpointer key)
* two_way_table_idx_to_key
* @table Table
* @idx Index
*
*
* Returns key bound to index, or NULL if index is out of range.
*/
gpointer
two_way_table_idx_to_key (const TwoWayTable *table, gint idx)
{
g_return_val_if_fail (idx - table->base >= 0, NULL);
g_return_val_if_fail (idx - table->base < table->idx_to_key->len,
g_return_val_if_fail (idx - table->base < table->idx_to_key->len,
NULL);
return g_ptr_array_index (table->idx_to_key, idx - table->base);
......@@ -178,11 +178,11 @@ two_way_table_idx_to_key (const TwoWayTable *table, gint idx)
*
* Widths based on text samples come out lower, but can be used if
* scaled appropriately. Using the sample below, we reduce the
* difference in precision between Times and Helvetica to 0.13%.
* difference in precision between Times and Helvetica to 0.13%.
*/
/*
/*
* FIXME: If a column is marked italic, Excel exports a different width.
* Looks like it tracks bold/italic variations, but we know that it doesn't
* Looks like it tracks bold/italic variations, but we know that it doesn't
* track family/size. Weird.
*/
double
......
......@@ -20,21 +20,21 @@ struct _TwoWayTable {
gint base; /* Indices assigned consecutively from base */
};
typedef void (*AfterPutFunc) (gconstpointer key,
gboolean was_added,
gint index,
typedef void (*AfterPutFunc) (gconstpointer key,
gboolean was_added,
gint index,
gpointer closure);
TwoWayTable *
two_way_table_new (GHashFunc hash_func,
GCompareFunc key_compare_func,
GCompareFunc key_compare_func,
gint base);
void
two_way_table_free (TwoWayTable *table);
gint
two_way_table_put (const TwoWayTable *table, gpointer key,
two_way_table_put (const TwoWayTable *table, gpointer key,
gboolean unique, AfterPutFunc apf, gpointer closure);
gpointer
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ struct _ExcelCell {
Cell *gnum_cell;
};
struct _ExcelCol
struct _ExcelCol
{
ExcelSheet *sheet;