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

gEDA-cvs: branch: master updated (1.1.2.20070818-86-gce2255f)



The branch, master has been updated
       via  ce2255f2633c9bb14dcd3813e019a84d8acce3a3 (commit)
      from  23ead18086e59aab22945c37ff95f49e5747f277 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 libgeda/lib/system-gafrc |   12 +++++-------
 libgeda/scheme/geda.scm  |   43 +++++++++++++++++++++++++++++++++++++++++++
 symbols/Makefile.am      |    5 ++++-
 3 files changed, 52 insertions(+), 8 deletions(-)


=================
 Commit Messages
=================

commit ce2255f2633c9bb14dcd3813e019a84d8acce3a3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Oct 4 21:24:15 2007 +0100

    Alter system-gafrc to process .scm files in $GEDA_DATA_DIR/gafrc.d/
    
    This change allows each symbol package (e.g. geda-symbols) to install a
    scheme config file under this dir to load its contents. This allows
    additional symbol packages to be installed globally without needing to edit
    either geda-clib.scm or system-gafrc.
    
    Also moves the installation of geda-clib.scm into this directory.

:100644 100644 24467b8... 23fee18... M	libgeda/lib/system-gafrc
:100644 100644 5a0b1b3... 3fbf766... M	libgeda/scheme/geda.scm
:100644 100644 fcd5eed... 048df70... M	symbols/Makefile.am

=========
 Changes
=========

commit ce2255f2633c9bb14dcd3813e019a84d8acce3a3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Oct 4 21:24:15 2007 +0100

    Alter system-gafrc to process .scm files in $GEDA_DATA_DIR/gafrc.d/
    
    This change allows each symbol package (e.g. geda-symbols) to install a
    scheme config file under this dir to load its contents. This allows
    additional symbol packages to be installed globally without needing to edit
    either geda-clib.scm or system-gafrc.
    
    Also moves the installation of geda-clib.scm into this directory.

diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index 24467b8..23fee18 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -26,19 +26,17 @@
 ;; The directory containing various bitmaps (e.g. icons)
 (bitmap-directory (build-path geda-data-path "bitmap"))
 
-
-; Load the default component libraries
-(let ((clib-def-file (%search-load-path "geda-clib")))
-  (if clib-def-file 
-      (load clib-def-file)
-      (display "Failed to load default component libraries.\n")))
-
 ; Load the default font
 (let ((font-def-file (%search-load-path "geda-font")))
   (if font-def-file 
       (load font-def-file)
       (display "Failed to load default font.\n")))
 
+;; The directory containing any extra scheme files to load
+(define geda-confd-path (build-path geda-data-path "gafrc.d"))
+
+;; Execute any scheme files found in the geda-confd-path directory.
+(load-scheme-dir geda-confd-path)
 
 ; Set the name of the postscript prolog file that will be 
 ; pasted into the postscript output after the DSC comments, but
diff --git a/libgeda/scheme/geda.scm b/libgeda/scheme/geda.scm
index 5a0b1b3..3fbf766 100644
--- a/libgeda/scheme/geda.scm
+++ b/libgeda/scheme/geda.scm
@@ -4,3 +4,46 @@
       (apply build-path 
 	     (append (list (string-append first path-sep (car rest))) 
 		     (cdr rest)))))
+
+;; Returns #t if the given path is a regular file, otherwise #f.
+(define regular-file?
+  (lambda (path)
+    (eqv? (stat:type (stat path)) 'regular )
+  ))
+
+;; Returns #t if the given path is a directory file, otherwise #f.
+(define directory?
+  (lambda (path)
+    (eqv? (stat:type (stat path)) 'directory )
+  ))
+
+;; Returns #t if the given string ends with the given suffix, otherwise or #f.
+(define has-suffix?
+  (lambda (str suf)
+    (define len-str (string-length str))
+    (define len-suf (string-length suf))
+    (if (>= len-str len-suf)
+      (string=? (substring str (- len-str len-suf) len-str) suf)
+      #f
+    )))
+
+;; Execute any scheme files found in the given directory.
+(define load-scheme-dir
+  (lambda (scheme-dir)
+  (if (and (file-exists? scheme-dir)
+           (directory? scheme-dir)
+           (access? scheme-dir R_OK))
+    (let ((dir (opendir scheme-dir)))
+      (do ((entry (readdir dir) (readdir dir)))
+          ((eof-object? entry))
+        (let ((path (build-path scheme-dir entry)))
+          (if (and (regular-file? path)
+                   (has-suffix? path ".scm")
+                   (access? path R_OK))
+            (load path)
+            #f
+          )))
+      (closedir dir))
+    #f
+  )))
+
diff --git a/symbols/Makefile.am b/symbols/Makefile.am
index fcd5eed..048df70 100644
--- a/symbols/Makefile.am
+++ b/symbols/Makefile.am
@@ -7,7 +7,10 @@ SUBDIRS = \
 	asic asicpads gnetman minicircuits st apex allegro irf documentation
 
 scmdatadir = @GEDADATADIR@@PATHSEP@scheme
-dist_scmdata_DATA = geda-clib.scm geda-font.scm
+dist_scmdata_DATA = geda-font.scm
+
+gafrcddir = @GEDADATADIR@@PATHSEP@xxxxxxx
+dist_gafrcd_DATA = geda-clib.scm
 
 EXTRA_DIST = autogen.sh ChangeLog-1.0
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs