parent
2bf00a1208
commit
b8171611aa
|
@ -1104,6 +1104,28 @@
|
||||||
(let ([x (+ 9 (expt 10 100))])
|
(let ([x (+ 9 (expt 10 100))])
|
||||||
(test (list (cons x (add1 x))) regexp-match-peek-positions #"0" p (expt 10 100)))))
|
(test (list (cons x (add1 x))) regexp-match-peek-positions #"0" p (expt 10 100)))))
|
||||||
|
|
||||||
|
;; Make sure that peeking past the end of a
|
||||||
|
;; file as a first action gives EOF right away
|
||||||
|
(let ([tempfilename (make-temporary-file)])
|
||||||
|
(call-with-output-file*
|
||||||
|
tempfilename
|
||||||
|
#:exists 'truncate
|
||||||
|
(lambda (o) (write-bytes (make-bytes 50 65) o)))
|
||||||
|
(for ([end '(60 50)])
|
||||||
|
(test (list eof eof)
|
||||||
|
call-with-input-file
|
||||||
|
tempfilename
|
||||||
|
(lambda (i)
|
||||||
|
(list (peek-byte i end)
|
||||||
|
(peek-byte i end))))
|
||||||
|
(test (list eof eof)
|
||||||
|
call-with-input-file
|
||||||
|
tempfilename
|
||||||
|
(lambda (i)
|
||||||
|
(list (peek-bytes 1 end i)
|
||||||
|
(peek-bytes 1 end i)))))
|
||||||
|
(delete-file tempfilename))
|
||||||
|
|
||||||
;;------------------------------------------------------------
|
;;------------------------------------------------------------
|
||||||
|
|
||||||
;; Test custom output port
|
;; Test custom output port
|
||||||
|
|
|
@ -1306,11 +1306,13 @@ intptr_t scheme_get_byte_string_unless(const char *who,
|
||||||
} else if (v == SCHEME_SPECIAL) {
|
} else if (v == SCHEME_SPECIAL) {
|
||||||
ip->special = NULL;
|
ip->special = NULL;
|
||||||
scheme_bad_time_for_special(who, port);
|
scheme_bad_time_for_special(who, port);
|
||||||
} else if (v == skip) {
|
} else if (v > 0) {
|
||||||
peek_skip = scheme_bin_minus(peek_skip, scheme_make_integer(skip));
|
peek_skip = scheme_bin_minus(peek_skip, scheme_make_integer(skip));
|
||||||
/* Ok... ready to continue (if skip == peek_skip) */
|
/* Ok... ready to continue (if skip == peek_skip) */
|
||||||
} else
|
} else {
|
||||||
|
/* This shouldn't happen, but just in case */
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size) {
|
if (size) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user