AUDIT: r17837 - gnucash/trunk/src/register/ledger-core - Register: Add additional debugging output to several ledger modules.

Charles Day cedayiv at cvs.gnucash.org
Tue Jan 20 18:15:30 EST 2009


Author: cedayiv
Date: 2009-01-20 18:15:30 -0500 (Tue, 20 Jan 2009)
New Revision: 17837
Trac: http://svn.gnucash.org/trac/changeset/17837

Modified:
   gnucash/trunk/src/register/ledger-core/split-register-control.c
   gnucash/trunk/src/register/ledger-core/split-register-load.c
   gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Register: Add additional debugging output to several ledger modules.
BP


Modified: gnucash/trunk/src/register/ledger-core/split-register-control.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-control.c	2009-01-18 23:43:02 UTC (rev 17836)
+++ gnucash/trunk/src/register/ledger-core/split-register-control.c	2009-01-20 23:15:30 UTC (rev 17837)
@@ -838,6 +838,7 @@
             blank_split = xaccTransGetSplit(trans, 0);
             info->blank_split_guid = *xaccSplitGetGUID(blank_split);
         }
+        DEBUG("blank_split=%p", blank_split);
 
         info->blank_split_edited = TRUE;
 
@@ -1463,9 +1464,8 @@
   g_return_val_if_fail(p_new_virt_loc, TRUE);
 
   ENTER("reg=%p, p_new_virt_loc=%p (%d,%d), dir=%d",
-         reg, p_new_virt_loc, dir,
-         (*p_new_virt_loc).vcell_loc.virt_row,
-         (*p_new_virt_loc).vcell_loc.virt_col);
+         reg, p_new_virt_loc, (*p_new_virt_loc).vcell_loc.virt_row,
+         (*p_new_virt_loc).vcell_loc.virt_col, dir);
 
   if (!reg)
   {

Modified: gnucash/trunk/src/register/ledger-core/split-register-load.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-load.c	2009-01-18 23:43:02 UTC (rev 17836)
+++ gnucash/trunk/src/register/ledger-core/split-register-load.c	2009-01-20 23:15:30 UTC (rev 17837)
@@ -40,8 +40,9 @@
 
 
 /* This static indicates the debugging module that this .o belongs to. */
-/* static short module = MOD_LEDGER; */
+static QofLogModule log_module = GNC_MOD_LEDGER;
 
+
 static void gnc_split_register_load_xfer_cells (SplitRegister *reg,
 						Account *base_account);
 
@@ -205,6 +206,8 @@
   int new_split_row = -1;
   time_t present;
 
+  ENTER("reg=%p, slist=%p, default_account=%p", reg, slist, default_account);
+
   blank_split = xaccSplitLookup (&info->blank_split_guid,
                                  gnc_get_current_book ());
 
@@ -278,6 +281,7 @@
 
     info->blank_split_guid = *xaccSplitGetGUID (blank_split);
     info->blank_split_edited = FALSE;
+    DEBUG("blank_split=%p", blank_split);
 
     gnc_resume_gui_refresh ();
   }
@@ -594,6 +598,8 @@
 
   if (we_own_slist)
     g_list_free(slist);
+
+  LEAVE(" ");
 }
 
 /* ===================================================================== */

Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c	2009-01-18 23:43:02 UTC (rev 17836)
+++ gnucash/trunk/src/register/ledger-core/split-register.c	2009-01-20 23:15:30 UTC (rev 17837)
@@ -387,6 +387,8 @@
   gboolean changed;
   Split *split;
 
+  ENTER("reg=%p", reg);
+
   blank_split = xaccSplitLookup(&info->blank_split_guid,
                                 gnc_get_current_book ());
   split = gnc_split_register_get_current_split (reg);
@@ -395,24 +397,36 @@
 
   /* This shouldn't happen, but be paranoid. */
   if (trans == NULL)
+  {
+    LEAVE("no transaction");
     return NULL;
+  }
 
   cursor_class = gnc_split_register_get_current_cursor_class (reg);
 
   /* Can't do anything with this. */
   if (cursor_class == CURSOR_CLASS_NONE)
