Changeset 12818 in project


Ignore:
Timestamp:
12/14/08 23:12:35 (12 years ago)
Author:
Kon Lovett
Message:

Save.

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

Legend:

Unmodified
Added
Removed
  • release/3/locale/trunk/locale-categories.scm

    r12812 r12818  
    1010    (no-bound-checks)
    1111    (export
     12      ;
     13      make-locale-dictionary
     14      locale-dictionary?
     15      set-locale-dictionary-category!
     16      locale-dictionary-category
     17      ;
    1218      locale-category-ref
    1319      set-locale-category!) ) )
    1420
    1521(require-extension
    16   lookup-table)
     22  srfi-9
     23  lookup-table
     24  locale-components)
    1725
    18 ;; The locale categories association list
     26;;;
    1927
    20 (define *locale-categories* (make-dict equal?))
     28(define-record-type locale-dictionary
     29  (%make-locale-dictionary tbl)
     30  locale-dictionary?
     31  (tbl locale-dictionary-table) )
     32
     33(define (make-locale-dictionary)
     34  (%make-locale-dictionary (make-dict)) )
     35
     36;;
     37
     38(define (set-locale-dictionary-category! rec key val)
     39  (check-locale-dictionary 'set-locale-dictionary-category! rec)
     40  (check-symbol 'set-locale-dictionary-category! key)
     41  (if (not val)
     42      (dict-delete! (locale-dictionary-table rec) key)
     43      (begin
     44        (check-locale-components 'set-locale-dictionary-category! val)
     45        (dict-set! (locale-dictionary-table rec) key val) ) ) )
     46
     47;; A locale-component or #f
     48
     49(define (locale-dictionary-category rec key)
     50  (check-locale-dictionary 'locale-dictionary-category rec)
     51  (check-symbol 'locale-dictionary-category key)
     52        (dict-ref (locale-dictionary-table rec) key) )
     53
     54;;;
     55
     56;;
    2157
    2258(define (set-locale-category! what value)
    23   (dict-set! *locale-categories* what value) )
     59  (set-locale-dictionary-category! (current-locale-dictionary) what value) )
    2460
    2561;; A locale-component or #f
    2662
    2763(define (locale-category-ref what)
    28         (dict-ref *locale-categories* what) )
     64        (locale-dictionary-category (current-locale-dictionary) what) )
  • release/3/locale/trunk/locale-components.scm

    r12812 r12818  
    6262      (make-property-condition 'exn 'message msg 'location loc 'arguments args) ) )
    6363
     64(define (make-type-error-message typmsg)
     65  (string-append "bad argument type - not " typmsg) )
     66
    6467(define *type-condition* (make-property-condition 'type))
    6568
    6669(define (make-type-error-condition loc typmsg bad)
    6770  (make-composite-condition
    68    (make-exn-condition loc (string-append "bad argument type - not " typmsg) bad)
     71   (make-exn-condition loc (make-type-error-message typmsg) bad)
    6972   *type-condition*) )
    7073
  • release/3/locale/trunk/locale-eggdoc.scm

    r12812 r12818  
    164164                                                (p "Returns a daylight saving time month.week.day rule object.") )
    165165
    166                                         (procedure "(posix-envvar-timezone->timezone-components STRING [SOURCE \"POSIX\"])"
     166                                        (procedure "(posix-timezone-string->timezone-components STRING [SOURCE \"POSIX\"])"
    167167                                                (p "Parses a POSIX timezone string specification, " (tt "STRING") ", and "
    168168                                                "returns the corresponding timezone-components object, or "
     
    213213                                                (tt "LOCALE-COMPONENTS") " object to " (tt "VALUE") ".") )
    214214
    215                                         (procedure "(posix-envvar-locale->locale-components STRING [SOURCE \"POSIX\"])"
     215                                        (procedure "(posix-locale-string->locale-components STRING [SOURCE \"POSIX\"])"
    216216                                                (p "Parses a POSIX locale string specification, " (tt "STRING") ", and "
    217217                                                "returns the corresponding locale-components object, or " (code "#f") " "
  • release/3/locale/trunk/locale-parameters.scm

    r12812 r12818  
    1414    (no-bound-checks)
    1515    (export
     16      current-locale-dictionary
    1617      current-timezone
    17       current-locale) ) )
     18      current-locale
     19      current-timezone-components
     20      current-locale-components) ) )
    1821
    1922(require-extension
    20   miscmacros)
     23  miscmacros
     24  locale-categories
     25  locale-components
     26  locale-errors)
    2127
    2228;;
    2329
    24 (define-parameter current-timezone #f
    25         (lambda (l)
    26                 (cond ((string? l) l)
    27           ((not l) l)
    28           (else (current-timezone)))) )
     30(define-parameter current-locale-dictionary (make-locale-dictionary)
     31  (lambda (obj)
     32    (cond ((locale-dictionary? obj)
     33            obj)
     34          (else
     35            (warning 'current-locale-dictionary (make-type-error-message "a locale-dictionary") obj)
     36            (current-locale-dictionary)))))
     37
     38;;
     39
     40(define (current-timezone . args)
     41  (cond
     42    [(null? args)
     43      (let ([lc (locale-category-ref 'timezone)])
     44        (and lc
     45             (locale-component-ref lc 'name) ) ) ]
     46    [else
     47      (let-optionals args ([str #f] [src "USER"])
     48        (check-string-or-false 'current-timezone str)
     49        (let ([lc (and str (posix-timezone-string->locale-components str src))])
     50          (set-locale-category! 'timezone lc) ) ) ] ) )
    2951
    3052;; A'la MzScheme
     53;; Treat locale as messages category
    3154
    32 (define-parameter current-locale #f
    33         (lambda (l)
    34                 (cond ((string? l) l)
    35           ((not l) l)
    36           (else (current-locale)))) )
     55(define (current-locale . args)
     56  (cond
     57    [(null? args)
     58      (let ([lc (locale-category-ref 'messages)])
     59        (and lc
     60             (locale-component-ref lc 'name) ) ) ]
     61    [else
     62      (let-optionals args ([str #f] [src "USER"])
     63        (check-string-or-false 'current-locale str)
     64        (let ([lc (and str (posix-locale-string->locale-components str src))])
     65          (set-locale-category! 'messages lc) ) ) ] ) )
     66
     67;;;
     68
     69
     70(define (current-timezone-components)
     71  (locale-category-ref 'timezone) )
     72
     73(define (current-locale-components)
     74  (locale-category-ref 'messages) )
     75
     76;;
     77
     78#;
     79(define current-timezone-components
     80        (let ([cached-timezone #f]
     81                                [cached-components (default-timezone-components)])
     82                (lambda args
     83                  (cond [(null? args)
     84              (let ([timezone (current-timezone)])
     85                (unless (equal? cached-timezone timezone)
     86                  (unless (and timezone
     87                               (and-let* ([(string? timezone)]
     88                                          [tzc (posix-timezone-string->timezone-components timezone)])
     89                                 (current-timezone-components timezone tzc)
     90                                 #t ) )
     91                    (current-timezone-components #f (default-timezone-components)) ) ) ) ]
     92            [(= 2 (length args))
     93              (set! cached-timezone (car args))
     94              (set! cached-components (cadr args)) ]
     95            [else
     96              (error 'current-timezone-components "too few arguments" args) ] )
     97      cached-components ) ) )
     98
     99;;
     100
     101#;
     102(define current-locale-components
     103        (let ([cached-locale #f]
     104                                [cached-components (default-locale-components)])
     105                (lambda args
     106                  (cond [(null? args)
     107              (let ([locale (current-locale)])
     108                (unless (equal? cached-locale locale)
     109                  (unless (and locale
     110                               (and-let* ([(string? locale)]
     111                                          [lc (posix-locale-string->locale-components locale)])
     112                                 (current-locale-components locale lc)
     113                                 #t ) )
     114                    (current-locale-components #f (default-locale-components)) ) ) ) ]
     115            [(= 2 (length args))
     116              (set! cached-locale (car args))
     117              (set! cached-components (cadr args)) ]
     118            [else
     119              (error 'current-locale-components "too few arguments" args) ] )
     120      cached-components ) ) )
  • release/3/locale/trunk/locale-posix.scm

    r12812 r12818  
    1818    (export
    1919      make-posix-timezone
    20       posix-envvar-timezone->timezone-components
    21       posix-envvar-locale->locale-components
     20      posix-timezone-string->timezone-components
     21      posix-locale-string->locale-components
     22      gnu-language-string->locale-components
    2223      posix-load-timezone
    23       posix-load-locale) ) )
     24      posix-load-locale
     25      gnu-load-locale) ) )
    2426
    2527(require-extension
    26   srfi-1 srfi-13 regex
    27   locale-categories locale-components locale-parameters)
     28  srfi-1 srfi-13
     29  regex data-structures
     30  locale-categories
     31  locale-components)
    2832
    2933;;;
     
    7074                                [time-re (regexp "/([0-9]+)(:[0-9]+)?(:[0-9]+)?")]
    7175                                [+defoff+ 3600])
    72                 (lambda (tz strtz)
    73                         (let ([strtzpos 0]
    74             [strtzend (string-length strtz)])
     76                (lambda (tz str)
     77                        (let ([strpos 0]
     78            [strend (string-length str)])
    7579        (letrec (
    7680            [next-match
    7781              (lambda (re)
    78                 (and-let* ([m (string-match re strtz strtzpos)])
    79                   (set! strtzpos (+ strtzpos (string-length (car m))))
    80                   m ) )]
     82                (and-let* ([ml (string-match re str strpos)])
     83                  (set! strpos (+ strpos (string-length (car ml))))
     84                  ml ) )]
    8185            [all-parsed
    82               (lambda () (= strtzpos strtzend))]
     86              (lambda () (>= strpos strend))]
    8387            [fake-dst-rule
    8488              (lambda ()
     
    8791                #t)]
    8892            [to-num
    89               (lambda (str)
     93              (lambda (numstr)
    9094                (string->number
    91                   (cond [(not str)                "0"]
    92                         [(string-prefix? ":" str) (string-trim str #\:)]
    93                         [(string-prefix? "." str) (string-trim str #\.)]
    94                         [else                     str])))]
     95                  (cond [(not numstr)                 "0"]
     96                        [(string-prefix? ":" numstr)  (string-trim numstr #\:)]
     97                        [(string-prefix? "." numstr)  (string-trim numstr #\.)]
     98                        [else                         numstr])))]
    9599            [to-offset
    96100              (lambda (sgnstr hms-lst)
     
    145149               tz ) ) ) ) ) )
    146150
    147 (define (parse-posix-implementation-defined-timezone-value tz strtz)
    148   (warning "cannot understand implementation-defined values" strtz)
     151(define (parse-posix-implementation-defined-timezone-value tz str)
     152  (warning "cannot understand implementation-defined values" str)
    149153  #f )
    150154
    151 (define (parse-posix-pathname-timezone-value tz strtz)
    152   (warning "cannot understand pathname values" strtz)
     155(define (parse-posix-pathname-timezone-value tz str)
     156  (warning "cannot understand pathname values" str)
    153157  #f )
    154158
    155 (define (posix-envvar-timezone->timezone-components strtz . src)
    156   (let ([tz (make-timezone-components strtz (optional src "POSIX"))])
    157     (cond [(string-prefix? ":" strtz)
    158             (parse-posix-implementation-defined-timezone-value tz strtz) ]
    159           [(string-prefix? "/" strtz)
    160             (parse-posix-pathname-timezone-value tz strtz) ]
     159(define (posix-timezone-string->timezone-components str . src)
     160  (let ([tz (make-timezone-components str (optional src "POSIX"))])
     161    (cond [(string-prefix? ":" str)
     162            (parse-posix-implementation-defined-timezone-value tz str) ]
     163          [(string-prefix? "/" str)
     164            (parse-posix-pathname-timezone-value tz str) ]
    161165          [else
    162             (parse-posix-standard-timezone-value tz strtz) ] ) ) )
     166            (parse-posix-standard-timezone-value tz str) ] ) ) )
    163167
    164168;; Splits an IEEEÊStdÊ1003.1-2001 locale specifier string into
     
    177181(define parse-posix-standard-locale
    178182        (let ([locale-re (regexp "([a-zA-Z]+)(-[a-zA-Z]+)?(_[a-zA-Z]+)?(\\.[^@]+)?(@.+)?")])
    179                 (lambda (lc strlcl)
    180                         (and-let* ([r (string-match locale-re strlcl)]
     183                (lambda (lc str)
     184                        (and-let* ([r (string-match locale-re str)]
    181185                 [matched-len 0])
    182186        (let ([l (cadr r)]
     
    203207            (inc-matched-len m)
    204208            (set-locale-component! lc 'modifier (substring m 1)))
    205           (and (= matched-len (string-length strlcl))
     209          (and (= matched-len (string-length str))
    206210               lc ) ) ) ) ) )
    207211
    208 (define (parse-posix-pathname-locale lc strlcl)
    209   (warning "cannot understand pathname locale values" strlcl)
     212(define (parse-posix-pathname-locale lc str)
     213  (warning "cannot understand pathname locale values" str)
    210214  #f )
    211215
    212 (define (posix-envvar-locale->locale-components strlcl . args)
    213   (let-optionals args ([catsym 'locale] [src "POSIX"])
    214     (let ([lc (make-locale-components strlcl src catsym)])
    215       (cond [(or (string=? strlcl "C") (string=? strlcl "POSIX"))
    216               lc ]
    217             [(string-prefix? "/" strlcl)
    218               (parse-posix-pathname-locale lc strlcl) ]
     216(define (posix-locale-string->locale-components str . args)
     217  (let-optionals args ([src "POSIX"] [tag 'locale])
     218    (let ([lc (make-locale-components str src tag)])
     219      (cond [(or (string=? str "C") (string=? str "POSIX"))
     220              #f ]
     221            [(string-prefix? "/" str)
     222              (parse-posix-pathname-locale lc str) ]
    219223            [else
    220               (parse-posix-standard-locale lc strlcl) ] ) ) ) )
    221 
    222 ;; Sets the current timezone posix style
    223 
    224 (define (posix-load-timezone)
    225   (cond ((nonnull-getenv "TZ") => current-timezone)) )
     224              (parse-posix-standard-locale lc str) ] ) ) ) )
    226225
    227226;; The POSIX/GNU locale categories
     
    244243  (for-each
    245244   (lambda (p)
    246      (let ((catsym (cdr p)))
    247        (unless (locale-category-ref catsym)
    248          (cond ((func (car p) catsym) => (cute set-locale-category! catsym <>))) ) ) )
     245     (let ((cat (cdr p)))
     246       ; Will not override existing category value
     247       (unless (locale-category-ref cat)
     248         (cond ((func (car p) cat) => (cute set-locale-category! cat <>))) ) ) )
    249249   *posix-locale-category-names*) )
     250
     251;;
     252
     253(define (gnu-language-string->locale-components str . args)
     254  (let-optionals args ([src "GNU"] [tag 'language])
     255    (let ([lst
     256            (map
     257              (lambda (lclstr)
     258                (let ([lc (posix-locale-string->locale-components lclstr src)])
     259                  (unless (locale-component-ref lc 'region)
     260                    (set-locale-component! lc
     261                      'region (string-upcase (locale-component-ref lc 'language))) )
     262                  lc ) )
     263              (string-split str ":"))])
     264        (let ([lc (make-locale-components str src tag)])
     265          (set-locale-components! lc 'locales lst)
     266          lc ) ) ) )
     267
     268;;;
     269
     270;; Sets the current timezone posix style
     271
     272(define (posix-load-timezone)
     273  (unless (locale-category-ref 'timezone)
     274    (and-let* ([str (nonnull-getenv "TZ")])
     275      (let ((lc (posix-timezone-string->timezone-components str "POSIX")))
     276        (set-locale-category! 'timezone lc)) ) ) )
    250277
    251278;; Create all local category values from the environment
     
    256283                (if str
    257284        ; Then LC_ALL overrides
    258         (let ([lc (posix-envvar-locale->locale-components str)])
     285        (let ([lc (posix-locale-string->locale-components str)])
    259286          (set-posix-locale-categories (lambda (e c) lc)) )
    260287        ; Else set individually, w/ LANG as default
    261288        (let* ([str (nonnull-getenv "LANG")]
    262289               [lc (and str
    263                         (posix-envvar-locale->locale-components str))])
     290                        (posix-locale-string->locale-components str))])
    264291          (set-posix-locale-categories
    265292           (lambda (e c)
    266293             (cond ((nonnull-getenv e)
    267                     => (cute posix-envvar-locale->locale-components <>))
     294                    => (cute posix-locale-string->locale-components <>))
    268295                   (else
    269                     lc)))) ) ) )
    270   ; Treat locale as messages
    271   (and-let* ([lc (locale-category-ref what 'messages)])
    272     (current-locale (locale-component-ref lc 'name) ) ) )
     296                    lc)))) ) ) ) )
    273297
    274298;; GNU LANGUAGE (PATH-sytle list of LANG)
    275299
    276 (define (load-gnu-language)
    277         (and-let* ([str (nonnull-getenv "LANGUAGE")])
    278           (let ([lc (make-locale-components str "GNU" 'language)])
    279             (let ([lst
    280               (map
    281                 (lambda (s)
    282                   (let ([lc (posix-envvar-locale->locale-components s)])
    283                     (unless (locale-component-ref lc 'region)
    284                       (set-locale-component! lc
    285                         'region (string-upcase (locale-component-ref lc 'language))) ) ) )
    286                       (string-split str ":"))])
    287       (set-locale-components! lc 'precedence lst) ) ) ) )
     300(define (gnu-load-locale)
     301  (unless (locale-category-ref 'language)
     302    (and-let* ([str (nonnull-getenv "LANGUAGE")])
     303      (let ([lc (gnu-language-string->locale-components str)])
     304        (set-locale-category! 'language lc) ) ) ) )
  • release/3/locale/trunk/locale.scm

    r12812 r12818  
    1515    (export
    1616      UNKNOWN-LOCAL-TZ-NAME
    17       current-timezone-components
    18       current-locale-components) ) )
     17      BUILTIN-SOURCE) ) )
    1918
    2019(require-extension
    2120  posix
    22   locale-posix locale-components locale-parameters)
    23 
    24 
    25 ;;
    26 
    27 (define current-timezone-components
    28         (let ([cached-timezone #f]
    29                                 [cached-components (default-timezone-components)])
    30                 (lambda args
    31                   (cond [(null? args)
    32               (let ([timezone (current-timezone)])
    33                 (unless (equal? cached-timezone timezone)
    34                   (unless (and timezone
    35                                (and-let* ([(string? timezone)]
    36                                           [tzc (posix-envvar-timezone->timezone-components timezone)])
    37                                  (current-timezone-components timezone tzc)
    38                                  #t ) )
    39                     (current-timezone-components #f (default-timezone-components)) ) ) ) ]
    40             [(= 2 (length args))
    41               (set! cached-timezone (car args))
    42               (set! cached-components (cadr args)) ]
    43             [else
    44               (error 'current-timezone-components "too few arguments" args) ] )
    45       cached-components ) ) )
    46 
    47 ;;
    48 
    49 (define current-locale-components
    50         (let ([cached-locale #f]
    51                                 [cached-components (default-locale-components)])
    52                 (lambda args
    53                   (cond [(null? args)
    54               (let ([locale (current-locale)])
    55                 (unless (equal? cached-locale locale)
    56                   (unless (and locale
    57                                (and-let* ([(string? locale)]
    58                                           [lc (posix-envvar-locale->locale-components locale)])
    59                                  (current-locale-components locale lc)
    60                                  #t ) )
    61                     (current-locale-components #f (default-locale-components)) ) ) ) ]
    62             [(= 2 (length args))
    63               (set! cached-locale (car args))
    64               (set! cached-components (cadr args)) ]
    65             [else
    66               (error 'current-locale-components "too few arguments" args) ] )
    67       cached-components ) ) )
     21  locale-posix
     22  locale-components
     23  locale-parameters)
    6824
    6925;;; When no environment info use Plan B
    7026
    7127(define BUILTIN-SOURCE "BUILTIN")
     28
     29;; Builtin Timezone
    7230
    7331;; Daylight saving time offset from standard offset.
     
    8240      UNKNOWN-LOCAL-TZ-NAME) )
    8341
    84 (define (fake-timezone)
     42(define (make-builtin-timezone)
    8543  ; Need local timezone info
    8644  (let* ([tv (seconds->local-time (current-seconds))]
    8745         [dstf (vector-ref tv 8)]
    8846         [tzn (local-timezone-name)] )
    89     ; Set the current-timezone for future reference.
    90     (current-timezone
    91       (cond-expand
    92         [macosx
    93           ; Since the tzo reflects the dst status need to fake the one not in effect.
    94           (let ([tzo (vector-ref tv 9)])
    95             (if dstf
    96                 (make-posix-timezone UNKNOWN-LOCAL-TZ-NAME (+ tzo DEFAULT-DST-OFFSET) tzn tzo)
    97                 (make-posix-timezone tzn tzo UNKNOWN-LOCAL-TZ-NAME (- tzo DEFAULT-DST-OFFSET)) ) ) ]
    98         [else
    99           ; Since only the standard tzn & tzo are available need to
    100           ; fake summer time.
    101           (let ([tzo (vector-ref tv 9)])
    102             (make-posix-timezone tzn tzo UNKNOWN-LOCAL-TZ-NAME (- tzo DEFAULT-DST-OFFSET)) ) ] ) ) ) )
     47    (cond-expand
     48      [macosx
     49        ; Since the tzo reflects the dst status need to fake the one not in effect.
     50        (let ([tzo (vector-ref tv 9)])
     51          (if dstf
     52              (make-posix-timezone UNKNOWN-LOCAL-TZ-NAME (+ tzo DEFAULT-DST-OFFSET) tzn tzo)
     53              (make-posix-timezone tzn tzo UNKNOWN-LOCAL-TZ-NAME (- tzo DEFAULT-DST-OFFSET)) ) ) ]
     54      [else
     55        ; Since only the standard tzn & tzo are available need to
     56        ; fake summer time.
     57        (let ([tzo (vector-ref tv 9)])
     58          (make-posix-timezone tzn tzo UNKNOWN-LOCAL-TZ-NAME (- tzo DEFAULT-DST-OFFSET)) ) ] ) ) )
    10359
    104 ;;
     60(define (use-builtin-timezone)
     61  (current-timezone (make-builtin-timezone) BUILTIN-SOURCE) )
     62
     63;; Builtin Locale
    10564
    10665(define-constant DEFAULT-LANGUAGE "en")
    10766(define-constant DEFAULT-REGION "US")
    10867
    109 (define (fake-locale)
    110   (current-locale (string-append DEFAULT-LANGUAGE "_" DEFAULT-REGION)) )
     68(define (make-builtin-locale-string)
     69  (string-append DEFAULT-LANGUAGE "_" DEFAULT-REGION) )
     70
     71(define (use-builtin-locale)
     72  (current-locale (make-builtin-locale-string) BUILTIN-SOURCE) )
     73
     74;; Builtin Language List
     75
     76(define (use-builtin-language)
     77  (and-let* ([msglc (locale-category-ref 'messages)])
     78    (let ([lc (make-locale-components (locale-component-ref msglc 'name) BUILTIN-SOURCE 'language)])
     79      (set-locale-components! lc 'locales (list msglc))
     80      (set-locale-category! 'language lc) ) ) )
    11181
    11282;;;
     
    11686;; Use posix locale system, for now
    11787
     88(posix-load-timezone)
    11889(posix-load-locale)
    119 (posix-load-timezone)
     90(gnu-load-locale)
    12091
    12192;; Need the current-timezone-components, and unless we
     
    12394;; time info.
    12495
     96(unless (current-timezone)
     97  (use-builtin-timezone) )
     98
    12599(unless (current-locale)
    126   (fake-locale)
    127   (let ([lc (current-locale)])
    128     (current-locale-components lc (posix-envvar-locale->locale-components lc BUILTIN-SOURCE)) ) )
     100  (use-builtin-locale) )
    129101
    130 (unless (current-timezone)
    131   (fake-timezone)
    132   (let ([tz (current-timezone)])
    133     (current-timezone-components tz (posix-envvar-timezone->timezone-components tz BUILTIN-SOURCE)) ) )
     102(unless (locale-category-ref 'language)
     103  (use-builtin-language) )
  • release/3/locale/trunk/tests/locale-test.scm

    r12812 r12818  
    2727                )
    2828               
    29                 (expect-false "F1" (posix-envvar-timezone->timezone-components ":foo,bar,baz"))
    30                 (expect-false "F2" (posix-envvar-timezone->timezone-components "23,foo"))
    31                 (expect-false "F3" (posix-envvar-timezone->timezone-components "foo/23"))
    32                 (expect-false "F4" (posix-envvar-timezone->timezone-components "foo-23bar/23"))
    33                 (expect-false "F5" (posix-envvar-timezone->timezone-components "foo-23bar-22/23"))
     29                (expect-false "F1" (posix-timezone-string->timezone-components ":foo,bar,baz"))
     30                (expect-false "F2" (posix-timezone-string->timezone-components "23,foo"))
     31                (expect-false "F3" (posix-timezone-string->timezone-components "foo/23"))
     32                (expect-false "F4" (posix-timezone-string->timezone-components "foo-23bar/23"))
     33                (expect-false "F5" (posix-timezone-string->timezone-components "foo-23bar-22/23"))
    3434               
    3535                (expect-equal "S1" tz0
    36                         (posix-envvar-timezone->timezone-components "PST+8:00"))
     36                        (posix-timezone-string->timezone-components "PST+8:00"))
    3737                (expect-equal "S2" tz1
    38                         (posix-envvar-timezone->timezone-components "PST+8:00PDT+7:00:00"))
     38                        (posix-timezone-string->timezone-components "PST+8:00PDT+7:00:00"))
    3939                (expect-equal "S3" tz2
    40                         (posix-envvar-timezone->timezone-components "PST+8:00PDT7,J23/12:34,34/1:00:01"))
     40                        (posix-timezone-string->timezone-components "PST+8:00PDT7,J23/12:34,34/1:00:01"))
    4141                       
    4242                (side-effect (setenv "TZ" "PST+8:00PDT+7:00:00"))
Note: See TracChangeset for help on using the changeset viewer.