[gnumeric] Introspection fixes



commit 653ee1ae142eb06765360d78fed9cbcae4e51b85
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 24 15:42:46 2018 -0400

    Introspection fixes

 README-introspection |    3 ++
 src/colrow.c         |   95 ++++++++++++++++++++++++++++++-------------------
 src/colrow.h         |    2 +-
 src/commands.c       |   16 ++++----
 src/expr.c           |   26 +++++++-------
 src/mstyle.c         |   54 ++++++++++++++--------------
 src/ranges.c         |   51 ++++++++++++++++----------
 src/sheet.c          |   71 +++++++++++++++++++------------------
 src/value.c          |   14 ++++----
 9 files changed, 184 insertions(+), 148 deletions(-)
---
diff --git a/README-introspection b/README-introspection
index a7af503..49c411b 100644
--- a/README-introspection
+++ b/README-introspection
@@ -150,6 +150,9 @@ GnmRange: [Simple structure]
   init_cols(sheet,start,end)
   init_rows(sheet,start,end)
   init_cellpos(sheet,cellpos)
+  is_singleton()
+  is_full(sheet,horiz)
+  contained(other)
   as_string()
   start
   end
diff --git a/src/colrow.c b/src/colrow.c
index aa0bf5b..dca6f48 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -335,7 +335,7 @@ colrow_index_compare (ColRowIndex const * a, ColRowIndex const * b)
  *                              It will be something like : A-B, F-G
  *
  * @list: The list
- * @is_cols: Column index list or row index list?
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @is_single: If non-null this will be set to %TRUE if there's only a single col/row involved.
  */
 GString *
@@ -462,11 +462,11 @@ colrow_state_list_destroy (ColRowStateList *list)
 }
 
 /**
- * colrow_get_states:
+ * colrow_get_states: (skip)
  * @sheet: #Sheet
- * @is_cols: %TRUE if columns.
- * @first:
- * @last:
+ * @is_cols: %TRUE for columns, %FALSE for rows.
+ * @first: first column or row.
+ * @last: last column or row.
  *
  * Returns: (transfer full):
  **/
@@ -550,9 +550,9 @@ cb_clear_variable_width_content (GnmCellIter const *iter,
 }
 
 /**
- * colrow_get_sizes:
+ * colrow_get_sizes: (skip)
  * @sheet: #Sheet
- * @is_cols: %TRUE if columns.
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @src:
  * @new_size:
  *
@@ -590,9 +590,9 @@ colrow_get_sizes (Sheet *sheet, gboolean is_cols,
 }
 
 /**
- * colrow_set_sizes:
+ * colrow_set_sizes: (skip)
  * @sheet: #Sheet
- * @is_cols:
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @src:
  * @new_size:
  * @from:
@@ -704,14 +704,15 @@ colrow_set_sizes (Sheet *sheet, gboolean is_cols,
        return res;
 }
 
-/*
- * NOTE : this is a low level routine it does not redraw or
- *        reposition objects
+/**
+ * colrow_set_states: (skip)
+ * @sheet: #Sheet
+ * @is_cols: %TRUE for columns, %FALSE for rows.
+ * @first: first column or row
+ * @states: saved state to restore.
  *
- * NOTE : this does not delete states any longer since it may be used
- *        for several sheets.
+ * This is a low level routine it does not redraw or reposition objects
  */
-
 void
 colrow_set_states (Sheet *sheet, gboolean is_cols,
                   int first, ColRowStateList *states)
@@ -779,6 +780,14 @@ colrow_set_states (Sheet *sheet, gboolean is_cols,
        sheet_colrow_gutter (sheet, is_cols, max_outline);
 }
 