+  {
+    LEAVE("no cursor class");
     return NULL;
+  }
 
   /* This shouldn't happen, but be paranoid. */
   if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+  {
+    LEAVE("no split with transaction class");
     return NULL;
+  }
 
   changed = gnc_table_current_cursor_changed (reg->table, FALSE);
 
   /* See if we were asked to duplicate an unchanged blank split.
    * There's no point in doing that! */
   if (!changed && ((split == NULL) || (split == blank_split)))
+  {
+    LEAVE("skip unchanged blank split");
     return NULL;
+  }
 
   gnc_suspend_gui_refresh ();
 
@@ -444,6 +458,7 @@
     if (response != GTK_RESPONSE_ACCEPT)
     {
       gnc_resume_gui_refresh ();
+      LEAVE("save cancelled");
       return NULL;
     }
 
@@ -505,6 +520,7 @@
                                &date, in_num, &out_num))
     {
       gnc_resume_gui_refresh ();
+      LEAVE("dup cancelled");
       return NULL;
     }
 
@@ -515,6 +531,7 @@
     if (split_index < 0)
     {
       gnc_resume_gui_refresh ();
+      LEAVE("no split");
       return NULL;
     }
 
@@ -551,6 +568,7 @@
   /* Refresh the GUI. */
   gnc_resume_gui_refresh ();
 
+  LEAVE(" ");
   return return_split;
 }
 
@@ -705,8 +723,13 @@
   Split *trans_split;
   Split *split;
 
+  ENTER("reg=%p", reg);
+
   if (copied_class == CURSOR_CLASS_NONE)
+  {
+    LEAVE("no copied class");
     return;
+  }
 
   blank_split = xaccSplitLookup (&info->blank_split_guid,
                                  gnc_get_current_book ());
@@ -717,17 +740,26 @@
 
   /* This shouldn't happen, but be paranoid. */
   if (trans == NULL)
+  {
+    LEAVE("no transaction");
     return;
+  }
 
   cursor_class = gnc_split_register_get_current_cursor_class (reg);
 
   /* Can't do anything with this. */
   if (cursor_class == CURSOR_CLASS_NONE)
+  {
+    LEAVE("no cursor class");
     return;
+  }
 
   /* This shouldn't happen, but be paranoid. */
   if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
