Last active
August 3, 2018 13:36
-
-
Save alexgian/1fe75b0c3fc95cb46baae2f50ae9211c to your computer and use it in GitHub Desktop.
Patch to allow SLIB to work under Guile 2.0 (from Chris Vine - 2.0 won't work for 2.2 - use as appropriate)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; extra patch for 2.2 from Chris Vine (the one below is not enough) | |
;; not tested yet | |
--- guile-2.init.20 2018-06-14 10:42:46.393772164 +0100 | |
+++ guile-2.init 2018-06-14 10:43:51.672814892 +0100 | |
@@ -171,8 +171,6 @@ | |
provide | |
provided?)) | |
-(define slib-module (current-module)) | |
- | |
(module-export-all! (current-module)) | |
;;; (software-type) should be set to the generic operating system type. | |
@@ -441,10 +439,7 @@ | |
(lambda () ".scm")) | |
(define (slib:load <pathname>) | |
- (save-module-excursion | |
- (lambda () | |
- (set-current-module slib-module) | |
- (load (string-append <pathname> (scheme-file-suffix)))))) | |
+ (load (string-append <pathname> (scheme-file-suffix)))) | |
;;;(SLIB:LOAD-SOURCE "foo") should load "foo.scm" or with whatever | |
;;;suffix all the module files in SLIB have. See feature 'SOURCE. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- slib/guile-2.init.orig 2013-12-28 13:17:16.324936077 +0000 | |
+++ slib/guile-2.init 2013-12-30 12:24:28.715147778 +0000 | |
@@ -559,13 +559,16 @@ | |
ra0)) | |
(define (array:copy! dest source) | |
(array-map! dest identity source)) | |
-;; DIMENSIONS->UNIFORM-ARRAY and list->uniform-array in Guile-1.6.4 | |
-;; cannot make empty arrays. | |
+ | |
(define make-array | |
(lambda (prot . args) | |
- (dimensions->uniform-array args (array-prototype prot) | |
- (apply array-ref prot | |
- (map car (array-shape prot)))))) | |
+ (let ((fill (if (memv 0 (array-dimensions prot)) | |
+ *unspecified* | |
+ (apply array-ref prot (map car (array-shape prot)))))) | |
+ (apply make-typed-array | |
+ (array-type prot) | |
+ fill | |
+ args)))) | |
(define (list->array rank proto lst) | |
(define dimensions | |
@@ -618,27 +621,24 @@ | |
vect)) | |
(define create-array make-array) | |
-(define (make-uniform-wrapper prot) | |
- (if (string? prot) (set! prot (string->number prot))) | |
- (if prot | |
- (lambda opt | |
- (if (null? opt) | |
- (list->uniform-array 1 prot (list prot)) | |
- (list->uniform-array 0 prot (car opt)))) | |
- vector)) | |
-(define ac64 (make-uniform-wrapper "+i")) | |
-(define ac32 ac64) | |
-(define ar64 (make-uniform-wrapper "1/3")) | |
-(define ar32 (make-uniform-wrapper "1.")) | |
-(define as64 vector) | |
-(define as32 (make-uniform-wrapper -32)) | |
-(define as16 as32) | |
-(define as8 as32) | |
-(define au64 vector) | |
-(define au32 (make-uniform-wrapper 32)) | |
-(define au16 au32) | |
-(define au8 au32) | |
-(define at1 (make-uniform-wrapper #t)) | |
+(define (make-typed-wrapper pair) | |
+ (lambda opt | |
+ (if (null? opt) | |
+ (list->typed-array (car pair) 1 (list (cdr pair))) | |
+ (list->typed-array (car pair) 0 (car opt))))) | |
+(define ac64 (make-typed-wrapper '(c64 . 0.0+0.0i))) | |
+(define ac32 (make-typed-wrapper '(c32 . 0.0+0.0i))) | |
+(define ar64 (make-typed-wrapper '(f64 . 0.0))) | |
+(define ar32 (make-typed-wrapper '(f32 . 0.0))) | |
+(define as64 (make-typed-wrapper '(s64 . 0))) | |
+(define as32 (make-typed-wrapper '(s32 . 0))) | |
+(define as16 (make-typed-wrapper '(s16 . 0))) | |
+(define as8 (make-typed-wrapper '(s8 . 0))) | |
+(define au64 (make-typed-wrapper '(u64 . 0))) | |
+(define au32 (make-typed-wrapper '(u32 . 0))) | |
+(define au16 (make-typed-wrapper '(u16 . 0))) | |
+(define au8 (make-typed-wrapper '(u8 . 0))) | |
+(define at1 (make-typed-wrapper '(b . #f))) | |
;;; New SRFI-58 names | |
;; flonums | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment