Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | added sub-bytevector and sub-bytevector=?, fix in bytevector-copy* |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
8dc2d825f498cc1d7467b0cd6a9d5b07 |
| User & Date: | aldo 2017-05-03 17:58:49.188 |
Context
|
2017-05-03
| ||
| 18:01 | many fixes to usb.sls check-in: cd7a31d87b user: aldo tags: trunk | |
| 17:58 | added sub-bytevector and sub-bytevector=?, fix in bytevector-copy* check-in: 8dc2d825f4 user: aldo tags: trunk | |
|
2017-01-19
| ||
| 16:26 | fixed bug in open-database for sqlite3 check-in: 8b9bf33c93 user: aldo tags: trunk | |
Changes
Changes to thunder-utils.sls.
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | ;; distributed under the License is distributed on an "AS IS" BASIS, ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ;; See the License for the specific language governing permissions and ;; limitations under the License. (library (thunder-utils) (export string-split string-replace bytevector-copy* read-string | | > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
(library (thunder-utils)
(export string-split string-replace bytevector-copy* read-string
print-stack-trace
sub-bytevector sub-bytevector=?)
(import (scheme) (srfi s14 char-sets))
;; POSSIBLE THAT NOT EXISTS THIS FUNCTION???
;; s is a string , c is a character-set
;; null strings are discarded from result by default unless #f is specified as third argument
(define string-split
(case-lambda
|
| ︙ | ︙ | |||
48 49 50 51 52 53 54 |
(map (lambda (z) (if (cmp z x) y z)) (string->list s)))))
;; WHY THERE NOT EXISTS BYTEVECTOR-COPY WITH src-start and n? F*** YOU
(define bytevector-copy*
(case-lambda
[(bv) (bytevector-copy bv)]
[(bv start)
| | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
(map (lambda (z) (if (cmp z x) y z)) (string->list s)))))
;; WHY THERE NOT EXISTS BYTEVECTOR-COPY WITH src-start and n? F*** YOU
(define bytevector-copy*
(case-lambda
[(bv) (bytevector-copy bv)]
[(bv start)
(bytevector-copy* bv start (- (bytevector-length bv) start))]
[(bv start n)
(let ([dst (make-bytevector n)])
(bytevector-copy! bv start dst 0 n) dst)]))
(define read-string
(case-lambda
[() (read-string #f)]
|
| ︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 |
(case-lambda
[() (printf "[no source] [~a]: ~a\n" name source-txt)]
[(fn bfp) (printf "~a char ~a [~a]: ~a\n" fn bfp name source-txt)]
[(fn line char) (printf "~a:~a:~a [~a]: ~a\n" fn line char name source-txt)]))
(loop (cur 'link) (+ i 1)))))))
(printf "stack-trace end.\n"))
);library
| > > > > > > > > > > > > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
(case-lambda
[() (printf "[no source] [~a]: ~a\n" name source-txt)]
[(fn bfp) (printf "~a char ~a [~a]: ~a\n" fn bfp name source-txt)]
[(fn line char) (printf "~a:~a:~a [~a]: ~a\n" fn line char name source-txt)]))
(loop (cur 'link) (+ i 1)))))))
(printf "stack-trace end.\n"))
(define sub-bytevector
(case-lambda
[(b start)
(sub-bytevector b start (bytevector-length b))]
[(b start end)
(let* ([n (- end start)]
[x (make-bytevector n)])
(bytevector-copy! b start x 0 n)
x)]))
(define (sub-bytevector=? b1 start1 b2 start2 len)
(bytevector=? (sub-bytevector b1 start1 (+ start1 len))
(sub-bytevector b2 start2 (+ start2 len))))
);library
|