diff options
author | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-12-05 22:03:45 +0100 |
---|---|---|
committer | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-12-05 22:03:45 +0100 |
commit | a27b72f263a14e4efb97479fb022da43ff81b957 (patch) | |
tree | faa094630bb25b1e9e9d9547e5f3506046cd9ef5 | |
parent | 13c923ed2fb507dc0a9e21726edb095d6855df8b (diff) |
module statement compilatoin bugfix
-rw-r--r-- | modules/Makefile.am | 4 | ||||
l--------- | modules/language/python/.#spec.scm | 1 | ||||
-rw-r--r-- | modules/language/python/compile.scm | 22 | ||||
-rw-r--r-- | modules/language/python/guilemod.scm | 3 | ||||
-rw-r--r-- | modules/language/python/module.scm | 3 | ||||
-rw-r--r-- | modules/language/python/module/collections.scm | 10 |
6 files changed, 27 insertions, 16 deletions
diff --git a/modules/Makefile.am b/modules/Makefile.am index dc726d9..d2d4f63 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -50,6 +50,8 @@ SOURCES = \ language/python/module/os/path.scm \ language/python/module/os.scm \ language/python/module/python.scm \ - language/python/spec.scm + language/python/spec.scm \ + language/python/module/collections/abc.scm \ + language/python/module/collections.scm EXTRA_DIST += env.in COPYING diff --git a/modules/language/python/.#spec.scm b/modules/language/python/.#spec.scm deleted file mode 120000 index bf7a10b..0000000 --- a/modules/language/python/.#spec.scm +++ /dev/null @@ -1 +0,0 @@ -stis@lapwine.29401:1539964896
\ No newline at end of file diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm index 821389c..e291e34 100644 --- a/modules/language/python/compile.scm +++ b/modules/language/python/compile.scm @@ -281,12 +281,12 @@ (fold f (f (car l) init) (cdr l)) init)) -(define do-pr #t) +(define do-pr #f) (define (pr . x) (if do-pr (let () - (define port (open-file "/home/stis/src/python-on-guile/log.txt" "a")) + (define port (open-file "/home/stis/src/python-on-guile/modules/log.txt" "a")) (with-output-to-port port (lambda () (pretty-print (syntax->datum x)))) @@ -294,7 +294,7 @@ (car (reverse x))) (define (pf x) - (define port (open-file "/home/stis/src/python-on-guile/compile.log" "a")) + (define port (open-file "/home/stis/src/python-on-guile/modules/compile.log" "a")) (with-output-to-port port (lambda () (pretty-print (syntax->datum x)) x)) (close port) @@ -1389,10 +1389,13 @@ ,@(map (lambda (dots ids as) `(,(G 'begin) - ,@(map (lambda (dots ids as) - (let* ((u (module-name (current-module))) - (u (reverse (list-cdr-ref (reverse (u-it u)) - (- (length dots) 1)))) + ,@(map (lambda (dots ids as) + (let* ((u (module-name (current-module))) + (u (if (null? dots) + '() + (reverse (list-cdr-ref + (reverse (u-it u)) + (- (length dots) 1))))) (path (append (if (null? dots) '() u) (map (g vs exp) ids)))) @@ -2059,7 +2062,7 @@ (define (exp vs x) - (match x + (match (pr 'exp x) ((e) (exp vs e)) ((tag . l) @@ -2117,6 +2120,7 @@ (x '()))) (fluid-set! ignore '()) + (pr (if (fluid-ref (@@ (system base compile) %in-compile)) (begin (if (fluid-ref (@@ (system base compile) %in-compile)) @@ -2162,7 +2166,7 @@ (if (member s (fluid-ref ignore)) `(,cvalues) `(,(C 'var) ,s))) globs) - (,(C 'with-exit) ,@e)))))) + (,(C 'with-exit) ,@e))))))) diff --git a/modules/language/python/guilemod.scm b/modules/language/python/guilemod.scm index da1f5c7..3c68142 100644 --- a/modules/language/python/guilemod.scm +++ b/modules/language/python/guilemod.scm @@ -53,7 +53,8 @@ (define-set-C compile-file (lambda* (file #:key (output-file #f) - (from ((C default-language) file)) + (from (pk 'lang-from + ((C default-language) file))) (to 'bytecode) (env ((C default-environment) from)) (opts '()) diff --git a/modules/language/python/module.scm b/modules/language/python/module.scm index 5e04fda..d239baf 100644 --- a/modules/language/python/module.scm +++ b/modules/language/python/module.scm @@ -82,6 +82,7 @@ (define __init__ (case-lambda ((self pre l nm) + (pk 1) (match l ((name) (rawset self '_path (reverse (cons name pre))) @@ -93,9 +94,11 @@ ((self l nm) + (pk 2) (_cont self #f l #f nm #f)) ((self l) + (pk 3) (if (pair? l) (if (and (> (length l) 3) (equal? (list (list-ref l 0) diff --git a/modules/language/python/module/collections.scm b/modules/language/python/module/collections.scm index c4d87e4..aae2a8c 100644 --- a/modules/language/python/module/collections.scm +++ b/modules/language/python/module/collections.scm @@ -1,5 +1,6 @@ (define-module (language python module collections) #:use-module (ice-9 control) + #:use-module (ice-9 format) #:use-module (ice-9 pretty-print) #:use-module (oop pf-objects) #:use-module (oop goops) @@ -411,10 +412,11 @@ (define elements (lambda (self) ((make-generator () - (for ((k v : self)) () - (if (and (number? v) (integer? v) (> v 0)) - (for ((i : (range v))) () - (yield k)))))))) + (lambda (yield) + (for ((k v : self)) () + (if (and (number? v) (integer? v) (> v 0)) + (for ((i : (range v))) () + (yield k))))))))) (define fromkeys (lambda x |