[Gnucash-changes] r12872 - gnucash/trunk/src/scm - Minor scheme cleanup.

Chris Shoemaker chris at cvs.gnucash.org
Wed Jan 18 20:33:16 EST 2006


Author: chris
Date: 2006-01-18 20:33:16 -0500 (Wed, 18 Jan 2006)
New Revision: 12872
Trac: http://svn.gnucash.org/trac/changeset/12872

Modified:
   gnucash/trunk/src/scm/command-line.scm
   gnucash/trunk/src/scm/main.scm
   gnucash/trunk/src/scm/path.scm
Log:
  Minor scheme cleanup.
  Move one function from path.scm to command-line.scm.
  Remove processing of arguments now handled in C.


Modified: gnucash/trunk/src/scm/command-line.scm
===================================================================
--- gnucash/trunk/src/scm/command-line.scm	2006-01-19 01:29:52 UTC (rev 12871)
+++ gnucash/trunk/src/scm/command-line.scm	2006-01-19 01:33:16 UTC (rev 12872)
@@ -33,6 +33,21 @@
 (define gnc:*doc-path* #f)
 (define gnc:*namespace-regexp* #f)
 
+(define (gnc:expand-path new-list current-list default-generator)
+  (define (expand-path-item item)
+    (cond ((string? item) (list item))
+          ((symbol? item)
+           (case item
+             ((default) (default-generator))
+             ((current) current-list)
+             (else
+              (gnc:warn "bad symbol " item " in gnc path. Ignoring.")
+              '())))
+          (else 
+           (gnc:warn "bad item " item " in gnc path. Ignoring.")
+           '())))
+  (apply append (map expand-path-item new-list)))
+
 ;; If command line args are present, then those dominate, and take
 ;; effect in order, left-to-right.  Otherwise, any envt var setting
 ;; dominates, otherwise, we use the default.  To effect this, we first
@@ -357,12 +372,6 @@
       (list (car args) (cdr args))
       (begin (gnc:warn "no argument given where one expected") #f)))
 
-(define (gnc:prefs-show-version)
-  (display "GnuCash ")
-  (display gnc:version)
-  (if gnc:*is-development-version?* (display " development version"))
-  (newline))
-
 (define (gnc:prefs-show-usage)
   (display "Usage: gnucash [ option ... ] [ datafile ]")
   (newline) (newline)

Modified: gnucash/trunk/src/scm/main.scm
===================================================================
--- gnucash/trunk/src/scm/main.scm	2006-01-19 01:29:52 UTC (rev 12871)
+++ gnucash/trunk/src/scm/main.scm	2006-01-19 01:33:16 UTC (rev 12872)
@@ -365,31 +365,14 @@
   (gnc:debug "starting up (1).")
   (gnc:setup-debugging)
 
-  ;; SUPER UGLY HACK -- this should go away when I come back for the
-  ;; second cleanup pass...
-  (let ((original-module (current-module))
-        (bootstrap (resolve-module '(gnucash main))))
-    
-    ;; Now we can load a bunch of files.
-    (load-from-path "path.scm")
-    (load-from-path "command-line.scm") ;; depends on app-utils (N_, etc.)...
-    )
+  ;; Now we can load a bunch of files.
+  (load-from-path "path.scm")
+  (load-from-path "command-line.scm") ;; depends on app-utils (N_, etc.)...
 
   (gnc:initialize-config-vars) ;; in command-line.scm
   ;; handle unrecognized command line args
   (if (not (gnc:handle-command-line-args))
       (gnc:shutdown 1))
-  ;; handle --version
-  (if (gnc:config-var-value-get gnc:*arg-show-version*)
-      (begin
-        (gnc:prefs-show-version)
-        (gnc:shutdown 0)))
-  ;; handle --help
-  (if (or (gnc:config-var-value-get gnc:*arg-show-usage*)
-          (gnc:config-var-value-get gnc:*arg-show-help*))
-      (begin
-        (gnc:prefs-show-usage)
-        (gnc:shutdown 0))))
 
 (define (gnc:startup-pass-2)
   (gnc:debug "starting up (2).")
@@ -447,11 +430,11 @@
 
   ;; Load the system configs
   (gnc:update-splash-screen (_ "Loading configs..."))
-  (if (not (gnc:load-system-config-if-needed))
+  (if (not (gnc:load-system-config-if-needed)) ;; from path.scm
       (gnc:shutdown 1))
 
   ;; Load the user configs
-  (gnc:load-user-config-if-needed)
+  (gnc:load-user-config-if-needed) ;; from path.scm
 
   (gnc:report-menu-setup)
 

Modified: gnucash/trunk/src/scm/path.scm
===================================================================
--- gnucash/trunk/src/scm/path.scm	2006-01-19 01:29:52 UTC (rev 12871)
+++ gnucash/trunk/src/scm/path.scm	2006-01-19 01:33:16 UTC (rev 12872)
@@ -15,21 +15,6 @@
 ;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
 ;; Boston, MA  02110-1301,  USA       gnu at gnu.org
 
-(define (gnc:expand-path new-list current-list default-generator)
-  (define (expand-path-item item)
-    (cond ((string? item) (list item))
-          ((symbol? item)
-           (case item
-             ((default) (default-generator))
-             ((current) current-list)
-             (else
-              (gnc:warn "bad symbol " item " in gnc path. Ignoring.")
-              '())))
-          (else 
-           (gnc:warn "bad item " item " in gnc path. Ignoring.")
-           '())))
-  (apply append (map expand-path-item new-list)))
-
 (define (gnc:make-dir dir)
   (if (access? dir X_OK)
       #t



More information about the gnucash-changes mailing list