+/**
+ * colrow_restore_state_group: (skip)
+ * @sheet: #Sheet
+ * @is_cols: %TRUE for columns, %FALSE for rows.
+ * @selection:
+ * @state_groups:
+ *
+ **/
 void
 colrow_restore_state_group (Sheet *sheet, gboolean is_cols,
                            ColRowIndexList *selection,
@@ -820,15 +829,15 @@ colrow_restore_state_group (Sheet *sheet, gboolean is_cols,
  * rows_height_update:
  * @sheet:  The sheet,
  * @range:  The range whose rows should be resized.
- * @shrink: If set to FALSE, rows will never shrink!
+ * @shrink: If set to %FALSE, rows will never shrink!
  *
- * Use this function having changed the font size to auto
- * resize the row heights to make the text fit nicely.
+ * Use this function having changed the font size to auto-resize the row
+ * heights to make the text fit nicely.
  **/
 void
-rows_height_update (Sheet *sheet, GnmRange const * range, gboolean shrink)
+rows_height_update (Sheet *sheet, GnmRange const *range, gboolean shrink)
 {
-       /* FIXME : this needs to check font sizes and contents rather than
+       /* FIXME: this needs to check font sizes and contents rather than
         * just contents.  Empty cells will cause resize also */
        colrow_autofit (sheet, range, FALSE, FALSE,
                        FALSE, !shrink,
@@ -902,14 +911,16 @@ cb_autofit_row (GnmColRowIter const *iter, gpointer data_)
 
 /*
  * colrow_autofit:
- * @sheet: the sheet to change
+ * @sheet: the #Sheet to change
  * @range: the range to consider
  * @is_cols: %TRUE for columns, %FALSE for rows.
  * @ignore_strings: Don't consider cells with string values.
  * @min_current: Don't shrink below current size.
  * @min_default: Don't shrink below default size.
- * @indices: (nullable): indices appropriate for colrow_restore_state_group.
- * @sizes: (nullable): old sizes appropriate for colrow_restore_state_group.
+ * @indices: (out) (optional): indices appropriate for
+ *     colrow_restore_state_group.
+ * @sizes: (out) (optional): old sizes appropriate for
+ *     colrow_restore_state_group.
  *
  * This function autofits columns or rows in @range as specified by
  * @is_cols.  Only cells in @range are considered for the sizing
@@ -959,6 +970,11 @@ colrow_autofit (Sheet *sheet, const GnmRange *range, gboolean is_cols,
        gnm_app_recalc_finish ();
 }
 
+/**
+ * colrow_autofit_col:
+ * @sheet: the #Sheet to change
+ * @r: the range to consider
+ */
 void
 colrow_autofit_col (Sheet *sheet, GnmRange *r)
 {
@@ -971,6 +987,11 @@ colrow_autofit_col (Sheet *sheet, GnmRange *r)
                                     NULL);
 }
 
+/**
+ * colrow_autofit_row:
+ * @sheet: the #Sheet to change
+ * @r: the range to consider
+ */
 void
 colrow_autofit_row (Sheet *sheet, GnmRange *r)
 {
@@ -1046,9 +1067,9 @@ colrow_visibility (Sheet const *sheet, ColRowVisiblity * const dat,
 }
 
 /**
- * colrow_get_outline_toggle:
+ * colrow_get_outline_toggle: (skip)
  * @sheet: #Sheet
- * @is_cols:
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @visible:
  * @first:
  * @last:
@@ -1085,17 +1106,14 @@ cb_colrow_visibility (SheetView *sv, GnmRange const *r, gpointer closure)
 }
 
 /**
- * colrow_get_visiblity_toggle:
+ * colrow_get_visiblity_toggle: (skip)
  * @sv: The sheet view whose selection we are interested in.
- * @is_cols: A flag indicating whether this it is a column or a row.
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @visible: Should we unhide or hide the cols/rows.
  *
  * Searches the selection list and generates a list of index,count
  * pairs of row/col ranges that need to be hidden or unhiden.
  *
- * NOTE : leave sheet non-const until we have a const version of
- *        sv_selection_apply.
- *
  * Returns: (transfer full): the list.
  */
 ColRowVisList *
@@ -1112,8 +1130,11 @@ colrow_get_visiblity_toggle (SheetView *sv, gboolean is_cols,
        return closure.elements;
 }
 
-/*
+/**
  * colrow_set_visibility_list:
+ * @sheet: The #Sheet to change
+ * @is_cols: %TRUE for columns, %FALSE for rows.
+ * @visible: Should we unhide or hide the cols/rows.
  *
  * This is the high level command that is wrapped by undo and redo.
  * It should not be called by other commands.
@@ -1189,8 +1210,8 @@ colrow_find_outline_bound (Sheet const *sheet, gboolean is_cols,
 
 /**
  * colrow_set_visibility:
- * @sheet: the sheet
- * @is_cols: Are we dealing with rows or columns.
+ * @sheet: the #Sheet
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @visible: Make things visible or invisible.
  * @first: The index of the first row/col (inclusive)
  * @last: The index of the last row/col (inclusive)
@@ -1287,12 +1308,12 @@ colrow_set_visibility (Sheet *sheet, gboolean is_cols,
 }
 
 /**
- * colrow_get_global_outline:
+ * colrow_get_global_outline: (skip)
  * @sheet:
- * @is_cols:
+ * @is_cols: %TRUE for columns, %FALSE for rows.
  * @depth:
- * @show:
- * @hide:
+ * @show: (out):
+ * @hide: (out):
  *
  * Collect the set of visiblity changes required to change the visiblity of
  * all outlined columns such tach those > @depth are visible.
diff --git a/src/colrow.h b/src/colrow.h
index e6fa197..f8c9593 100644
--- a/src/colrow.h
+++ b/src/colrow.h
@@ -125,7 +125,7 @@ ColRowStateGroup  *colrow_get_sizes         (Sheet *sheet, gboolean is_cols,
                                                 ColRowIndexList *src, int new_size);
 void              colrow_restore_state_group   (Sheet *sheet, gboolean is_cols,
                                                 ColRowIndexList *selection,
-                                                ColRowStateGroup *saved_state);
+                                                ColRowStateGroup *state_groups);
 
 /* Support for Col/Row visibility */
 void             col_row_info_set_outline             (ColRowInfo *cri, int outline_level,
diff --git a/src/commands.c b/src/commands.c
index 2b2ffe4..d5788f9 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -100,7 +100,7 @@
  *
  * That way undo redo just become applications of the old or the new styles.
  *
- * Design thoughts :
+ * Design thoughts:
  * 1) redo : this should be renamed 'exec' and should be the place that the
  *    the actual command executes.  This avoid duplicating the code for
  *    application and re-application.
@@ -508,7 +508,7 @@ command_repeat (WorkbookControl *wbc)
 }
 
 /**
- * command_setup_combos :
+ * command_setup_combos:
  * @wbc:
  *
  * Initialize the combos to correspond to the current undo/redo state.
@@ -2228,7 +2228,7 @@ cmd_colrow_hide_repeat (GnmCommand const *cmd, WorkbookControl *wbc)
 MAKE_GNM_COMMAND (CmdColRowHide, cmd_colrow_hide, cmd_colrow_hide_repeat)
 
 /**
- * cmd_colrow_hide_correct_selection :
+ * cmd_colrow_hide_correct_selection:
  *
  * Try to ensure that the selection/cursor is set to a visible row/col
  *
@@ -2622,7 +2622,7 @@ typedef struct {
 } PasteContent;
 
 /**
- * cmd_paste_cut_update :
+ * cmd_paste_cut_update:
  *
  * Utility routine to update things when we are transfering between sheets and
  * workbooks.
@@ -5928,7 +5928,7 @@ cmd_define_name_finalize (GObject *cmd)
 }
 
 /**
- * cmd_define_name :
+ * cmd_define_name:
  * @wbc:
  * @name:
  * @pp:
@@ -6083,7 +6083,7 @@ cmd_remove_name_finalize (GObject *cmd)
 }
 
 /**
- * cmd_remove_name :
+ * cmd_remove_name:
  * @wbc:
  * @nexpr: name to remove.
  *
@@ -6162,7 +6162,7 @@ cmd_rescope_name_finalize (GObject *cmd)
 }
 
 /**
- * cmd_rescope_name :
+ * cmd_rescope_name:
  * @wbc:
  * @nexpr: name to rescope.
  *
@@ -6680,7 +6680,7 @@ cmd_freeze_panes_finalize (GObject *cmd)
 }
 
 /**
- * cmd_freeze_panes :
+ * cmd_freeze_panes:
  * @wbc: where to report errors
  * @sv: the view to freeze
  * @frozen:
diff --git a/src/expr.c b/src/expr.c
index 2998463..52ca362 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -68,7 +68,7 @@ static GOMemChunk *expression_pool_small, *expression_pool_big;
 /***************************************************************************/
 
 /**
- * gnm_expr_new_constant :
+ * gnm_expr_new_constant:
  * @v:
  *
  * Absorbs the value.
@@ -273,7 +273,7 @@ gnm_expr_is_array (GnmExpr const *expr)
 }
 
 /**
- * gnm_expr_new_array_corner :
+ * gnm_expr_new_array_corner:
  * @cols:
  * @rows:
  * @expr: optionally NULL.
@@ -686,7 +686,7 @@ gnm_expr_extract_ref (GnmRangeRef *res, GnmExpr const *expr,
                return failed;
        }
 
-       case GNM_EXPR_OP_CELLREF :
+       case GNM_EXPR_OP_CELLREF:
                res->a = expr->cellref.ref;
                res->b = expr->cellref.ref;
                return FALSE;
@@ -705,7 +705,7 @@ gnm_expr_extract_ref (GnmRangeRef *res, GnmExpr const *expr,
                        return TRUE;
                return gnm_expr_extract_ref (res, expr->name.name->texpr->expr,
                                             pos, flags);
-       default :
+       default:
                break;
        }
        return TRUE;
@@ -727,7 +727,7 @@ handle_empty (GnmValue *res, GnmExprEvalFlags flags)
 }
 
 /**
- * value_intersection :
+ * value_intersection:
  * @v: a VALUE_CELLRANGE or VALUE_ARRAY
  * @pos:
  *
@@ -1219,7 +1219,7 @@ gnm_expr_range_op (GnmExpr const *expr, GnmEvalPos const *ep,
 }
 
 /**
- * gnm_expr_eval :
+ * gnm_expr_eval:
  * @expr:
  * @pos:
  * @flags:
@@ -2303,7 +2303,7 @@ cb_contains_subtotal (GnmExpr const *expr, GnmExprWalk *data)
 }
 
 /**
- * gnm_expr_containts_subtotal :
+ * gnm_expr_containts_subtotal:
  * @expr:
  *
  * return TRUE if the expression calls the SUBTOTAL function
@@ -2371,7 +2371,7 @@ gnm_insert_unique_value (GSList *list, GnmValue *data)
 }
 
 /**
- * gnm_expr_is_rangeref :
+ * gnm_expr_is_rangeref:
  * @expr:
  *
  * Returns TRUE if the expression can generate a reference.
@@ -2407,7 +2407,7 @@ gnm_expr_is_rangeref (GnmExpr const *expr)
 
        case GNM_EXPR_OP_ARRAY_CORNER: /* I don't think this is possible */
        case GNM_EXPR_OP_ARRAY_ELEM:
-       default :
+       default:
                return FALSE;
        }
 }
@@ -2975,13 +2975,13 @@ gnm_expr_top_equal (GnmExprTop const *te1, GnmExprTop const *te2)
 }
 
 /*
- * gnm_expr_top_relocate :
+ * gnm_expr_top_relocate:
  * @texpr: #GnmExprTop to fixup
  * @rinfo: #GnmExprRelocateInfo details of relocation
  * @ignore_rel: Do not adjust relative refs (for internal use when
  *               relocating named expressions.   Most callers will want FALSE.
  *
- * GNM_EXPR_RELOCATE_INVALIDATE_SHEET :
+ * GNM_EXPR_RELOCATE_INVALIDATE_SHEET:
  *     Convert any references to  sheets marked being_invalidated into #REF!
  * GNM_EXPR_RELOCATE_MOVE_RANGE,
  *     Find any references to the specified area and adjust them by the
@@ -3287,7 +3287,7 @@ cb_first_funcall (GnmExpr const *expr, GnmExprWalk *data)
 }
 
 /**
- * gnm_expr_top_first_funcall :
+ * gnm_expr_top_first_funcall:
  * @texpr:
  *
  */
