AUDIT: r17032 - gnucash/trunk/src/import-export/qif-import - Bug #519988: Update QIF importer bug detection and error messaging to use the

Charles Day cedayiv at cvs.gnucash.org
Sat Mar 15 00:26:36 EDT 2008


Author: cedayiv
Date: 2008-03-15 00:26:35 -0400 (Sat, 15 Mar 2008)
New Revision: 17032
Trac: http://svn.gnucash.org/trac/changeset/17032

Modified:
   gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
   gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
   gnucash/trunk/src/import-export/qif-import/qif-file.scm
   gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
   gnucash/trunk/src/import-export/qif-import/qif-parse.scm
   gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm
Log:
Bug #519988: Update QIF importer bug detection and error messaging to use the
proper Gnome functions. These are g_warning and g_critical for C, and gnc:warn
for Scheme.
BP


Modified: gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2008-03-15 04:26:35 UTC (rev 17032)
@@ -69,7 +69,7 @@
     current = SCM_CAR(accts);
 
     if(SCM_NULLP(current)) {
-      printf(" ** BUG in acct tree .. grib fix me! (everybody else ignore)\n");
+      g_critical("QIF import: BUG DETECTED in acct_tree_add_accts!");
       accts = SCM_CDR(accts);
       continue;
     }

Modified: gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/druid-qif-import.c	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/druid-qif-import.c	2008-03-15 04:26:35 UTC (rev 17032)
@@ -220,7 +220,7 @@
     if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
       if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
         /* Where are we? */
-        printf("QIF import: I'm lost!\n");
+        g_critical("QIF import: BUG DETECTED in get_next_druid_page! I'm lost!");
         return FALSE;
       }
       else {
@@ -253,7 +253,7 @@
         next = wind->post_comm_pages;
         break;
       default:
-        printf("QIF import: something fishy.\n");
+        g_critical("QIF import: BUG DETECTED in get_next_druid_page!");
         next = NULL;
         if (where > 3)
           return NULL;
@@ -287,7 +287,7 @@
     if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
       if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
         /* Where are we? */
-        printf("QIF import: I'm lost!\n");
+        g_critical("QIF import: BUG DETECTED in get_prev_druid_page! I'm lost!");
         return NULL;
       }
       else {
@@ -340,7 +340,7 @@
         break;
       default:
         if (wind->show_doc_pages)
-          printf("QIF import: something fishy.\n");
+          g_critical("QIF import: BUG DETECTED in get_prev_druid_page!");
         prev = NULL;
         if (where < 1)
           return NULL;
@@ -1718,7 +1718,7 @@
   /* this shouldn't happen, but DTRT if it does */
   if (SCM_NULLP(wind->new_stocks))
   {
-    printf("somehow got to commodity doc page with nothing to do... BUG!\n");
+    g_warning("QIF import: BUG DETECTED! Reached commodity doc page with nothing to do!");
     gnc_ui_qif_import_convert(wind);
   }
 

Modified: gnucash/trunk/src/import-export/qif-import/qif-file.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-file.scm	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/qif-file.scm	2008-03-15 04:26:35 UTC (rev 17032)
@@ -140,9 +140,9 @@
                            (if (string-match "^option:"
                                              (symbol->string qstate-type))
                                (begin
-                                 (display "qif-file:read-file ignoring ")
-                                 (write qstate-type)
-                                 (newline)
+                                 (gnc:warn "qif-file:read-file:"
+                                           " ignoring '" qstate-type
+                                           "' option.")
                                  (set! qstate-type old-qstate))))))
 
 
@@ -314,10 +314,9 @@
                             (set! current-xtn (make-qif-class)))
 
                            (else
-                            (display "qif-file:read-file : unknown Class slot ")
-                            (display tag)
-                            (display " .. continuing anyway.")
-                            (newline))))
+                            (gnc:warn "qif-file:read-file:"
+                                      " ignoring class '" tag "' line."
+                                      "\nLine content: [" line "]"))))
 
 
                         ;;;;;;;;;;;;;;;;;;
@@ -385,9 +384,9 @@
                             (set! current-xtn (make-qif-cat)))
 
                            (else
-                            (display "qif-file:read-file : unknown Cat slot ")
-                            (display tag)
-                            (display " .. continuing anyway") (newline))))
+                            (gnc:warn "qif-file:read-file:"
+                                      " ignoring category '" tag "' line."
+                                      "\nLine content: [" line "]"))))
 
 
                         ;;;;;;;;;;;;;;;;;;;
@@ -418,10 +417,9 @@
                             (set! current-xtn (make-qif-stock-symbol)))
 
                            (else
-                            (display "qif-file:read-file : unknown Security slot ")
-                            (display tag)
-                            (display " .. continuing anyway.")
-                            (newline))))
+                            (gnc:warn "qif-file:read-file:"
+                                      " ignoring security '" tag "' line."
+                                      "\nLine content: [" line "]"))))
 
 
                         ;; trying to sneak one by, eh?
@@ -429,10 +427,9 @@
                           (if (and (not qstate-type)
                                    (not (string=? (string-trim line) "")))
                               (begin
-                                (display "line = ") (display line) (newline)
-                                (display "qif-file:read-file : ")
-                                (display "file does not appear to be a QIF file.")
-                                (newline)
+                                (gnc:warn "qif-file:read-file:"
+                                          " file does not appear to be a QIF."
+                                          "\nLine content: [" line "]")
                                 (set! return-val
                                       (list #f "File does not appear to be a QIF file."))
                                 (set! heinous-error #t))))))

Modified: gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm	2008-03-15 04:26:35 UTC (rev 17032)
@@ -218,7 +218,8 @@
                              (gnc-commodity-get-namespace value)
                              (gnc-commodity-get-mnemonic value))
                        table))
-           (display "write-commodities: something funny in hash table.\n"))
+           (gnc:warn "qif-import:write-commodities:"
+                     " something funny in hash table."))
        #f) #f hashtab)
     (write table)))
 

