Check-in [27a45ffaf8]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:eqv? or zero? instead of eq? somewhere
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 27a45ffaf87a492278efd7f295be0d6383ef12b8
User & Date: aldo 2016-12-08 01:27:14
Context
2016-12-09
16:38
added bytevector-copy* check-in: 28f201db00 user: aldo tags: trunk
2016-12-08
01:27
eqv? or zero? instead of eq? somewhere check-in: 27a45ffaf8 user: aldo tags: trunk
00:57
minor fix on with-mktemp check-in: 778dd320bb user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to posix.sls.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    (if (< (close* fd) 0)
	(errorf 'close "failed: ~a" (strerror))))


  (define (wtermsig x)
    (logand x #x7f))
  (define (wifexited x)
    (eq? (wtermsig x) 0))
  (define (wifsignaled x)
    (> (logand #xff (bitwise-arithmetic-shift-right
		     (+ 1 (wtermsig x))
		     1))
       0))
  (define (wexitstatus x)
    (bitwise-arithmetic-shift-right (logand x #xff00) 8))







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    (if (< (close* fd) 0)
	(errorf 'close "failed: ~a" (strerror))))


  (define (wtermsig x)
    (logand x #x7f))
  (define (wifexited x)
    (zero? (wtermsig x)))
  (define (wifsignaled x)
    (> (logand #xff (bitwise-arithmetic-shift-right
		     (+ 1 (wtermsig x))
		     1))
       0))
  (define (wexitstatus x)
    (bitwise-arithmetic-shift-right (logand x #xff00) 8))

Changes to sdl2/extras.ss.

21
22
23
24
25
26
27
28
29
30

;; THIS IS FOR DECODING sdl-text-input-event text
(define (char*-array->string ptr max)
  (let loop ([i 0] [r '()])
    (let ([x (ftype-ref char-array (i) 
			(make-ftype-pointer char-array 
					    (ftype-pointer-address ptr)))])
      (if (or (eq? x #\nul) (>= i max))
	  (utf8->string (u8-list->bytevector (reverse r)))
	  (loop (+ i 1) (cons (char->integer x) r))))))







|


21
22
23
24
25
26
27
28
29
30

;; THIS IS FOR DECODING sdl-text-input-event text
(define (char*-array->string ptr max)
  (let loop ([i 0] [r '()])
    (let ([x (ftype-ref char-array (i) 
			(make-ftype-pointer char-array 
					    (ftype-pointer-address ptr)))])
      (if (or (eqv? x #\nul) (>= i max))
	  (utf8->string (u8-list->bytevector (reverse r)))
	  (loop (+ i 1) (cons (char->integer x) r))))))

Changes to thunder-utils.sls.

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		     (begin 
		       (unless (and (null? t) discard-null?)
			       (set! res (append res (list (list->string t)))))
		       (loop (cdr l) '()))
		     (loop (cdr l) (append t (list (car l)))))))]))
	    
	 ;; POSSIBLE THAT THIS NOT EXIST?
	 ;; if x is a character: (eq?  s[i] x) => s[i] = y
	 ;; if x is a list:      (memq s[i] x) => s[i] = y

	 (define (string-replace s x y)
	   (list->string  
	    (let ([cmp (if (list? x) memq eq?)])
	      (map (lambda (z) (if (cmp z x) y z)) (string->list s)))))



);library







|




|





34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		     (begin 
		       (unless (and (null? t) discard-null?)
			       (set! res (append res (list (list->string t)))))
		       (loop (cdr l) '()))
		     (loop (cdr l) (append t (list (car l)))))))]))
	    
	 ;; POSSIBLE THAT THIS NOT EXIST?
	 ;; if x is a character: (eqv?  s[i] x) => s[i] = y
	 ;; if x is a list:      (memq s[i] x) => s[i] = y

	 (define (string-replace s x y)
	   (list->string  
	    (let ([cmp (if (list? x) memq eqv?)])
	      (map (lambda (z) (if (cmp z x) y z)) (string->list s)))))



);library