guile modifications git diff and strating supporting yield
[software/python-on-guile.git] / python.diff
1 diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
2 index c110512f0..d5d63a9e0 100644
3 --- a/module/system/base/compile.scm
4 +++ b/module/system/base/compile.scm
5 @@ -132,9 +132,30 @@
6 (and (false-if-exception (ensure-directory (dirname f)))
7 f))))
8
9 +(define *do-extension-dispatch* #f)
10 +(define *extension-dispatches* '((("py") . python) (("pl") . prolog)))
11 +
12 +(define (default-language file)
13 + (define default (current-language))
14 + (if *do-extension-dispatch*
15 + (let ((ext (car (reverse (string-split file #\.)))))
16 + (let lp ((l *extension-dispatches*))
17 + (if (pair? l)
18 + (if (member ext (caar l))
19 + (let ((r (cdar l)))
20 + (if (language? default)
21 + (if (eq? (language-name default) r)
22 + default
23 + r)
24 + r))
25 + (lp (cdr l)))
26 + default)))
27 + default))
28 +
29 +
30 (define* (compile-file file #:key
31 (output-file #f)
32 - (from (current-language))
33 + (from (default-language file))
34 (to 'bytecode)
35 (env (default-environment from))
36 (opts '())
37 diff --git a/module/system/base/message.scm b/module/system/base/message.scm
38 index 979291c1e..c0d639235 100644
39 --- a/module/system/base/message.scm
40 +++ b/module/system/base/message.scm
41 @@ -34,7 +34,8 @@
42 warning-type? warning-type-name warning-type-description
43 warning-type-printer lookup-warning-type
44
45 - %warning-types))
46 + %warning-types
47 + %dont-warn-list))
48
49 \f
50 ;;;
51 @@ -74,6 +75,7 @@
52 (description warning-type-description)
53 (printer warning-type-printer))
54
55 +(define %dont-warn-list '())
56 (define %warning-types
57 ;; List of known warning types.
58 (map (lambda (args)
59 @@ -112,8 +114,9 @@
60 (unbound-variable
61 "report possibly unbound variables"
62 ,(lambda (port loc name)
63 - (emit port "~A: warning: possibly unbound variable `~A'~%"
64 - loc name)))
65 + (if (not (member name %dont-warn-list))
66 + (emit port "~A: warning: possibly unbound variable `~A'~%"
67 + loc name))))
68
69 (macro-use-before-definition
70 "report possibly mis-use of macros before they are defined"