Line 0
Link Here
|
|
|
1 |
Submitted By: Randy McMurchy <randy_at_linuxfromscratch_dot_org> |
2 |
Date: 2005-10-04 |
3 |
Initial Package Version: 1.6.7 |
4 |
Upstream Status: Unknown |
5 |
Origin: http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/13956 |
6 |
Description: Fixes Guile with SLIB >= 3a2 |
7 |
|
8 |
$LastChangedBy$ |
9 |
$Date$ |
10 |
|
11 |
|
12 |
diff -Naur guile-1.6.7-orig/ice-9/slib.scm guile-1.6.7/ice-9/slib.scm |
13 |
--- ice-9/slib.scm 2004-08-11 20:04:21.000000000 -0500 |
14 |
+++ ice-9/slib.scm 2005-10-04 19:48:04.000000000 -0500 |
15 |
@@ -388,3 +388,74 @@ |
16 |
|
17 |
(define (make-exchanger obj) |
18 |
(lambda (rep) (let ((old obj)) (set! obj rep) old))) |
19 |
+ |
20 |
+(define software-type |
21 |
+ (if (string<? (version) "1.6") |
22 |
+ (lambda () 'UNIX) |
23 |
+ (lambda () 'unix))) |
24 |
+ |
25 |
+(define (user-vicinity) |
26 |
+ (case (software-type) |
27 |
+ ((VMS) "[.]") |
28 |
+ (else ""))) |
29 |
+ |
30 |
+(define vicinity:suffix? |
31 |
+ (let ((suffi |
32 |
+ (case (software-type) |
33 |
+ ((amiga) '(#\: #\/)) |
34 |
+ ((macos thinkc) '(#\:)) |
35 |
+ ((ms-dos windows atarist os/2) '(#\\ #\/)) |
36 |
+ ((nosve) '(#\: #\.)) |
37 |
+ ((unix coherent plan9) '(#\/)) |
38 |
+ ((vms) '(#\: #\])) |
39 |
+ (else |
40 |
+ (warn "require.scm" 'unknown 'software-type (software-type)) |
41 |
+ "/")))) |
42 |
+ (lambda (chr) (and (memv chr suffi) #t)))) |
43 |
+ |
44 |
+(define (pathname->vicinity pathname) |
45 |
+ (let loop ((i (- (string-length pathname) 1))) |
46 |
+ (cond ((negative? i) "") |
47 |
+ ((vicinity:suffix? (string-ref pathname i)) |
48 |
+ (substring pathname 0 (+ i 1))) |
49 |
+ (else (loop (- i 1)))))) |
50 |
+ |
51 |
+(define (program-vicinity) |
52 |
+ (define clp (current-load-port)) |
53 |
+ (if clp |
54 |
+ (pathname->vicinity (port-filename clp)) |
55 |
+ (slib:error 'program-vicinity " called; use slib:load to load"))) |
56 |
+ |
57 |
+(define sub-vicinity |
58 |
+ (case (software-type) |
59 |
+ ((VMS) (lambda |
60 |
+ (vic name) |
61 |
+ (let ((l (string-length vic))) |
62 |
+ (if (or (zero? (string-length vic)) |
63 |
+ (not (char=? #\] (string-ref vic (- l 1))))) |
64 |
+ (string-append vic "[" name "]") |
65 |
+ (string-append (substring vic 0 (- l 1)) |
66 |
+ "." name "]"))))) |
67 |
+ (else (let ((*vicinity-suffix* |
68 |
+ (case (software-type) |
69 |
+ ((NOSVE) ".") |
70 |
+ ((MACOS THINKC) ":") |
71 |
+ ((MS-DOS WINDOWS ATARIST OS/2) "\\") |
72 |
+ ((unix COHERENT PLAN9 AMIGA) "/")))) |
73 |
+ (lambda (vic name) |
74 |
+ (string-append vic name *vicinity-suffix*)))))) |
75 |
+ |
76 |
+(define with-load-pathname |
77 |
+ (let ((exchange |
78 |
+ (lambda (new) |
79 |
+ (let ((old program-vicinity)) |
80 |
+ (set! program-vicinity new) |
81 |
+ old)))) |
82 |
+ (lambda (path thunk) |
83 |
+ (define old #f) |
84 |
+ (define vic (pathname->vicinity path)) |
85 |
+ (dynamic-wind |
86 |
+ (lambda () (set! old (exchange (lambda () vic)))) |
87 |
+ thunk |
88 |
+ (lambda () (exchange old)))))) |
89 |
+ |