Modified: gnucash/trunk/src/import-export/qif-import/qif-parse.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-parse.scm	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/qif-parse.scm	2008-03-15 04:26:35 UTC (rev 17032)
@@ -64,8 +64,7 @@
                          #f))))
           rv)
         (begin
-          (display "qif-split:parse-category : can't parse ")
-          (display value) (newline)
+          (gnc:warn "qif-split:parse-category: can't parse [" value "].")
           (list "" #f #f)))))
 
 
@@ -85,9 +84,8 @@
     ;; thanks dave p for reporting this.
     (if (eq? (string-ref year-string 0) #\')
         (begin
-          (display "qif-file:fix-year : found a weird QIF Y2K year : |")
-          (display year-string)
-          (display "|") (newline)
+          (gnc:warn "qif-file:fix-year: found weird QIF Y2K year ["
+                    year-string "].")
           (set! fixed-string
                 (substring year-string 2 (string-length year-string))))
         (set! fixed-string year-string))
@@ -129,9 +127,8 @@
      
      ;; No idea what the string represents.  Maybe a new bug in Quicken!
      (#t
-      (display "qif-file:fix-year : ay caramba! What is this? |")
-      (display year-string)
-      (display "|") (newline)))
+      (gnc:warn "qif-file:fix-year: ay caramba! What is this? ["
+                year-string "].")))
 
     y2k-fixed-value))
 
@@ -165,10 +162,9 @@
      ((string=? mangled-string "mutual")
       (list GNC-BANK-TYPE))
      (#t
-      (display "qif-parse:parse-acct-type : unhandled account type ")
-      (display read-value)
-      (display "... substituting Bank.")
-      (newline)
+      (gnc:warn "qif-parse:parse-acct-type: unrecognized account type ["
+                read-value
+                "]... substituting Bank.")
       (list GNC-BANK-TYPE)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -464,10 +460,8 @@
     ;; if the date parts list doesn't have 3 parts, we're in
     ;; trouble
     (if (not (eq? 3 (length date-parts)))
-        (begin
-          (display "qif-parse:parse-date/format : can't interpret date ")
-          (display date-string) (display " ") (write date-parts)(newline))
-        
+        (gnc:warn "qif-parse:parse-date/format: can't interpret date ["
+                  date-string "]\nDate parts: " date-parts)
         (case format
           ((d-m-y)
            (let ((d (car numeric-date-parts))
@@ -476,10 +470,9 @@
              (if (and (integer? d) (integer? m) (integer? y)
                       (<= m 12) (<= d 31))
                  (set! retval (list d m y))
-                 (begin
-                   (display "qif-parse:parse-date/format : ")
-                   (display "format is d/m/y, but date is ")
-                   (display date-string) (newline)))))
+                 (gnc:warn "qif-parse:parse-date/format: "
+                           "format is d/m/y, but date is ["
+                           date-string "]."))))
           
           ((m-d-y)
            (let ((m (car numeric-date-parts))
@@ -488,10 +481,9 @@
              (if (and (integer? d) (integer? m) (integer? y)
                       (<= m 12) (<= d 31))
                  (set! retval (list d m y))
-                 (begin
-                   (display "qif-parse:parse-date/format : ")
-                   (display " format is m/d/y, but date is ")
-                   (display date-string) (newline)))))
+                 (gnc:warn "qif-parse:parse-date/format: "
+                           "format is m/d/y, but date is ["
+                           date-string "]."))))
           
           ((y-m-d)
            (let ((y (qif-parse:fix-year (car date-parts) 50))
@@ -500,10 +492,9 @@
              (if (and (integer? d) (integer? m) (integer? y)
                       (<= m 12) (<= d 31))
                  (set! retval (list d m y))
-                 (begin
-                   (display "qif-parse:parse-date/format :")
-                   (display " format is y/m/d, but date is ")
-                   (display date-string) (newline)))))
+                 (gnc:warn "qif-parse:parse-date/format: "
+                           "format is y/m/d, but date is ["
+                           date-string "]."))))
           
           ((y-d-m)
            (let ((y (qif-parse:fix-year (car date-parts) 50))
@@ -512,10 +503,9 @@
              (if (and (integer? d) (integer? m) (integer? y)
                       (<= m 12) (<= d 31))
                  (set! retval (list d m y))
-                 (begin
-                   (display "qif-parse:parse-date/format : ")
-                   (display " format is y/m/d, but date is ")
-                   (display date-string) (newline)))))))
+                 (gnc:warn "qif-parse:parse-date/format: "
+                           "format is y/d/m, but date is ["
+                           date-string "]."))))))
     retval))
 
 

Modified: gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm	2008-03-14 03:24:11 UTC (rev 17031)
+++ gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm	2008-03-15 04:26:35 UTC (rev 17032)
@@ -608,9 +608,8 @@
           ;; I don't think this should ever happen, but I want 
           ;; to keep this check just in case. 
           (if (> (length splits) 1)
-              (begin 
-                (display "qif-import:qif-xtn-to-gnc-xtn : ")
-                (display "splits in stock transaction!") (newline)))
+              (gnc:warn "qif-import:qif-xtn-to-gnc-xtn: "
+                        "splits in stock transaction!"))
 
           (set! qif-accts 
                 (qif-split:accounts-affected (car (qif-xtn:splits qif-xtn))



More information about the gnucash-changes mailing list