Dear fellow Schemers! I've run into a problem with swank.scm, specifically READ-PACKET. It seems it doesn't handle big data (more than about 4k) well. This comes up when I put the cursor into any long list towards the end (such as sxml files). Only the first ~4k are read, the rest is read the next time through, which crashes, as STRING->NUMBER doesn't accept it. The solution should be to loop and READ-SUBSTRING! until the length of the entire message as specified has been read.
This should solve the problem (feel free to reformulate): (define (read-packet in) (if (eof-object? (peek-char in)) (disconnect)) (let ((buffer (make-string (let ((buffer (make-string 6))) (read-string! buffer in) (string->number buffer 16 #t))))) ;; loop until all read (let loop ((start 0) (end (string-length buffer))) (if (= start end) buffer (let ((read-chars (read-substring! buffer start end in))) (loop (+ start read-chars) end)))))) Would anyone apply this to runtime/swank.scm? Thank you :) Peter _______________________________________________ MIT-Scheme-devel mailing list MIT-Scheme-devel@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-devel