Changeset 40530 in project


Ignore:
Timestamp:
09/13/21 16:42:28 (10 days ago)
Author:
Kon Lovett
Message:

remove duplicate exports from omnibus module "locale", seconds->h:m:s-string => seconds->hms, remove regex egg dependency by copy-n-paste

Location:
release/5/locale/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/locale/trunk/locale-posix.scm

    r38483 r40530  
    11;;;; locale-posix.scm
     2;;;; Kon Lovett, Sep '21
    23;;;; Kon Lovett, Mar '19
    34;;;; Kon Lovett, Dec '05
     
    1617(;export
    1718  ;
    18   seconds->h:m:s-string
     19  seconds->hms
    1920  ;
    2021  make-posix-timezone
     
    3536(import (chicken type))
    3637(import (chicken process-context))
     38(import (only (chicken time posix) seconds->local-time local-timezone-abbreviation))
    3739(import (srfi 1))
    3840(import (srfi 13))
    39 (import regex)
    40 (import (only (chicken time posix) seconds->local-time local-timezone-abbreviation))
    4141(import locale-categories)
    4242(import locale-components)
     
    4747
    4848(: fxnegative? (fixnum --> boolean))
    49 ;
    50 (define (fxnegative? n)
    51   (fx> 0 n) )
    52 
    5349(: fxabs (fixnum --> fixnum))
    54 ;
    55 (define (fxabs n)
    56   (if (fxnegative? n) (fxneg n) n) )
     50
     51(define (fxnegative? n) (fx> 0 n))
     52
     53(define (fxabs n) (if (fxnegative? n) (fxneg n) n))
     54
     55;;regex
     56
     57(import (chicken irregex))
     58
     59(define (regexp pat #!optional caseless extended utf8)
     60  (apply
     61   irregex
     62   pat
     63   (let ((opts '()))
     64     (when caseless (set! opts (cons 'i opts)))
     65     (when extended (set! opts (cons 'x opts)))
     66     (when utf8 (set! opts (cons 'utf8 opts)))
     67     opts)))
     68
     69(define (string-match rx str)
     70  (and-let* ((m (irregex-match rx str)))
     71    (let loop ((i (irregex-match-num-submatches m)) (res '()))
     72      (if (fx<= i 0)
     73        (cons str res)
     74        (loop (fx- i 1) (cons (irregex-match-substring m i) res))))))
     75
     76(define (string-search rx str #!optional (start 0) (range (string-length str)))
     77  (let ((n (string-length str)))
     78    (and-let* ((m (irregex-search rx str start (min n (fx+ start range)))))
     79      (let loop ((i (irregex-match-num-submatches m)) (res '()))
     80        (if (fx< i 0)
     81            res
     82            (loop (fx- i 1) (cons (irregex-match-substring m i) res)))))))
    5783
    5884;;
     
    76102;;; Utility
    77103
    78 (define (seconds->h:m:s-string secs)
     104(define (seconds->hms secs)
    79105  (let* (
    80106    (asecs (fxabs secs))
     
    87113(define (make-posix-timezone std-tzn std-off dst-tzn dst-off)
    88114  (string-append
    89     std-tzn (seconds->h:m:s-string std-off)
    90     dst-tzn (seconds->h:m:s-string dst-off)) )
     115    std-tzn (seconds->hms std-off)
     116    dst-tzn (seconds->hms dst-off)) )
    91117
    92118;;; Timezone
  • release/5/locale/trunk/locale.egg

    r39905 r40530  
    33
    44((synopsis "Provides locale operations")
    5  (version "0.8.4")
     5 (version "0.8.5")
    66 (category os)
    77 (author "Kon Lovett")
    88 (license "BSD")
    9  (dependencies srfi-1 srfi-13 regex check-errors)
     9 (dependencies srfi-1 srfi-13 check-errors)
    1010 (test-dependencies test)
    1111 (components
  • release/5/locale/trunk/locale.scm

    r38483 r40530  
    11;;;; locale.scm
     2;;;; Kon Lovett, Sep '21
    23;;;; Kon Lovett, Mar '19
    34;;;; Kon Lovett, May '06
     
    78;; - Only Posix for now.
    89
    9 (module locale
     10(module locale ()
    1011
    11 (;export
    12   ;
    13   ;;locale-timezone
    14   local-timezone-name
    15   local-timezone-offset
    16   local-timezone-name+offset
    17   with-tzset
    18   ;
    19   ;;locale-builtin
    20   builtin-source-name builtin-source-name?
    21   unknown-timezone-name unknown-timezone-name?
    22   use-builtin-timezone
    23   use-builtin-locale
    24   use-builtin-language
    25   ;
    26   ;;locale-posix
    27   seconds->h:m:s-string
    28   make-posix-timezone
    29   posix-timezone-string->timezone-components
    30   posix-locale-string->locale-components
    31   gnu-language-string->locale-components
    32   posix-load-timezone
    33   posix-load-locale
    34   gnu-load-locale
    35   ;
    36   ;;locale-components
    37   ;
    38   make-locale-components
    39   locale-components?
    40   check-locale-components
    41   error-locale-components
    42   locale-components=?
    43   locale-component-ref
    44   locale-component-exists?
    45   set-locale-component!
    46   update-locale-components!
    47   ;
    48   make-timezone-components
    49   timezone-components?
    50   check-timezone-components
    51   error-timezone-components
    52   set-timezone-component!
    53   timezone-component-ref
    54   update-timezone-components!
    55   ;
    56   timezone-offset?
    57   check-timezone-offset
    58   error-timezone-offset
    59   ;
    60   make-timezone-dst-rule-julian-leap
    61   timezone-dst-rule-julian-leap?
    62   check-timezone-dst-rule-julian-leap-day
    63   error-timezone-dst-rule-julian-leap-day
    64   ;
    65   make-timezone-dst-rule-julian-noleap
    66   timezone-dst-rule-julian-noleap?
    67   check-timezone-dst-rule-julian-noleap-day
    68   error-timezone-dst-rule-julian-noleap-day
    69   ;
    70   timezone-dst-rule-julian?
    71   timezone-dst-rule-julian
    72   ;
    73   make-timezone-dst-rule-mwd
    74   timezone-dst-rule-mwd?
    75   check-timezone-dst-rule-mwd
    76   error-timezone-dst-rule-mwd
    77   check-timezone-dst-rule-mwd-day
    78   error-timezone-dst-rule-mwd-day
    79   check-timezone-dst-rule-mwd-week
    80   error-timezone-dst-rule-mwd-week
    81   check-timezone-dst-rule-mwd-month
    82   error-timezone-dst-rule-mwd-month
    83   timezone-components=?
    84   timezone-dst-rule-day
    85   timezone-dst-rule-month
    86   timezone-dst-rule-week
    87   ;
    88   timezone-dst-rule-offset
    89   ;
    90   ;;locale-categories
    91   make-locale-dictionary
    92   locale-dictionary?
    93   set-locale-dictionary-category!
    94   locale-dictionary-category
    95   current-locale-dictionary
    96   locale-category-ref
    97   set-locale-category!
    98   ;;locale-current
    99   current-timezone
    100   current-locale
    101   current-timezone-components
    102   current-locale-components
    103   current-dst?
    104   locale-setup)
     12(import scheme (chicken module))
    10513
    106 (import scheme)
    107 (import (chicken module))
    10814(import locale-builtin)
    10915(import locale-posix)
Note: See TracChangeset for help on using the changeset viewer.