Changeset 34414 in project


Ignore:
Timestamp:
08/27/17 04:50:21 (4 weeks ago)
Author:
kon
Message:

bump ver, re-flow, add alt hex code

Location:
release/4/string-utils/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/string-utils/trunk/string-hexadecimal.scm

    r34123 r34414  
    77  string->hex *string->hex)
    88
    9 (import scheme chicken)
     9(import scheme)
     10
     11(import chicken)
     12
     13(import (only lolevel number-of-bytes))
     14(require-library lolevel)
    1015
    1116(import
    12   (only lolevel number-of-bytes)
    1317  (only to-hex str_to_hex)
    1418  (only type-checks check-natural-fixnum check-string))
    15 (require-library lolevel to-hex type-checks)
     19(require-library to-hex type-checks)
     20
     21#|
     22(import
     23  (only (srfi 1) drop drop-right)
     24  (only (srfi 13) string-pad string-concatenate))
     25(require-library
     26  (srfi 1)
     27  (srfi 13))
     28|#
    1629
    1730(declare
     
    2134;;
    2235
     36(define (check-subvector-indexes loc start end)
     37  (unless (<= (check-natural-fixnum loc start 'start)
     38              (check-natural-fixnum loc end 'end))
     39    (##sys#signal-hook
     40      #:bounds-error loc
     41      "illegal subvector specification" start end) )
     42  #;(values start end) )
     43
     44;;
     45
    2346(define (string->hex str #!optional (start 0) (end #f))
    2447  (check-string 'string->hex str)
    25   (check-natural-fixnum 'string->hex start 'start)
    26   (let ((end
    27         (or
    28           (and end (check-natural-fixnum 'string->hex end 'end))
    29           (number-of-bytes str))))
    30     (unless (<= start end)
    31       (##sys#signal-hook
    32         #:bounds-error 'string->hex
    33         "illegal subvector specification" start end))
     48  (let ((end (or end (number-of-bytes str))))
     49    (check-subvector-indexes 'string->hex start end)
    3450    (*string->hex str start end) ) )
    3551
     
    4056      (str_to_hex (make-string (fx* len 2)) str start len) ) ) )
    4157
     58#;
     59(define (*string->hex str start end)
     60  (let* ((ls (string->list str) )
     61         (ls (drop ls start) )
     62         (strlen (string-length str) )
     63         (ls (drop-right ls (fx- strlen end)) ) )
     64    (string-concatenate
     65      (map
     66        (lambda (c)
     67          (string-pad (number->string (char->integer c) 16) 2 #\0))
     68      ls)) ) )
     69
    4270) ;module string-hexadecimal
  • release/4/string-utils/trunk/string-utils.scm

    r34123 r34414  
    1010  unicode-utils
    1111  string-hexadecimal)
    12 
    1312(require-library
    1413  memoized-string
  • release/4/string-utils/trunk/string-utils.setup

    r34123 r34414  
    55(verify-extension-name "string-utils")
    66
    7 (setup-shared-extension-module 'unicode-utils (extension-version "1.2.5")
     7(setup-shared-extension-module 'unicode-utils (extension-version "1.2.6")
    88  #:inline? #t
    99  #:types? #t
     
    1414    -no-procedure-checks))
    1515
    16 (setup-shared-extension-module 'memoized-string (extension-version "1.2.5")
     16(setup-shared-extension-module 'memoized-string (extension-version "1.2.6")
    1717  #:inline? #t
    1818  #:types? #t
     
    2424    -no-procedure-checks))
    2525
    26 (setup-shared-extension-module 'to-hex (extension-version "1.2.5"))
     26(setup-shared-extension-module 'to-hex (extension-version "1.2.6"))
    2727
    28 (setup-shared-extension-module 'string-hexadecimal (extension-version "1.2.5")
     28(setup-shared-extension-module 'string-hexadecimal (extension-version "1.2.6")
    2929  #:inline? #t
    3030  #:types? #t
     
    3535    -no-procedure-checks))
    3636
    37 (setup-shared-extension-module 'string-utils (extension-version "1.2.5")
     37(setup-shared-extension-module 'string-utils (extension-version "1.2.6")
    3838  #:inline? #t
    3939  #:types? #t
Note: See TracChangeset for help on using the changeset viewer.