@@ -3334,7 +3334,7 @@ cb_get_boundingbox (GnmExpr const *expr, GnmExprWalk *data)
 }
 
 /**
- * gnm_expr_top_get_boundingbox :
+ * gnm_expr_top_get_boundingbox:
  *
  * Returns the range of cells in which the expression can be used without going
  * out of bounds.
diff --git a/src/mstyle.c b/src/mstyle.c
index 02c2dac..c8536c2 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -583,7 +583,7 @@ elem_clear_contents (GnmStyle *style, GnmStyleElement elem)
 }
 
 /**
- * gnm_style_find_conflicts :
+ * gnm_style_find_conflicts:
  * @accum: accumulator #GnmStyle
  * @overlay: #GnmStyle
  * @conflicts: flags
@@ -788,7 +788,7 @@ gnm_style_dup (GnmStyle const *src)
 }
 
 /**
- * gnm_style_new_merged :
+ * gnm_style_new_merged:
  * @base: #GnmStyle
  * @overlay: #GnmStyle
  *
@@ -1004,7 +1004,7 @@ gnm_style_linked_sheet_changed (GnmStyle *style)
 }
 
 /**
- * gnm_style_link_sheet :
+ * gnm_style_link_sheet:
  * @style:
  * @sheet:
  *
@@ -1255,7 +1255,7 @@ gnm_style_cmp (GnmStyle const *a, GnmStyle const *b)
 
 
 /**
- * gnm_style_equal_header :
+ * gnm_style_equal_header:
  * @a: #GnmStyle
  * @b: #GnmStyle
  * @top: is this a header vertically or horizontally
@@ -1289,7 +1289,7 @@ gnm_style_is_element_set (GnmStyle const *style, GnmStyleElement elem)
 }
 
 /**
- * gnm_style_is_complete :
+ * gnm_style_is_complete:
  * @style: #GnmStyle
  *
  * Returns TRUE if all elements are set.
@@ -1315,7 +1315,7 @@ gnm_style_unset_element (GnmStyle *style, GnmStyleElement elem)
 }
 
 /**
- * gnm_style_merge :
+ * gnm_style_merge:
  * @base: #GnmStyle
  * @overlay: #GnmStyle
  *
@@ -1377,7 +1377,7 @@ gnm_style_set_font_color (GnmStyle *style, GnmColor *col)
 }
 
 /**
- * gnm_style_set_back_color :
+ * gnm_style_set_back_color:
  * @style: #GnmStyle
  * @col: #GnmColor
  *
@@ -2242,7 +2242,7 @@ add_attr (PangoAttrList *attrs, PangoAttribute *attr)
 }
 
 /**
- * gnm_style_get_pango_attrs :
+ * gnm_style_get_pango_attrs:
  * @style: #GnmStyle
  **/
 PangoAttrList *
