Changeset 15723 in project


Ignore:
Timestamp:
09/03/09 05:04:01 (10 years ago)
Author:
Kon Lovett
Message:

Rel 2.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/srfi-29

    r15714 r15723  
    66[[http://srfi.schemers.org/srfi-29/srfi-29.html|SRFI 29]].
    77
     8The addition of the escape code {{~[n]@*}} to the SRFI 28 {{format}} is '''not''' part of
     9this extention.
     10
    811[[toc:]]
    912
     
    1114== Documentation
    1215
    13 Bundles are assumed stored in the system bundle directory, {{(repository-path)
    14 "srfi-29-bundles"}}.
    15 
    16 Within a bundle directory the structure is ({{[LANGUAGE [COUNTRY [SCRIPT
    17 [CODESET [MODIFIER]]]]] PACKAGE-NAME}}.
    18 
    19 Any object which can be returned by {{(read)}} and tested for equality with
    20 {{equal?}} is acceptable as a {{TEMPLATE-NAME}}. So strings are a valid
    21 {{TEMPLATE-NAME}}. Further, {{(localized-template...)}} will return any object
    22 which can be returned by {{(read)}}, not just a string.
    23 
    2416=== Parameters
    2517
     
    4638<parameter>(current-locale-format-function [FORMAT-PROCEDURE])
    4739
    48 Gets or sets the {{FORMAT-PROCEDURE}}. This procedure must have the signature
    49 {{(port | string | boolean string [object]...)}}.
    50 
    51 ==== reset-locale-parameter
     40Gets or sets the {{FORMAT-PROCEDURE}}.
     41
     42This procedure must at least have the signature of a SRFI 28 {{format}}
     43procedure. The default is the Chicken {{format}} procedure.
     44
     45==== reset-locale-parameters
    5246
    5347<procedure>(reset-locale-parameters)</procedure>
    5448
    55 When the {{current-locale}} is changed, (see the [[eggs/locale.html|locale
    56 egg]]), the {{current-*}} parameters need not be set individually. This will
     49When the {{current-locale}} is changed, (see the [[eggs/locale.html|locale egg]]),
     50the {{current-*}} parameters need not be set individually. This will
    5751update those parameters to the values in the new locale. (Reset as in set
    5852anew.)
    5953
    60 === Procedures
    61 
    62 ==== most-specific-bundle-specifier
    63 
    64 <procedure>(most-specific-bundle-specifier PACKAGE-NAME)</procedure>
    65 
    66 Returns the most specific bundle specifier for the current language, country,
    67 and locale details.
     54
     55=== Bundle Operations
     56
     57A {{BUNDLE-SPECIFIER}} is a list of symbols of the form
     58{{(PACKAGE-NAME [LANGUAGE] [COUNTRY] [DETAILS...])}}.
     59
     60A {{BUNDLE-ALIST}} is a list composed of pairs of the form {{(TEMPLATE-NAME . TEMPLATE-VALUE)}}.
     61
     62A {{TEMPLATE-NAME}} is something suitable as a key, such as a {{symbol}} or
     63{{string}}, but maybe any object.
     64
     65A {{TEMPLATE-VALUE}} maybe any object.
     66
     67Note that while a {{TEMPLATE-NAME}} and {{TEMPLATE-VALUE}} can be any object
     68they really should belong to the set of objects with a unique print-form.
    6869
    6970==== declare-bundle!
     
    7980Removes the bundle specified by {{BUNDLE-SPECIFIER}} from the active bundles.
    8081
     82
     83=== Bundle Database Operations
     84
     85While SRFI 29 does not specify how bundles are stored. This extension uses the
     86filesystem is used for the bundle database.
     87
     88Bundles are stored in the system bundle directory, {{(repository-path)
     89"srfi-29-bundles"}}, unless an {{ALTERNATE}} directory is specified. Within a
     90bundle directory the structure is {{[LANGUAGE [COUNTRY [SCRIPT [CODESET
     91[MODIFIER]]]]] PACKAGE-NAME}}.
     92
    8193==== store-bundle!
    8294
    83 <procedure>(store-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure>
    84 
    85 Writes the bundle.
    86 
    87 Uses the {{ALTERNATE-DIRECTORY}} if specified.
     95<procedure>(store-bundle! BUNDLE-SPECIFIER [ALTERNATE])</procedure>
     96
     97Stores the bundle using the {{write}} procedure.
    8898
    8999==== load-bundle!
    90100
    91 <procedure>(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure>
    92 
    93 Reads the bundle.
    94 
    95 Uses the {{ALTERNATE-DIRECTORY}} if specified.
     101<procedure>(load-bundle! BUNDLE-SPECIFIER [ALTERNATE])</procedure>
     102
     103Loads the bundle using the {{read}} procedure.
    96104
    97105==== load-best-available-bundle!
    98106
    99 <procedure>(load-best-available-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure>
    100 
    101 Attempts {{(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])}}, from most
     107<procedure>(load-best-available-bundle! BUNDLE-SPECIFIER [ALTERNATE])</procedure>
     108
     109Attempts {{(load-bundle! BUNDLE-SPECIFIER [ALTERNATE])}}, from most
    102110to least specific.
    103111
     112See {{most-specific-bundle-specifier}}.
     113
    104114==== remove-bundle!
    105115
    106 <procedure>(remove-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure>
     116<procedure>(remove-bundle! BUNDLE-SPECIFIER [ALTERNATE])</procedure>
    107117
    108118Removes the bundle specified by {{BUNDLE-SPECIFIER}} from the active bundles,
    109 and from the filesystem. The bundle directory is {{ALTERNATE-DIRECTORY}},
    110 unless missing. Then the system bundle directory is used.
     119and from the filesystem.
    111120
    112121Will not remove the locale directory hierarchy created by
     
    115124==== remove-bundle-directory!
    116125
    117 <procedure>(remove-bundle-directory! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure>
     126<procedure>(remove-bundle-directory! BUNDLE-SPECIFIER [ALTERNATE])</procedure>
    118127
    119128Removes the bundle directory hierarchy created by {{(store-bundle!...)}}. Will
     
    126135This procedure should be used with caution.
    127136
     137==== declared-bundle-specifiers
     138
     139<procedure>(declared-bundle-specifiers) => LIST</procedure>
     140
     141Returns a list of all the declared {{BUNDLE-SPECIFIER}}s.
     142
     143==== declared-bundle-templates
     144
     145<procedure>(declared-bundle-templates BUNDLE-SPECIFIER) => LIST</procedure>
     146
     147Returns an association-list of all the templates for the {{BUNDLE-SPECIFIER}}.
     148
     149==== most-specific-bundle-specifier
     150
     151<procedure>(most-specific-bundle-specifier PACKAGE-NAME) => BUNDLE-SPECIFIER</procedure>
     152
     153Returns the most specific bundle specifier for the current locale.
     154
     155The current locale is composed of the {{(current-language)}},
     156{{(current-country)}}, and {{(current-locale-details)}}.
     157
     158Note that the {{most-specific-bundle-specifier}} may not be a declared bundle.
     159
     160
     161=== Bundle Template Operations
     162
     163These routines will use the most specific declared bundle for the package
     164{{PACKAGE-NAME}} in the current locale.
     165
    128166==== localized-template
    129167
     
    133171otherwise the {{NOT-FOUND}} value.
    134172
     173==== localized-template/default
     174
     175<procedure>(localized-template/default PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND TEMPLATE-NAME])</procedure>
     176
     177Returns {{(localized-template PACKAGE-NAME TEMPLATE-NAME NOT-FOUND)}}.
     178
     179Somewhat like the Posix 'gettext' routine.
     180
     181==== localized-format
     182
     183<procedure>(localized-format PACKAGE-NAME TEMPLATE-NAME ARG0...) => STRING</procedure>
     184
     185Returns the formatted string using the {{(current-locale-format-function)}} and
     186the format string {{(localized-template PACKAGE-NAME TEMPLATE-NAME)}} on the
     187arguments {{ARG0...}}.
     188
     189When a localized-template is not found and the {{TEMPLATE-NAME}} is a
     190{{string}} then it is used a the format-string.
     191
     192A representation is always displayed, even when no template is found. Just not
     193a localized one.
     194
    135195==== localized-template-set!
    136196
     
    143203example: caching the actual closure for a named procedure.
    144204
    145 ==== localized-template/default
    146 
    147 <procedure>(localized-template/default PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND TEMPLATE-NAME])</procedure>
    148 
    149 Returns {{(localized-template PACKAGE-NAME TEMPLATE-NAME NOT-FOUND)}}.
    150 
    151 Somewhat like the Posix 'gettext' routine.
    152 
    153 ==== localized-format
    154 
    155 <procedure>(localized-format PACKAGE-NAME TEMPLATE-NAME PORT ARG0...)</procedure>
    156 
    157 Formats the arguments {{ARG0...}} to the {{PORT}} using the
    158 {{(current-locale-format-function)}} and the format string
    159 {{(localized-template PACKAGE-NAME TEMPLATE-NAME)}}.
    160 
    161 When a localized-template is not found and the {{TEMPLATE-NAME}} is a
    162 {{string}} then it is used a the format-string.
    163 
    164 A representation is always displayed, even when no template is found. Just not
    165 a localized one.
     205==== localized-templates
     206
     207<procedure>(localized-templates PACKAGE-NAME) => LIST</procedure>
     208
     209Returns an association-list of all the templates for the {{PACKAGE-NAME}}.
     210
    166211
    167212=== Exceptions
    168213
    169 Extension error conditions are signaled with a composite condition of {{(exn
    170 srfi-29)}}.
    171 
    172 The property-condition {{exn}} has properties {{location}}, {{message}}, and,
    173 optionally, {{arguments}}.
    174 
    175 An invalid bundle-specification raises the composite-condition {{(exn srfi-29
    176 insufficient)}}.
    177 
    178 An unknown bundle-specification raises the composite-condition {{(exn srfi-29
    179 undefined)}}.
     214* An unknown bundle-specification raises the composite-condition {{(exn srfi-29 undefined)}}.
     215
     216* Type exceptions {{(exn type)}} are possible.
    180217
    181218
     
    223260== Version history
    224261
    225 ; 2.0.0 : Intitial Chicken 4 release
     262; 2.0.0 : Intitial Chicken 4 release. Added introspection routines. Removed {{PORT}} parameter for {{localized-format}}.
    226263
    227264
     
    230267Copyright (C) 2009 Kon Lovett.  All rights reserved.
    231268
    232 Permission is hereby granted, free of charge, to any person obtaining a
    233 copy of this software and associated documentation files (the Software),
    234 to deal in the Software without restriction, including without limitation
    235 the rights to use, copy, modify, merge, publish, distribute, sublicense,
    236 and/or sell copies of the Software, and to permit persons to whom the
    237 Software is furnished to do so, subject to the following conditions:
    238 
    239 The above copyright notice and this permission notice shall be included
    240 in all copies or substantial portions of the Software.
     269Permission is hereby granted, free of charge, to any person obtaining a copy of
     270this software and associated documentation files (the Software), to deal in the
     271Software without restriction, including without limitation the rights to use,
     272copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
     273Software, and to permit persons to whom the Software is furnished to do so,
     274subject to the following conditions:
     275
     276The above copyright notice and this permission notice shall be included in all
     277copies or substantial portions of the Software.
    241278
    242279THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    243280IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    244 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    245 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    246 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    247 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    248 OTHER DEALINGS IN THE SOFTWARE.
     281FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     282AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     283LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     284OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     285SOFTWARE.
Note: See TracChangeset for help on using the changeset viewer.