+  {
+    LEAVE("null split with transaction class");
     return;
+  }
 
   if (cursor_class == CURSOR_CLASS_SPLIT)
   {
@@ -736,7 +768,10 @@
     gboolean result;
 
     if (copied_class == CURSOR_CLASS_TRANS)
+    {
+      LEAVE("can't copy trans to split");
       return;
+    }
 
     if (split != NULL)
       result = gnc_verify_dialog (gnc_split_register_get_parent (reg),
@@ -745,7 +780,10 @@
       result = TRUE;
 
     if (!result)
+    {
+      LEAVE("user cancelled");
       return;
+    }
 
     gnc_suspend_gui_refresh ();
 
@@ -772,7 +810,10 @@
     int num_splits;
 
     if (copied_class == CURSOR_CLASS_SPLIT)
+    {
+      LEAVE("can't copy split to transaction");
       return;
+    }
 
     if (split != blank_split)
       result = gnc_verify_dialog(gnc_split_register_get_parent(reg),
@@ -781,7 +822,10 @@
       result = TRUE;
 
     if (!result)
+    {
+      LEAVE("user cancelled");
       return;
+    }
 
     gnc_suspend_gui_refresh ();
 
@@ -822,6 +866,7 @@
 
   /* Refresh the GUI. */
   gnc_resume_gui_refresh ();
+  LEAVE(" ");
 }
 
 void
@@ -885,7 +930,12 @@
   Split *split;
   gboolean was_open;
 
-  if (!reg) return;
+  ENTER("reg=%p", reg);
+  if (!reg)
+  {
+    LEAVE("no register");
+    return;
+  }
 
   blank_split = xaccSplitLookup (&info->blank_split_guid,
                                  gnc_get_current_book ());
@@ -895,7 +945,10 @@
   /* get the current split based on cursor position */
   split = gnc_split_register_get_current_split (reg);
   if (split == NULL)
+  {
+    LEAVE("no split");
     return;
+  }
 
   gnc_suspend_gui_refresh ();
   trans = xaccSplitGetParent(split);
@@ -904,6 +957,7 @@
    * allowed to delete the blank split as a method for discarding
    * any edits they may have made to it. */
   if (split == blank_split) {
+      DEBUG("deleting blank split");
       info->blank_split_guid = *guid_null();
   } else {
       info->trans_expanded = FALSE;      
@@ -911,6 +965,7 @@
   
   /* Check pending transaction */
   if (trans == pending_trans) {
+      DEBUG("clearing pending trans");
       info->pending_trans_guid = *guid_null();
       pending_trans = NULL;
   }
@@ -918,8 +973,12 @@
   was_open = xaccTransIsOpen(trans);
   xaccTransDestroy(trans);
   if (was_open)
+  {
+      DEBUG("committing");
       xaccTransCommitEdit(trans);
+  }
   gnc_resume_gui_refresh ();
+  LEAVE(" ");
 }
 
 void
@@ -1327,8 +1386,14 @@
    Split *split;
    gboolean blank_edited = FALSE;
 
-   if (!reg) return FALSE;
+   ENTER("reg=%p, do_commit=%s", reg, do_commit ? "TRUE" : "FALSE");
 
+   if (!reg)
+   {
+     LEAVE("no register");
+     return FALSE;
+   }
+
    blank_split = xaccSplitLookup (&info->blank_split_guid,
                                   gnc_get_current_book ());
 
@@ -1341,7 +1406,10 @@
    split = gnc_split_register_get_current_split (reg);
    trans = gnc_split_register_get_current_trans (reg);
    if (trans == NULL)
+   {
+     LEAVE("no transaction");
      return FALSE;
+   }
 
    /* use the changed flag to avoid heavy-weight updates
     * of the split & transaction fields. This will help
@@ -1349,10 +1417,16 @@
    if (!gnc_table_current_cursor_changed (reg->table, FALSE))
    {
      if (!do_commit)
+     {
+       LEAVE("commit unnecessary");
        return FALSE;
+     }
 
      if (!xaccTransIsOpen(trans))
-         return FALSE;
+     {
+       LEAVE("transaction not open");
+       return FALSE;
+     }
 
      gnc_suspend_gui_refresh ();
 
@@ -1376,17 +1450,23 @@
 
      gnc_resume_gui_refresh ();
 
+     LEAVE("no changes, but committed");
      return TRUE;
    }
 
    DEBUG ("save split is %p \n", split);
+   DEBUG("blank_split=%p, blank_trans=%p, pending_trans=%p, trans=%p",
+         blank_split, blank_trans, pending_trans, trans);
 
    /* Act on any changes to the current cell before the save. */
    gnc_split_register_check_cell (reg,
                                   gnc_table_get_current_cell_name (reg->table));
 
    if (!gnc_split_register_auto_calc (reg, split))
+   {
+     LEAVE("auto calc failed");
      return FALSE;
+   }
 
    /* Validate the transfer account names */
    (void)gnc_split_register_get_account (reg, MXFRM_CELL);
@@ -1394,7 +1474,10 @@
 
    /* Maybe deal with exchange-rate transfers */
    if (gnc_split_register_handle_exchange (reg, FALSE))
+   {
+     LEAVE("no exchange rate");
      return TRUE;
+   }
 
    gnc_suspend_gui_refresh ();
 
@@ -1424,6 +1507,7 @@
            if (gnc_split_register_begin_edit_or_warn(info, trans))
 	   {
 	       gnc_resume_gui_refresh ();
+               LEAVE("transaction opened elsewhere");
                return FALSE;
 	   }
        }
@@ -1519,6 +1603,7 @@
 
    gnc_resume_gui_refresh ();
 
+   LEAVE(" ");
    return TRUE;
 }
 



More information about the gnucash-changes mailing list