@@ -2285,13 +2285,13 @@ gnm_style_get_pango_attrs (GnmStyle const *style,
 
        /* Handle script. */
        switch (gnm_style_get_font_script (style)) {
-       default :
-       case GO_FONT_SCRIPT_STANDARD :
+       default:
+       case GO_FONT_SCRIPT_STANDARD:
                break;
-       case GO_FONT_SCRIPT_SUB :
+       case GO_FONT_SCRIPT_SUB:
                add_attr (l, go_pango_attr_subscript_new (TRUE));
                break;
-       case GO_FONT_SCRIPT_SUPER :
+       case GO_FONT_SCRIPT_SUPER:
                add_attr (l, go_pango_attr_superscript_new (TRUE));
                break;
        }
@@ -2373,31 +2373,31 @@ void
 gnm_style_set_from_pango_attribute (GnmStyle *style, PangoAttribute const *attr)
 {
        switch (attr->klass->type) {
-       case PANGO_ATTR_FAMILY :
+       case PANGO_ATTR_FAMILY:
                gnm_style_set_font_name (style, ((PangoAttrString *)attr)->value);
                break;
-       case PANGO_ATTR_SIZE :
+       case PANGO_ATTR_SIZE:
                gnm_style_set_font_size (style,
                                         ((PangoAttrInt *)attr)->value / (double)PANGO_SCALE);
                break;
-       case PANGO_ATTR_STYLE :
+       case PANGO_ATTR_STYLE:
                gnm_style_set_font_italic (style,
                        ((PangoAttrInt *)attr)->value == PANGO_STYLE_ITALIC);
                break;
-       case PANGO_ATTR_WEIGHT :
+       case PANGO_ATTR_WEIGHT:
                gnm_style_set_font_bold (style,
                        ((PangoAttrInt *)attr)->value >= PANGO_WEIGHT_BOLD);
                break;
-       case PANGO_ATTR_FOREGROUND :
+       case PANGO_ATTR_FOREGROUND:
                gnm_style_set_font_color (style, gnm_color_new_pango (
                        &((PangoAttrColor *)attr)->color));
                break;
-       case PANGO_ATTR_UNDERLINE :
+       case PANGO_ATTR_UNDERLINE:
                gnm_style_set_font_uline
                        (style, gnm_translate_underline_from_pango
                         (((PangoAttrInt *)attr)->value));
                break;
-       case PANGO_ATTR_STRIKETHROUGH :
+       case PANGO_ATTR_STRIKETHROUGH:
                gnm_style_set_font_strike (style,
                        ((PangoAttrInt *)attr)->value != 0);
                break;
@@ -2487,24 +2487,24 @@ gnm_style_dump (GnmStyle const *style)
                g_printerr (style->font_detail.italic ? "\titalic\n" : "\tnot italic\n");
        if (elem_is_set (style, MSTYLE_FONT_UNDERLINE))
                switch (style->font_detail.underline) {
-               default :
-               case UNDERLINE_NONE :
+               default:
+               case UNDERLINE_NONE:
                        g_printerr ("\tno underline\n"); break;
-               case UNDERLINE_SINGLE :
+               case UNDERLINE_SINGLE:
                        g_printerr ("\tsingle underline\n"); break;
-               case UNDERLINE_DOUBLE :
+               case UNDERLINE_DOUBLE:
                        g_printerr ("\tdouble underline\n"); break;
                }
        if (elem_is_set (style, MSTYLE_FONT_STRIKETHROUGH))
                g_printerr (style->font_detail.strikethrough ? "\tstrikethrough\n" : "\tno strikethrough\n");
        if (elem_is_set (style, MSTYLE_FONT_SCRIPT))
                switch (style->font_detail.script) {
-               case GO_FONT_SCRIPT_SUB :
+               case GO_FONT_SCRIPT_SUB:
                        g_printerr ("\tsubscript\n"); break;
-               default :
-               case GO_FONT_SCRIPT_STANDARD :
+               default:
+               case GO_FONT_SCRIPT_STANDARD:
                        g_printerr ("\tno super or sub\n"); break;
-               case GO_FONT_SCRIPT_SUPER :
+               case GO_FONT_SCRIPT_SUPER:
                        g_printerr ("\tsuperscript\n"); break;
                }
        if (elem_is_set (style, MSTYLE_FONT_SIZE))
diff --git a/src/ranges.c b/src/ranges.c
index 926f4b1..80da983 100644
--- a/src/ranges.c
+++ b/src/ranges.c
@@ -221,14 +221,15 @@ range_init (GnmRange *r, int start_col, int start_row,
 }
 
 /**
- * range_parse :
+ * range_parse:
  * @r: #GnmRange
- * @text:
+ * @text: text to parse
+ * @ss: #GnmSheetSize describing the size of the sheet in which @r lives.
  *
  * Parse a simple range (no abs/rel refs, no sheet refs)
- * Store the result in @res.
+ * Store the result in @r.
  *
- * Returns TRUE on success.
+ * Returns: %TRUE on success.
  **/
 gboolean
 range_parse (GnmRange *r, char const *text, GnmSheetSize const *ss)
@@ -251,7 +252,7 @@ range_parse (GnmRange *r, char const *text, GnmSheetSize const *ss)
 
 /**
  * range_list_destroy:
- * @ranges: (element-type GnmValue) (transfer full):  a list of value ranges
+ * @ranges: (element-type GnmValue) (transfer full): a list of value ranges
  * to destroy.
  *
  * Destroys a list of ranges returned from parse_cell_range_list
@@ -537,8 +538,8 @@ gnm_range_dup (GnmRange const *a)
 
 /**
  * range_fragment:
- * @a: GnmRange a
- * @b: GnmRange b
+ * @a: #GnmRange a
+ * @b: #GnmRange b
  *
  * Fragments the ranges into totaly non-overlapping regions,
  *
@@ -576,13 +577,15 @@ range_fragment (GnmRange const *a, GnmRange const *b)
  *
  * NB. totally commutative
  *
- * Return value: True if the ranges intersect, false otherwise
+ * Return value: %TRUE if the ranges intersect, %FALSE otherwise
  **/
 gboolean
 range_intersection (GnmRange *r, GnmRange const *a, GnmRange const *b)
 {
-       if (!range_overlap (a, b))
+       if (!range_overlap (a, b)) {
+               *r = *a; // Something
                return FALSE;
+       }
 
        r->start.col = MAX (a->start.col, b->start.col);
        r->start.row = MAX (a->start.row, b->start.row);
@@ -657,6 +660,12 @@ range_union (GnmRange const *a, GnmRange const *b)
        return ans;
 }
 
+/**
+ * range_is_singleton:
+ * @r: the range.
+ *
+ * Returns: %TRUE if @r is a single-cell range.
+ */
 gboolean
 range_is_singleton (GnmRange const *r)
 {
@@ -664,15 +673,15 @@ range_is_singleton (GnmRange const *r)
 }
 
 /**
- * range_is_full :
+ * range_is_full:
  * @r: the range.
  * @sheet: the sheet in which @r lives
- * @horiz: TRUE to check for a horizontal full ref (_cols_ [0..MAX))
+ * @horiz: %TRUE to check for a horizontal full ref (_cols_ [0..MAX))
  *
  * This determines whether @r completely spans a sheet
  * in the dimension specified by @horiz.
  *
- * Return value: TRUE if it is infinite else FALSE
+ * Return value: %TRUE if it is infinite else %FALSE.
  **/
 gboolean
 range_is_full (GnmRange const *r, Sheet const *sheet, gboolean horiz)
@@ -686,7 +695,7 @@ range_is_full (GnmRange const *r, Sheet const *sheet, gboolean horiz)
 }
 
 /**
- * range_clip_to_finite :
+ * range_clip_to_finite:
  * @range:
  * @sheet: the sheet in which @range lives
  *
@@ -764,7 +773,7 @@ range_translate (GnmRange *range, Sheet const *sheet, int col_offset, int row_of
 }
 
 /**
- * range_ensure_sanity :
+ * range_ensure_sanity:
  * @range: the range to check
  * @sheet: the sheet in which @range lives
  *
@@ -782,7 +791,7 @@ range_ensure_sanity (GnmRange *range, Sheet const *sheet)
 }
 
 /**
- * range_is_sane :
+ * range_is_sane:
  * @range: the range to check
  *
  * Generate warnings if the range is out of bounds or inverted.
@@ -807,7 +816,7 @@ range_is_sane (GnmRange const *range)
  * @sheet: the sheet in which @range lives
  * @origin: The box to transpose inside
  *
- *   Effectively mirrors the ranges in 'boundary' around a
+ * Effectively mirrors the ranges in 'boundary' around a
  * leading diagonal projected from offset.
  *
  * Return value: whether we clipped the range.
@@ -926,11 +935,13 @@ gnm_sheet_range_dup (GnmSheetRange const *sr)
 }
 
 /**
- * gnm_sheet_range_from_value :
- * @r:
- * @v:
+ * gnm_sheet_range_from_value:
+ * @r: #GnmSheetRange to change
+ * @v: #GnmValue containing a cell range.
+ *
+ * Convert @v into a GnmSheetRange.
  *
- * Convert @v into a GnmSheetRange and return in @r
+ * Returns: %TRUE
  **/
 gboolean
 gnm_sheet_range_from_value (GnmSheetRange *r, GnmValue const *v)
diff --git a/src/sheet.c b/src/sheet.c
index bba59a2..53135c5 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -364,7 +364,8 @@ sheet_scale_changed (Sheet *sheet, gboolean cols_rescaled, gboolean rows_rescale
 
                colrow_compute_pixels_from_pts (&sheet->cols.default_style,
                                                sheet, TRUE, closure.scale);
-               col_row_collection_foreach (&sheet->cols, 0, gnm_sheet_get_last_col (sheet),
+               col_row_collection_foreach (&sheet->cols,
+                                           0, gnm_sheet_get_last_col (sheet),
                        (ColRowHandler)&cb_colrow_compute_pixels_from_pts, &closure);
        }
        if (rows_rescaled) {
@@ -456,52 +457,52 @@ gnm_sheet_set_property (GObject *object, guint property_id,
                sheet->outline_symbols_right = !!g_value_get_boolean (value);
                break;
 
-       case PROP_PROTECTED :
+       case PROP_PROTECTED:
                sheet->is_protected = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_OBJECTS :
+       case PROP_PROTECTED_ALLOW_EDIT_OBJECTS:
                sheet->protected_allow.edit_objects = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_SCENARIOS :
+       case PROP_PROTECTED_ALLOW_EDIT_SCENARIOS:
                sheet->protected_allow.edit_scenarios = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_CELL_FORMATTING :
+       case PROP_PROTECTED_ALLOW_CELL_FORMATTING:
                sheet->protected_allow.cell_formatting = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_COLUMN_FORMATTING :
+       case PROP_PROTECTED_ALLOW_COLUMN_FORMATTING:
                sheet->protected_allow.column_formatting = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_ROW_FORMATTING :
+       case PROP_PROTECTED_ALLOW_ROW_FORMATTING:
                sheet->protected_allow.row_formatting = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_COLUMNS :
+       case PROP_PROTECTED_ALLOW_INSERT_COLUMNS:
                sheet->protected_allow.insert_columns = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_ROWS :
+       case PROP_PROTECTED_ALLOW_INSERT_ROWS:
                sheet->protected_allow.insert_rows = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_HYPERLINKS :
+       case PROP_PROTECTED_ALLOW_INSERT_HYPERLINKS:
                sheet->protected_allow.insert_hyperlinks = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_DELETE_COLUMNS :
+       case PROP_PROTECTED_ALLOW_DELETE_COLUMNS:
                sheet->protected_allow.delete_columns = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_DELETE_ROWS :
+       case PROP_PROTECTED_ALLOW_DELETE_ROWS:
                sheet->protected_allow.delete_rows = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_SELECT_LOCKED_CELLS :
+       case PROP_PROTECTED_ALLOW_SELECT_LOCKED_CELLS:
                sheet->protected_allow.select_locked_cells = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_SORT_RANGES :
+       case PROP_PROTECTED_ALLOW_SORT_RANGES:
                sheet->protected_allow.sort_ranges = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_AUTO_FILTERS :
+       case PROP_PROTECTED_ALLOW_EDIT_AUTO_FILTERS:
                sheet->protected_allow.edit_auto_filters = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_PIVOTTABLE :
+       case PROP_PROTECTED_ALLOW_EDIT_PIVOTTABLE:
                sheet->protected_allow.edit_pivottable = !!g_value_get_boolean (value);
                break;
-       case PROP_PROTECTED_ALLOW_SELECT_UNLOCKED_CELLS :
+       case PROP_PROTECTED_ALLOW_SELECT_UNLOCKED_CELLS:
                sheet->protected_allow.select_unlocked_cells = !!g_value_get_boolean (value);
                break;
 
@@ -591,52 +592,52 @@ gnm_sheet_get_property (GObject *object, guint property_id,
                g_value_set_boolean (value, sheet->outline_symbols_right);
                break;
 
-       case PROP_PROTECTED :
+       case PROP_PROTECTED:
                g_value_set_boolean (value, sheet->is_protected);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_OBJECTS :
+       case PROP_PROTECTED_ALLOW_EDIT_OBJECTS:
                g_value_set_boolean (value, sheet->protected_allow.edit_objects);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_SCENARIOS :
+       case PROP_PROTECTED_ALLOW_EDIT_SCENARIOS:
                g_value_set_boolean (value, sheet->protected_allow.edit_scenarios);
                break;
-       case PROP_PROTECTED_ALLOW_CELL_FORMATTING :
+       case PROP_PROTECTED_ALLOW_CELL_FORMATTING:
                g_value_set_boolean (value, sheet->protected_allow.cell_formatting);
                break;
-       case PROP_PROTECTED_ALLOW_COLUMN_FORMATTING :
+       case PROP_PROTECTED_ALLOW_COLUMN_FORMATTING:
                g_value_set_boolean (value, sheet->protected_allow.column_formatting);
                break;
-       case PROP_PROTECTED_ALLOW_ROW_FORMATTING :
+       case PROP_PROTECTED_ALLOW_ROW_FORMATTING:
                g_value_set_boolean (value, sheet->protected_allow.row_formatting);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_COLUMNS :
+       case PROP_PROTECTED_ALLOW_INSERT_COLUMNS:
                g_value_set_boolean (value, sheet->protected_allow.insert_columns);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_ROWS :
+       case PROP_PROTECTED_ALLOW_INSERT_ROWS:
                g_value_set_boolean (value, sheet->protected_allow.insert_rows);
                break;
-       case PROP_PROTECTED_ALLOW_INSERT_HYPERLINKS :
+       case PROP_PROTECTED_ALLOW_INSERT_HYPERLINKS:
                g_value_set_boolean (value, sheet->protected_allow.insert_hyperlinks);
                break;
-       case PROP_PROTECTED_ALLOW_DELETE_COLUMNS :
+       case PROP_PROTECTED_ALLOW_DELETE_COLUMNS:
                g_value_set_boolean (value, sheet->protected_allow.delete_columns);
                break;
-       case PROP_PROTECTED_ALLOW_DELETE_ROWS :
+       case PROP_PROTECTED_ALLOW_DELETE_ROWS:
                g_value_set_boolean (value, sheet->protected_allow.delete_rows);
                break;
-       case PROP_PROTECTED_ALLOW_SELECT_LOCKED_CELLS :
+       case PROP_PROTECTED_ALLOW_SELECT_LOCKED_CELLS:
                g_value_set_boolean (value, sheet->protected_allow.select_locked_cells);
                break;
-       case PROP_PROTECTED_ALLOW_SORT_RANGES :
+       case PROP_PROTECTED_ALLOW_SORT_RANGES:
                g_value_set_boolean (value, sheet->protected_allow.sort_ranges);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_AUTO_FILTERS :
+       case PROP_PROTECTED_ALLOW_EDIT_AUTO_FILTERS:
                g_value_set_boolean (value, sheet->protected_allow.edit_auto_filters);
                break;
-       case PROP_PROTECTED_ALLOW_EDIT_PIVOTTABLE :
+       case PROP_PROTECTED_ALLOW_EDIT_PIVOTTABLE:
                g_value_set_boolean (value, sheet->protected_allow.edit_pivottable);
                break;
-       case PROP_PROTECTED_ALLOW_SELECT_UNLOCKED_CELLS :
+       case PROP_PROTECTED_ALLOW_SELECT_UNLOCKED_CELLS:
                g_value_set_boolean (value, sheet->protected_allow.select_unlocked_cells);
                break;
 
@@ -3974,7 +3975,7 @@ sheet_cells (Sheet *sheet, const GnmRange *r)
  *
  * Note: this function does not honour the CELL_ITER_IGNORE_SUBTOTAL flag.
  *
- * Returns: (transfer none): the value returned by the callback, which can be :
+ * Returns: (transfer none): the value returned by the callback, which can be:
  *    non-NULL on error, or VALUE_TERMINATE if some invoked routine requested
  *    to stop (by returning non-NULL).
  *
@@ -4274,7 +4275,7 @@ sheet_cell_add_to_hash (Sheet *sheet, GnmCell *cell)
        g_return_if_fail (cell->pos.row < gnm_sheet_get_max_rows (sheet));
 
        cell->base.flags |= GNM_CELL_IN_SHEET_LIST;
-       /* NOTE :
+       /* NOTE:
         *   fetching the col/row here serve 3 functions
         *   1) obsolete: we used to store the pointer in the cell
         *   2) Expanding col/row.max_used
diff --git a/src/value.c b/src/value.c
index 2e86336..b2c6e2e 100644
--- a/src/value.c
+++ b/src/value.c
@@ -717,7 +717,7 @@ value_cmp (void const *ptr_a, void const *ptr_b)
        case IS_EQUAL :   return  0;
        case IS_LESS :    return -1;
        case IS_GREATER : return  1;
-       default :
+       default:
                break;
        }
        return a->v_any.type - b->v_any.type;
@@ -1270,30 +1270,30 @@ value_diff (GnmValue const *a, GnmValue const *b)
        if (ta == VALUE_STRING) {
                switch (tb) {
                /* Strings are > (empty, or number) */
-               case VALUE_EMPTY :
+               case VALUE_EMPTY:
                        if (*a->v_str.val->str == '\0')
                                return 0.;
                        return DBL_MAX;
 
                /* If both are strings compare as string */
-               case VALUE_STRING :
+               case VALUE_STRING:
                        if (go_string_equal (a->v_str.val, b->v_str.val))
                                return 0.;
 
                case VALUE_FLOAT: case VALUE_BOOLEAN:
-               default :
+               default:
                        return DBL_MAX;
                }
 
        } else if (tb == VALUE_STRING) {
                switch (ta) {
                /* (empty, or number) < String */
-               case VALUE_EMPTY :
+               case VALUE_EMPTY:
                        if (*b->v_str.val->str == '\0')
                                return 0.;
 
-               case VALUE_FLOAT : case VALUE_BOOLEAN :
-               default :
+               case VALUE_FLOAT : case VALUE_BOOLEAN:
+               default:
                        return DBL_MAX;
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]